Knowledge Base

Browse our knowledge base for free solutions to common problems

Upgrading Nexcloud Via SSH CLI Linux

Created On: 14 September 2022
Written by: Ben

Overview

Upgrading via the CLI can be a little bit more convenient if you wish to avoid annoying prompts and install wizards. For Nextcloud this can be done using the occ file which comes as standard inside of the Nextcloud install.

Performing upgrade tasks such as this via SSH can be a very useful especially if you wish to automate future updates / upgrades using a cron job. Simply add the steps into a bash file and add the script to a schedule inside of crontab.

Technical Steps

First locate the occ upgrade file using the following command:

find / -type f -name "occ"

Or if you have mlocate installed you can rung the following commands to locate the occ file:

updatedb
locate occ

Usually the occ file will be stored inside of the HTML root directory on the server e.g "/var/www/html" but this may vary install to install.

Once you have found the location where your occ file is cd to the directory:

cd /var/www/html/

Now list the files with the following in order to obtain file owner name, usually this will be either apache, www-data or something similar.

ls -lah

In my case the files and directories are owned by the user www-data in which case I can run the following to upgrade my Nextcloud instance via the CLI:

sudo -u www-data php occ upgrade
ICTU LTD is a company registered England and Wales (Company No. 09344913) 15 Queen Square, Leeds, West Yorkshire, England, LS2 8AJ
Copyright © 2024 ICTU LTD, All Rights Reserved.
exit