Upgrade Manually¶
Always start by making a fresh backup and disabling all 3rd party apps.
Back up your existing Nextcloud Server database, data directory, and
config.php
file. (See Backup, for restore information see Restoring Backup)Download and unpack the latest Nextcloud Server release (Archive file) from nextcloud.com/install/ into an empty directory outside of your current installation.
Note
To unpack your new tarball, run: unzip nextcloud-[version].zip
Stop your Web server.
Rename your current Nextcloud directory, for example
nextcloud-old
.Unpacking the new archive creates a new
nextcloud
directory populated with your new server files. Copy this directory and its contents to the original location of your old server, for example/var/www/
, so that once again you have/var/www/nextcloud
.Copy the
config.php
file from your old Nextcloud directory to your new Nextcloud directory.If you keep your
data/
directory in yournextcloud/
directory, copy it from your old version of Nextcloud to your newnextcloud/
. If you keep it outside ofnextcloud/
then you don’t have to do anything with it, because its location is configured in your originalconfig.php
, and none of the upgrade steps touch it.If you are using 3rd party applications, look in your new
nextcloud/apps/
directory to see if they are there. If not, copy them from your oldapps/
directory to your new one. Make sure the directory permissions of your third party application directories are the same as for the other ones.Adjust file ownership and permissions:
chown -R www-data:www-data nextcloud find nextcloud/ -type d -exec chmod 750 {} \; find nextcloud/ -type f -exec chmod 640 {} \;
Restart your Web server.
Now launch the upgrade from the command line using
occ
, like this example on Ubuntu Linux:sudo -u www-data php occ upgrade
The upgrade operation takes a few minutes to a few hours, depending on the size of your installation. When it is finished you will see a success message, or an error message that will tell where it went wrong.
Login and take a look at the bottom of your Admin page to verify the version number. Check your other settings to make sure they’re correct. Go to the Apps page and review the core apps to make sure the right ones are enabled. Re-enable your third-party apps.
Previous Nextcloud Releases¶
You’ll find previous Nextcloud releases in the Nextcloud Server Changelog.
Troubleshooting¶
When upgrading Nextcloud and you are running MySQL or MariaDB with binary logging enabled, your upgrade may fail with these errors in your MySQL/MariaDB log:
An unhandled exception has been thrown:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1665
Cannot execute statement: impossible to write to binary log since
BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited
to row-based logging. InnoDB is limited to row-logging when transaction
isolation level is READ COMMITTED or READ UNCOMMITTED.'
Please refer to MySQL / MariaDB with Binary Logging Enabled on how to correctly configure your environment.
Occasionally, files do not show up after a upgrade. A rescan of the files can help:
sudo -u www-data php console.php files:scan --all
See the nextcloud.com support page for further resources.
Sometimes, Nextcloud can get stuck in a upgrade if the web based upgrade process is used. This is usually due to the process taking too long and encountering a PHP time-out. Stop the upgrade process this way:
sudo -u www-data php occ maintenance:mode --off
Then start the manual process:
sudo -u www-data php occ upgrade
If this does not work properly, try the repair function:
sudo -u www-data php occ maintenance:repair