Description
Upgrade NC (Nextcloud ) is very easy… Either you do it:
- With the web updater.
- Manually, as me.
- Via the packages management.
FYI : This article explains the manual process under OpenBSD, with nginx, PHP 7.3.
Upgrading Process
This process used few years ago, since v 15.*, as KISS.
Stop Web Service
The first action disables domain:
Code: sh
# rm -f /etc/nginx/sites-enabled/mon-domaine.net
# nginx -t && rcctl restart nginx
Preparations
Presume user web is www
.
Need to log as: $ su -l www
- Go to the nextcloud folder:
cd www/nextcloud
- Need to modify
the config file:
sed -i -e 's#/htdocs#/var/www/htdocs#' config/config.php
- And enable the maintenance mode:
php-7.3 occ maintenance:mode --on
Download
- Go to the parent folder
www\
: - Create an usefull version variable named
v
. - Download the actual archive and her checksum sha256 file.
- Check the checksum
Code: sh
$ cd ../
$ v="17.0.1"
$ for ext in bz2 bz2.sha256; do curl -O https://download.nextcloud.com/server/releases/nextcloud-$v.tar.$ext; done
$ sha256 -c nextcloud-$v.tar.bz2.sha256
If the result of SHA is (SHA256) nextcloud-$v.tar.bz2: OK
, it’s good; if not, re-download-it!
Installation
- moving actuel folder
nextcloud
with date and old number version. - untar the archive.
- delete file
CAN_INSTALL
; (we’re not looking to reinstall)!
Code: sh
$ oldvers="16.0.6"
$ date="$(date '+%Y%m%d%H%M%S')"
$ oldnc="nextcloud-${date}-${oldvers}"
$ mv nextcloud ${oldnc}
$ tar xjvf nextcloud-$v.tar.bz2
$ rm -fP config/CAN_INSTALL
First Checks
Here, you must be careful:
- copy old config file to new folder config:
cp ${oldnc}/config/config.php nextcloud/config/
- Now, diff the oldier app folder with new folder to copy all not natives apps.
- Egual, with themes, if necessary.
Permissions
- Put the rights users on all files and folders into the folder
nextcloud/
- And, others rights systems.
Code: sh
$ webuser="www"
$ chown -R "${webuser}":www nextcloud
$ find nextcloud/ -type d -exec chmod 750 {} \;
$ find nextcloud/ -type f -exec chmod 640 {} \;
Upgrade NC himself
- Just go to the right folder:
cd nextcloud/
- Use the tool
occ
, as:php-7.3 occ upgrade
- if success, go out the maintenance mode:
php-7.3 occ maintenance:mode --off
- if success, go out the maintenance mode:
And, at the final, re-sed the config file to delete /var/www
: sed -i -e 's#/var/www/htdocs#/htdocs#' config/config.php
Restart Web Service
- Enable domain and restart web server, as:
Code: sh
# cd /etc/nginx/sites-available/
# ln -s mon-domaine.net ../sites-enabled/
# nginx -t && rcctl restart nginx
- Now, connect you at the WebAdmin as admin user, et apply all updates for the apps.
And, voilà!
TL;DR
BE CAREFULL: If you copy this TL;DR as-is, you will crash your instal!
Code: sh
// stop web services
# rm -f /etc/nginx/sites-enabled/mon-domaine.net
# nginx -t && rcctl restart nginx
// connexion as user web
# webuser="www"
# su -l $webuser
$ cd /var/www/htdocs/mon-domaine.net/www/nextcloud/
$ sed -i -e 's#/htdocs#/var/www/htdocs#' config/config.php
$ php-7.3 occ maintenance:mode --on
// downlad archives, and checksum
$ cd ../
$ v="17.0.1"
$ for ext in bz2 bz2.sha256; do curl -O https://download.nextcloud.com/server/releases/nextcloud-$v.tar.$ext; done
$ sha256 -c nextcloud-$v.tar.bz2.sha256
// Untar
$ oldvers="16.0.6"
$ date="$(date '+%Y%m%d%H%M%S')"
$ oldnc="nextcloud-${date}-${oldvers}"
$ mv nextcloud ${oldnc}
$ tar xjvf nextcloud-$v.tar.bz2
$ rm -fP config/CAN_INSTALL
// cp config
$ cp ${oldnc}/config/config.php nextcloud/config/
// cp only apps not native; dont recopy this command as-is:
$ cp all ${oldnc}/apps diff to new nextcloud/apps
// egual for themes, if need
$ cp all ${oldnc}/themes to new nextcloud/themes
$ chown -R "${webuser}":www nextcloud
$ find nextcloud/ -type d -exec chmod 750 {} \;
$ find nextcloud/ -type f -exec chmod 640 {} \;
// occ upgrage process
$ cd nextcloud/
$ php-7.3 occ upgrade
$ php-7.3 occ maintenance:mode --off
$ sed -i -e 's#/var/www/htdocs#/htdocs#' config/config.php
// exit
// restart web services
# cd /etc/nginx/sites-available/
# ln -s mon-domaine.net ../sites-enabled/
# nginx -t && rcctl restart nginx
Caveats
If the upgrade process fails with one of thoses errors messages:
Error: Nextcloud is not installed
Example:
Code: sh
$ php-7.3 occ help upgrade
Nextcloud is not installed - only a limited number of commands are available
Command "upgrade" is not defined.
help [--format FORMAT] [--raw] [--] [<command_name>]
- Have you really copy the oldier config file to the new folder config?
- Try this tip:
php-7.3 occ maintenance:repair
Error: you are trying to reinstall your Nextcloud
When you connect to the WebUI, you had this message:
Quotes:
Error
It looks like you are trying to reinstall your Nextcloud. However the file CAN_INSTALL is missing from your config directory. Please create the file CAN_INSTALL in your config folder to continue.
- Go to delete the file
CAN_INSTALL
under the new folder config.
the files are not visibles
- Try:
php-7.3 console.php files:scan --all
OCC Commands
As a reminder,, this usefull command occ: php occ list
And see this “manpage”: occ .