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/
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 nextclouduser@localhost identified by 'imepoutzpanqhzjuvtuq';
grant all privileges on nextcloud.* to nextclouduser@localhost 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
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
2)enable swap
How to activate SWAP on Asus RT-AC68U router
To enable linux SWAP on your Asus RT-AC68U router you need the following: Custom firmware with jffs partition enabled (I recommend Asuswrt-Merlin build); an USB HDD or USB flash drive to mount on o…
mydevtutorials.wordpress.com
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 nextclouduser@localhost identified by 'imepoutzpanqhzjuvtuq';
grant all privileges on nextcloud.* to nextclouduser@localhost 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: