Upgrading Nextcloud via CLI
-
The built in Nextcloud GUI updater works decent. But even their documentation says to use the CLI updater for larger installs to prevent timeout issues.
Since version 15 finally was available in the stable channel a while back I made a guide while I was performing the update.
For the purposes of this guide, we are going to assume that you are running Nextcloud version 12+ and you are running it on Fedora.
Log in to the command line and switch to the root user
sudo su -
Disable SELinux temporarily
setenforce 0
Change to the Nextcloud directory appropriate to the install
# default location cd /var/www/html/nextcloud
Put Nextcloud in maintenance mode
sudo -u apache php occ maintenance:mode --on
Make a snapshot of your VM
I always make the snapshot at this point because once it is in maintenance mode, no new changes will be accepted.
So if things go to hell and you need to revert, there will be no conflict files.Run the updater.
sudo -u apache php updater/updater.phar
It will display this for an update
Answer yes and it will perform the update.
Tell it no when asked to run the occ upgrade command.
I have had issue with answering yes this step in the past and just never let tit do it anymore. Someday, when I have free time, I will test this out again.
Run the occ upgrade command.
sudo -u apache php occ upgrade
Turn maintenance mode back off.
sudo -u apache php occ maintenance:mode --off
Turn SELinux back on.
setenforce 1
Exit from the root user.
exit
Verify the update is successfully reflected in the web interface
Perform any follow up tasks now listed in the warnings section.
-
@JaredBusch said in Upgrading Nextcloud via CLI:
Make a snapshot of your VM
I always make the snapshot at this point because once it is in maintenance mode, no new changes will be accepted.
So if things go to hell and you need to revert, there will be no conflict files.Do you create a snapshot while the VM is powered on or off before upgrading Nextcloud?
-
I can't speak for @JaredBusch , but I usually take mine with the VM powered on.
-
@black3dynamite said in Upgrading Nextcloud via CLI:
@JaredBusch said in Upgrading Nextcloud via CLI:
Make a snapshot of your VM
I always make the snapshot at this point because once it is in maintenance mode, no new changes will be accepted.
So if things go to hell and you need to revert, there will be no conflict files.Do you create a snapshot while the VM is powered on or off before upgrading Nextcloud?
Generally powered on. If it is a super critical need, I will shut it down.
-
@JaredBusch said in Upgrading Nextcloud via CLI:
@black3dynamite said in Upgrading Nextcloud via CLI:
@JaredBusch said in Upgrading Nextcloud via CLI:
Make a snapshot of your VM
I always make the snapshot at this point because once it is in maintenance mode, no new changes will be accepted.
So if things go to hell and you need to revert, there will be no conflict files.Do you create a snapshot while the VM is powered on or off before upgrading Nextcloud?
Generally powered on. If it is a super critical need, I will shut it down.
Do you snapshot the memory too?
-
@pmoncho said in Upgrading Nextcloud via CLI:
@JaredBusch said in Upgrading Nextcloud via CLI:
@black3dynamite said in Upgrading Nextcloud via CLI:
@JaredBusch said in Upgrading Nextcloud via CLI:
Make a snapshot of your VM
I always make the snapshot at this point because once it is in maintenance mode, no new changes will be accepted.
So if things go to hell and you need to revert, there will be no conflict files.Do you create a snapshot while the VM is powered on or off before upgrading Nextcloud?
Generally powered on. If it is a super critical need, I will shut it down.
Do you snapshot the memory too?
Why do you people always over complicate things?
You pop your host and click make snapshot. Done.
-
@JaredBusch Do you turn off SELinux as a precaution or do you actively have problems while trying to update with it on?
I'm curious because I followed your install guide and I've never turned it off to update and haven't had problems yet.
-
@bnrstnr said in Upgrading Nextcloud via CLI:
@JaredBusch Do you turn off SELinux as a precaution or do you actively have problems while trying to update with it on?
I'm curious because I followed your install guide and I've never turned it off to update and haven't had problems yet.
If you followed my guide, most of the folders do not have HTTPD_RW. I tried without turning it off on the last 14.x to 14.x update and it failed on the precheck for write permissions.
If you change the entire folder to HTTPD_RW it will work without disabling things.
-
@JaredBusch said in Upgrading Nextcloud via CLI:
If you change the entire folder to HTTPD_RW it will work without disabling things.
Ah yeah, probably this. SELinux is a complete mystery to me :man_shrugging:
-
@bnrstnr said in Upgrading Nextcloud via CLI:
@JaredBusch said in Upgrading Nextcloud via CLI:
If you change the entire folder to HTTPD_RW it will work without disabling things.
Ah yeah, probably this. SELinux is a complete mystery to me :man_shrugging:
ls -lashZ /var/www/html
Will show you the context on your Nextcloud folder. Technically, just the Z is for the context