diff --git a/setupnc.sh b/setupnc.sh index a67d141..7c1acc6 100644 --- a/setupnc.sh +++ b/setupnc.sh @@ -93,6 +93,25 @@ sed -i 's|| \n apt -y install libmagickcore-6.q16-6-extra systemctl restart apache2 +## Let's install Redis Server to manage file locking... + +apt -y install redis-server +systemctl start redis-server +systemctl enable redis-server + +### Let's install APCu... + +#apt -y install php-dev php-pear build-essential +#pecl install apcu +#systemctl restart apache2 +#systemctl restart php8.3-fpm +#echo "[apcu]" >> /etc/php/8.3/fpm/conf.d/99-nextcloud.ini +#echo "apc.enabled=1" >> /etc/php/8.3/fpm/conf.d/99-nextcloud.ini +#echo "apc.shm_size=32M" >> /etc/php/8.3/fpm/conf.d/99-nextcloud.ini +#echo "apc.ttl=3600" >> /etc/php/8.3/fpm/conf.d/99-nextcloud.ini +#echo "apc.enable_cli=1" >> /etc/php/8.3/fpm/conf.d/99-nextcloud.ini +#systemctl restart php8.3-fpm + ## Time to download the latest copy of Nextcloud wget https://download.nextcloud.com/server/releases/latest.zip @@ -112,29 +131,63 @@ chown -R www-data:www-data /home/nextcloudfiles ## Let's do the web install without a browser cd /var/www/html +echo "Installing Nextcloud..." sudo -u www-data php occ maintenance:install --database="mysql" --database-host="localhost" --database-name="$dbname" --database-user="$dbuser" --database-pass="$dbpass" --admin-user="$adminuser" --admin-pass="$adminpass" --data-dir="/home/nextcloudfiles" ## Configuring Nextcloud cp /var/www/html/config/config.php /var/www/html/config/config.php.original +echo "Configuring Trusted Domains..." sudo -u www-data php occ config:system:set trusted_domains 0 --value="*" +echo "Configuring maintenance window..." sudo -u www-data php occ config:system:set maintenance_window_start --type=integer --value=1 -( crontab -u www-data -l 2>/dev/null; echo '*/5 * * * * php -f /var/www/html/cron.php' ) | crontab -u www-data - -sudo -u www-data php occ maintenance:repair --include-expensive +echo "Configuring debug mode off..." sudo -u www-data php occ config:system:set debug --type=boolean --value=false -sudo -u www-data php occ config:system:set memcache.local --type=string --value=\OC\Memcache\APCu +echo "Configuring local memcache as APCu..." +sudo -u www-data php occ config:system:set memcache.local --type=string --value="\OC\Memcache\APCu" +echo "Configuring locking memcache as Redis..." +sudo -u www-data php occ config:system:set memcache.locking --type=string --value="\OC\Memcache\Redis" +sudo -u www-data php occ config:system:set redis host --type=string --value=localhost +sudo -u www-data php occ config:system:set redis port --type=integer --value=6379 +sudo -u www-data php occ config:system:set redis timeout --type=float --value=0.0 +echo "Configuring crontab..." +( crontab -u www-data -l 2>/dev/null; echo '*/5 * * * * php -f /var/www/html/cron.php' ) | crontab -u www-data - +echo "Running a full install check and repair..." +sudo -u www-data php occ maintenance:repair --include-expensive ## Let's make a script so you can use the occ CLI tool from anywhere on your server -echo -e '#!/bin/bash\n\ncd /var/www/nextcloud\nsudo -u www-data php occ $@' > /usr/bin/occ && chmod +x /usr/bin/occ +echo "Creating a global script to allow occ CLI tool to be access from anywhere on the server..." +echo -e '#!/bin/bash\n\ncd /var/www/html\nsudo -u www-data php occ $@' > /usr/bin/occ && chmod +x /usr/bin/occ ## Clean up time... +echo "Cleaning up..." apt -y autoremove ## DONE - +echo +echo +echo echo "You can now configure your networking for static IP, but what I do," -echo "is assign a static IP by using DHCP reservation in my Router." -echo "You can forward port 80. This is because it's a selfsigned certificate." +echo "is assign a static IP by using DHCP reservation in my Router. You" +echo "can forward port 80 on your router if you want outside access." +echo +echo "To use the occ CLI tool you can simply type occ from any localtion" +echo "on the terminal." +echo +echo "Your user files are in the folder /home/nextcloudfiles" +echo +echo "A cronjob has been configured so you can switch from AJAX to Cron" +echo "which will improve page load times." +echo +echo "To log on to your server point your browser to http://ipaddress" +echo " Admin Username : $adminuser" +echo " Admin Password : $adminpass" +echo +echo "Don't forget to give your Admin User a valid email address on the" +echo "profile page, or you will not be able to configure the mail server" +echo "settings. For the settings to be saved a test mail has to be sent" +echo "to the email address associated with the Admin User." +echo echo "If you have any issues, DM me on Reddit u/thisiszeev"