Upgrading NextCloud on AWS

Procedures to upgrade NextCloud runs on AWS

Upgrading NextCloud on AWS
Photo by Clint Patterson / Unsplash
Upgrade manually — Nextcloud latest Administration Manual latest documentation

Has not been tested

Backup

Snapshots on EC2, RDS, S3

Download

Latest

Steps

Stop Web Server

sudo service apache2 stop

Stop NextCloud Cron

Put a # at the beginning of the corresponding line.

sudo crontab -u www-data -e

Rename Existing NextCloud Folder

to nextcloud-old

Unpack

tar -xjf latest.tar.bz2

Move the Unpacked Folder

sudo mv latest /var/www/nextcloud

Move Config

sudo cp /var/www/nextcloud-old/config/config.php /var/www/nextcloud/config/config.php

Move Data

sudo cp -r /var/www/nextcloud-old/data /var/www/nextcloud/data

Move Apps

sudo cp -r /var/www/nextcloud-old/apps /var/www/nextcloud/apps

Move Themes

sudo cp /var/www/nextcloud-old/themes /var/www/nextcloud/themes

Ownership and Permission

sudo chown -R www-data:www-data nextcloud
find nextcloud/ -type d -exec chmod 750 {} \;
find nextcloud/ -type f -exec chmod 640 {} \;

Start Web Server

sudo service apache2 start

Perform Upgrade

sudo -u www-data php occ upgrade

Re-enable NextCloud Cron

Delete the # at the beginning of the corresponding line

sudo crontab -u www-data -e

Completed!

Foreseeable Issues

File Missing

sudo -u www-data php console.php files:scan --all

Maintenance

sudo -u www-data php occ maintenance:mode --off

Repair

sudo -u www-data php occ maintenance:repair