
Nextcloud has released the beta version of Nextcloud 10. The cloud server system offers some seriously game-changing features, including brute-force protection and two-factor authentication (with an additional plugin).
If you’re already running Nextcloud 9, it’s possible to upgrade without losing any of your data or your configurations. In fact, once you know how the manual upgrade is done, you’ll probably find it painless.
The process of upgrading from Nextcloud 9 to Nextcloud 10 does take some command-line-fu, but if you’re comfortable running commands within the Linux environment, you shouldn’t have any problems with this.
Let’s walk through the process of upgrading Nextcloud to the latest release. I’ll assume your Nextcloud 9 server was installed manually, and that you have administrator privileges on the system.
SEE: Job description: Cloud Engineer (Tech Pro Research)
Step 1
The first thing you must do is download Nextcloud 10. Save that to your ~/Downloads directory and unpack it using either your file manager (right-click the file and select Extract Here) or run the command gunzip nextcloud-10.0beta.zip (if you downloaded the zip file) or tar jxf nextcloud-10.0beta.tar.bz2 (if you downloaded the bzipped file).
Step 2
Before beginning the upgrade, follow these steps to put your Nextcloud server in maintenance mode.
- Open a terminal window.
- Change to the super user with the command sudo su.
- Change to the Nextcloud directory with the command cd /var/www/nextcloud (you may have to alter this, depending upon the document root of your web server).
- Issue the command sudo -u www-data php occ maintenance:mode –on.
Step 3
Before we do any upgrading, we’re going to rename the current folder for the Nextcloud server. To do this, issue the command:
cp -r /var/www/nextcloud /var/www/nextcloud.old
Now let’s remove the old directory with the command:
rm -rf /var/www/nextcloud
Step 4
The next step is to move the newly downloaded and extracted nextcloud folder from ~/Downloads to /var/www/. To do that, issue the command (USER is the actual username):
mv /home/USER/Downloads/nextcloud /var/www/
With that folder in place, we have to move the old data and config folders from /var/www/nextcloud.old to /var/www/nextcloud. Do this with the following commands:
- cp -r /var/www/nextcloud.old/data /var/www/nextcloud
- cp -r /var/www/nextcloud.old/config /var/www/nextcloud
Step 5
Remember when you originally installed Nextcloud, you had to create a script to apply the proper permissions to the folder structure? You have to do that again. Create a script with the following contents:
#!/bin/bash
ocpath=’/var/www/nextcloud’
htuser=’www-data’
htgroup=’www-data’
rootuser=’root’
printf “Creating possible missing Directories\n”
mkdir -p $ocpath/data
mkdir -p $ocpath/assets
mkdir -p $ocpath/updater
printf “chmod Files and Directories\n”
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
printf “chown Directories\n”
chown -R ${rootuser}:${htgroup} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/assets/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
chmod +x ${ocpath}/occ
printf “chmod/chown .htaccess\n”
if [ -f ${ocpath}/.htaccess ]
then
chmod 0644 ${ocpath}/.htaccess
chown ${rootuser}:${htgroup} ${ocpath}/.htaccess
fi
if [ -f ${ocpath}/data/.htaccess ]
then
chmod 0644 ${ocpath}/data/.htaccess
chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess
Fi
Save that file and name it nexcloud_permissions. Give the file executable permission with the command chmod u+x nextcloud_permissions and then run the script with the command ./nextcloud_permissions.
Step 6
Now you must run the upgrade command with the following steps.
- Change into the Nextcloud folder with the command cd /var/www/nextcloud.
- Run the upgrade with the command sudo -u www-data php occ upgrade.
- Allow the upgrade to complete.
Step 7
The final step is to take Nextcloud out of maintenance mode with the command:
sudo -u www-data php occ maintenance:mode –off
You should be able to go to a browser, point it to your Nextcloud server, and enjoy the beta release of 10. Congratulations! Your upgrade was a success.