Asus RT-AC86U and Debian Bullseye + Nextcloud

chavo

Regular Contributor
1) install entware

2)enable swap
swapon /opt/swap

3)
opkg install debootstrap binutils

/tmp/mnt/asus - usb disk

debootstrap --arch=arm64 bullseye /opt/debian/ http://ftp.debian.org/debian/

/opt/sbin/debootstrap: line 467: command: not found
/opt/sbin/debootstrap: line 611: can't create /opt/debian/test-dev-null: Permission denied
E: Cannot install into target '/opt/debian' mounted with noexec or nodev

mount -i -o remount,exec,dev /tmp/mnt/asus

debootstrap --arch=arm64 bullseye /opt/debian/ http://ftp.debian.org/debian/

mv /opt/etc/init.d/S99debian /opt/etc/


Code:
cat >> /opt/etc/init.d/S99debian << 'EOF'
#!/bin/sh

PATH=/opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin

# Folder with Debian Jessie

CHROOT_DIR=/tmp/mnt/sda1/entware/debian

# Some folder outside of sandbox,
# will be mounted to /mnt folder in Debian
# Uncommented "EXT_DIR=" line if you need to
# mount a folder inside debian (remove #)
# EXT_DIR=/tmp/mnt/sda1/Media/

CHROOT_SERVICES_LIST=/opt/etc/chroot-services.list

if [ ! -e "$CHROOT_SERVICES_LIST" ]; then
    echo "Please, define Debian services to start in $CHROOT_SERVICES_LIST first!"
    echo "One service per line. Hint: this is a script names from Debian's /etc/init.d/"
    exit 1
fi

MountedDirCount="$(mount | grep $CHROOT_DIR | wc -l)"

start() {
    if [ $MountedDirCount -gt 0 ]; then
        echo "Chroot'ed services seems to be already started, exiting..."
        exit 1
    fi
   
    echo "Starting chroot'ed Debian services..."
   
    for dir in dev proc sys; do
        mount -o bind /$dir $CHROOT_DIR/$dir
    done
   
    [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt
   
    for item in $(cat $CHROOT_SERVICES_LIST); do
        chroot $CHROOT_DIR /etc/init.d/$item start
    done
}

stop() {
    if [ $MountedDirCount -eq 0 ]; then
        echo "Chroot'ed services seems to be already stopped, exiting..."
        exit 1
    fi

    echo "Stopping chroot'ed Debian services..."
   
    for item in $(cat $CHROOT_SERVICES_LIST); do
        chroot $CHROOT_DIR /etc/init.d/$item stop
        sleep 2
    done
   
    umount /opt/debian/dev/pts
   
    mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l
}

restart() {
    if [ $MountedDirCount -eq 0 ]; then
        echo "Chroot'ed services seems to be already stopped"
        start
    else
        echo "Stopping chroot'ed Debian services..."

        for item in $(cat $CHROOT_SERVICES_LIST); do
            chroot $CHROOT_DIR /etc/init.d/$item stop
            sleep 2
        done

        mount | grep $CHROOT_DIR | awk '{print $3}' | xargs umount -l

        echo "Restarting chroot'ed Debian services..."

        for dir in dev proc sys; do
            mount -o bind /$dir $CHROOT_DIR/$dir
        done

        [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt

        for item in $(cat $CHROOT_SERVICES_LIST); do
            chroot $CHROOT_DIR /etc/init.d/$item start
        done
    fi
}

enter() {
    [ -z "$EXT_DIR" ] || mount -o bind $EXT_DIR $CHROOT_DIR/mnt

    mount -o bind /dev/ /opt/debian/dev/
    mount -o bind /dev/pts /opt/debian/dev/pts
    mount -o bind /proc/ /opt/debian/proc/
    mount -o bind /sys/ /opt/debian/sys/

    chroot /opt/debian /bin/bash
}

status() {
    if [ $MountedDirCount -gt 0 ]; then
        echo "Chroot'ed services running..."
    else
        echo "Chroot'ed services not running!"
    fi
}

case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    restart
    ;;
enter)
    enter
    ;;
status)
    status
    ;;
*)
    echo "Usage: (start|stop|restart|enter|status)"
    exit 1
    ;;
esac
echo Done.
exit 0
EOF

chmod 755 /opt/etc/init.d/S99debian

4) change in /opt/etc/init.d/S99debian
CHROOT_DIR=/tmp/mnt/sda1/entware/debian
to
CHROOT_DIR=/tmp/mnt/asus/entware/debian

/tmp/mnt/asus - mount disk

5)
touch /opt/etc/chroot-services.list
ln -s /opt/etc/init.d/S99debian /opt/bin/debian


6)

7) debian enter

8) apt update && apt upgrade -y

9) dpkg-reconfigure tzdata

10) apt-get install -y locales

11)
echo en_US UTF-8 >> /etc/locale.gen
locale-gen

12) apt install wget


NEXTCLOUD


13)
apt install -y apache2 apache2-utils
nano /etc/apache2/ports.conf


change port to 81 and 444

service apache2 start
apache2 -v

chown www-data:www-data /var/www/html/ -R
nano /etc/apache2/conf-available/servername.conf

write "ServerName localhost"
a2enconf servername.conf
service apache2 reload
apache2ctl -t

apt -y install mariadb-server mariadb-client
service mariadb start
mysql_secure_installation

set root password "vrxzqjmfnwlvanhvebbj"
mariadb -u root
type "exit"
mariadb --version

apt -y install php7.4 libapache2-mod-php7.4 php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline
a2enmod php7.4
service apache2 restart
php --version

echo "<?php phpinfo(); ?>" > /var/www/html/info.php


open in browser http://192.168.1.1:81/info.php

a2dismod php7.4
apt install php7.4-fpm
a2enmod proxy_fcgi setenvif
a2enconf php7.4-fpm
service php7.4-fpm start
service apache2 restart


open in browser http://192.168.1.1:81/info.php

rm /var/www/html/info.php

wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.zip
apt -y install unzip
unzip nextcloud-23.0.0.zip -d /var/www/
chown www-data:www-data /var/www/nextcloud/ -R
rm -rf nextcloud-23.0.0.zip

mysql

create database nextcloud;
create user [email protected] identified by 'imepoutzpanqhzjuvtuq';
grant all privileges on nextcloud.* to [email protected] identified by 'imepoutzpanqhzjuvtuq';
flush privileges;
exit;

mkdir /etc/apache2/ssl
cd /etc/apache2/ssl
openssl genrsa -out nextcloud.key 2048
openssl req -x509 -new -key nextcloud.key -days 36500 -out nextcloud.crt
nano /etc/apache2/sites-available/nextcloud.conf

write this text
Code:
<VirtualHost *:444>
        Protocols h2 http/1.1
        DocumentRoot "/var/www/nextcloud"
        ServerName 192.168.1.1

        ErrorLog ${APACHE_LOG_DIR}/nextcloud.error
        CustomLog ${APACHE_LOG_DIR}/nextcloud.access combined

        SSLEngine on
        SSLProtocol all -SSLv2

        SSLCertificateFile     /etc/apache2/ssl/nextcloud.crt
        SSLCertificateKeyFile  /etc/apache2/ssl/nextcloud.key
        Header always set Strict-Transport-Security: "max-age=31536000; includeSubdomains"

        <Directory /var/www/nextcloud/>
            Require all granted
            Options FollowSymlinks MultiViews
            AllowOverride All

            <IfModule mod_dav.c>
                Dav off
            </IfModule>

            SetEnv HOME /var/www/nextcloud
            SetEnv HTTP_HOME /var/www/nextcloud
            Satisfy Any

         </Directory>

</VirtualHost>


a2ensite nextcloud.conf
a2enmod rewrite headers env dir mime setenvif ssl
apache2ctl -t
service apache2 restart

apt -y install php-imagick php7.4-common php7.4-mysql php7.4-fpm php7.4-gd php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-bcmath php7.4-gmp
service apache2 reload

apt -y install libmagickcore-6.q16-6-extra php-imagick imagemagick

mkdir /var/www/nextcloud-data
chown www-data:www-data /var/www/nextcloud-data -R

cat /etc/php/7.4/fpm/php.ini | grep upload_max_filesize
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 102400M/g' /etc/php/7.4/fpm/php.ini
cat /etc/php/7.4/fpm/php.ini | grep upload_max_filesize
service php7.4-fpm restart

cat /etc/php/7.4/fpm/php.ini | grep post_max_size
sed -i 's/post_max_size = 8M/post_max_size = 128G/g' /etc/php/7.4/fpm/php.ini
cat /etc/php/7.4/fpm/php.ini | grep post_max_size
service php7.4-fpm restart

cat /etc/php/7.4/fpm/php.ini | grep max_input_time
sed -i 's/max_input_time = 60/max_input_time = 36000/g' /etc/php/7.4/fpm/php.ini
cat /etc/php/7.4/fpm/php.ini | grep max_input_time
service php7.4-fpm restart

cat /etc/php/7.4/fpm/php.ini | grep max_execution_time
sed -i 's/max_execution_time = 30/max_execution_time = 36000/g' /etc/php/7.4/fpm/php.ini
cat /etc/php/7.4/fpm/php.ini | grep max_execution_time
service php7.4-fpm restart


a2enmod http2
service apache2 restart
a2dismod php7.4
a2dismod mpm_prefork
a2dismod mpm_worker
a2enmod mpm_event proxy_fcgi setenvif
apt -y install php7.4-fpm
a2enconf php7.4-fpm
service apache2 restart


open in browser https://192.168.1.1:444/

admin
sobylngtqdgwxvdmiqcj

/var/www/nextcloud-data

nextclouduser
imepoutzpanqhzjuvtuq
nextcloud
localhost


11) exit chroot

nano /opt/etc/chroot-services.list

write

apache2
mariadb
php7.4-fpm


12) start

debian start

13) stop

debian stop
 
Last edited:

L&LD

Part of the Furniture
You can simply enable the swap file (10GB recommended if you'll be using other amtm supported scripts) by using amtm (via ssh) instead. ;)
 

Oracle

Regular Contributor
For people who are not highly experienced in this matter, would anyone care to explain what all this means in practical terms?
What's the router performance once all this is installed, how does Nextcloud work?

I've read in the forum the router hardware is totally inadequate for such tasks.
 

L&LD

Part of the Furniture
Generally speaking, if you don't know what/how it can benefit you (did you read their websites?), you don't need it.
 

Crimliar

Senior Member
On an RT-AC86U? Isn't this likely to cook the CPU - I had a fan on mine just to have it working as a router! *If I were using NextCloud for its intended purpose, then it's a bit of a stretch on a decent SBC, let alone a router!
 

Oracle

Regular Contributor
It's a great tool but even with all my enthusiasm to install Linux on a toaster, I don't see this as realistic.
Hence my question on the practicality of the code above. Genuine curiosity.
 

stebrick

Regular Contributor
I'm trying to install Debian Bulleyes on my Asus XT8 but I'm stuck at step 3

After issuing the following 2 commands:-
Code:
mount -i -o remount,exec,dev /tmp/mnt/sda2

debootstrap --arch=arm64 bullseye /opt/debian/ http://ftp.debian.org/debian/

They return:-
Code:
/opt/sbin/debootstrap: line 467: command: not found
W: Cannot find binary for checking sha256 checksums, falling back to sha1
W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg
E: Invalid Release file, no entry for main/binary-arm64/Packages

I tried replacing arm64 with armhf but the result is the same.
Any idea? I'm out of cards now :(
 

stebrick

Regular Contributor
please run
df -h
copy here

Holy...your light speed reply scared the crap out of me. Never expected that at all. Greatly appreciated :)

Here it is:-

Code:
Filesystem                Size      Used Available Use% Mounted on
/dev/root                54.5M     54.5M         0 100% /
devtmpfs                249.0M         0    249.0M   0% /dev
tmpfs                   249.1M    408.0K    248.7M   0% /var
tmpfs                   249.1M      1.8M    247.2M   1% /tmp/mnt
ubi1:data                 4.5M     76.0K      4.1M   2% /data
tmpfs                   249.1M      1.8M    247.2M   1% /tmp/mnt
tmpfs                   249.1M      1.8M    247.2M   1% /tmp
/dev/mtdblock9           47.0M      6.6M     40.4M  14% /jffs
/dev/sda2               907.0G    208.8M    860.7G   0% /tmp/mnt/sda2
 

stebrick

Regular Contributor
After retrieving the packages a while...

Code:
I: Retrieving zlib1g 1:1.2.11.dfsg-2+deb11u1
I: Validating zlib1g 1:1.2.11.dfsg-2+deb11u1
I: Chosen extractor for .deb packages: ar
I: Extracting libacl1...
E: Extracting .//var/cache/apt/archives/libacl1_2.2.53-10_arm64.deb requires the xzcat command, which is not available

What should I do next? And where should I extract them to? A detailed commands breakdown here would be great to newbie like me :(

I tried to ignore this error by proceeding to the next few steps (mv /opt/etc/init.d/S99debian /opt/etc/, and configure S99debian), of course it doesn't work.
 

stebrick

Regular Contributor
need install xzcat
opkg list | grep xzcat
opkg install xz

Sorry it was too late for me last night.

Code:
[email protected]_XT8-6410:/tmp/home/root# opkg list | grep xzcat
xz - 5.2.5-3 - Contains: xz  lzcat lzma unlzma unxz xzcat
[email protected]_XT8-6410:/tmp/home/root# opkg install xz
Package xz (5.2.5-3) installed in root is up to date.

xz-utils had been installed too:
Code:
opkg install xz-utils
Package xz-utils (5.2.5-3) installed in root is up to date.

And the error still persists :(
 
Last edited:

chavo

Regular Contributor
here the same problem
but all works
try run
xzcat

Code:
[email protected]:/mnt/JFFS# xzcat
bash: xzcat: command not found
 
Last edited:

chavo

Regular Contributor
tested on asus ac86u
I: Retrieving zlib1g 1:1.2.11.dfsg-2+deb11u1
I: Validating zlib1g 1:1.2.11.dfsg-2+deb11u1
I: Chosen extractor for .deb packages: ar
I: Extracting libacl1...
I: Extracting adduser...
I: Extracting apt...
I: Extracting libapt-pkg6.0...
 

stebrick

Regular Contributor
here the same problem
but all works
try run
xzcat

Code:
[email protected]:/mnt/JFFS# xzcat
bash: xzcat: command not found

Yes, I tried google around and found those pages too.

Running xzcat gives me this error:
Code:
[email protected]_XT8-6410:/tmp/home/root# xzcat
-sh: xzcat: not found
 

chavo

Regular Contributor
on may router
Code:
[email protected]:/tmp/home/root# xzcat
xzcat: compressed data not read from terminal, use -f to force it

Code:
[email protected]:/tmp/home/root# which xzcat
/opt/bin/xzcat

run this commnad
opkg update

print out here

Code:
[email protected]:/tmp/mnt/asus/entware/bin# ls -la xzcat
lrwxrwxrwx    1 admin    root            16 Jun 21 09:58 xzcat -> /opt/bin/busybox

xzcat - its symlink to busybox
why you dont have - strange

opkg http://bin.entware.net/aarch64-k3.10/
xz and xz-utils - dosnt have xzcat
 
Last edited:

stebrick

Regular Contributor
run this commnad
opkg update

print out here

Code:
[email protected]:/tmp/mnt/asus/entware/bin# ls -la xzcat
lrwxrwxrwx    1 admin    root            16 Jun 21 09:58 xzcat -> /opt/bin/busybox

xzcat - its symlink to busybox
why you dont have - strange

opkg http://bin.entware.net/aarch64-k3.10/
xz and xz-utils - dosnt have xzcat

Code:
[email protected]_XT8-6410:/tmp/home/root# opkg update
Downloading https://bin.entware.net/armv7sf-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware


Code:
[email protected]_XT8-6410:/tmp/mnt/sda2/entware# cd bin
[email protected]_XT8-6410:/tmp/mnt/sda2/entware/bin# ls -la xzcat
ls: xzcat: No such file or directory

o_Oo_Oo_O
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top