Forum archive
How to update NextCloud to the latest version?
[UPDATE for v15.x] Please note that as of v15.x Nextcloud is installed to /var/www/nextcloud so the paths noted in this thread will need to be adjusted. Also, ownership to the /var/www/nextcloud directory will need to be given to the webserver user (www-data). I.e. "chown -R www-data:www-data /var/www/nextcloud". Otherwise the instructions should be relevant.
I just had a question via email regarding how to update NextCloud to the latest version on our NextCloud appliance. Rather than just answer via email, I thought it'd be best to post on the forums so everyone can benefit. Here's the original question:
I was able to ssh to my nextcloud virtual machine in Proxmox, but from there commands in the "nextcloud guide" to upgrade are mostly not working and useless, sudo does not exist too. I have done logon with user "root" and "nextcloud" as password, my nextcloud user is another instead, and I'm unable to ssh with my nexclout user and password.
For starters, there is no need to use a separate 'nextcloud' Linux user account. All you should need is 'root'. The NextCloud software runs as the webserver user (www-data). If you explictly want to set up a new user account (and not use root) please start a new thread asking about that and I'll respond.
Please note that I haven't tested anything I post here, so if it doesn't work, please let me know (and post the output your get) and I'll try to help resolve it.
On face value it appears to have a fairly simple workaround. The NextCloud manual upgrade instructions are pretty close and only need minor tweaking to apply to the TurnKey appliance.
Firstly, my guess is that you'll either need to run the 'occ' command within the NextCloud application directory, or you'll need to provide the full path to 'occ'. FWIW in v14.2 NextCloud is installed to /usr/share/nextcloud. For the next release we'll move that to /var/www/nextcloud, which is where most users would expect it. I'll use the full path for now, but if that doesn't work, perhaps try 'cd /usr/share/nextcloud' first.
Furthermore, as you note, TurnKey doesn't have sudo installed. That can be worked around a few different ways:
- install sudo
- use the 'su' command to achieve the same ends as 'sudo'
- or change the order that the processes are done i.e. run the update first as root, then change ownership to the webserver user (www-data)
option 1
Installing software from the Debian repos is super simple:
apt-get update apt-get install sudoThen just provide the full path to 'occ' like this:
sudo -u www-data php /usr/share/nextcloud/occ upgrade
option 2
Instead of running the command in step 11; instead run this:
su - -s /bin/bash www-data -c 'php /usr/share/nextcloud/occ upgrade'
option 3
When you get to step 9, instead of running that, instead skip straight to step 11. Then drop the sudo, so instead something like this:
php /usr/share/nextcloud/occ upgrade
Note: I have struck out "option 3" as I have discovered that it won't work because Nextcloud update script will not run as root!
FWIW, I don't think option 3 will work either as I've since discovered that NextCloud will not allow you to run the update script as root. I'll update the OP and strike that out.