--- date: 2019-11-23T20:45:23+01:00 description: "Howto upgrade manually Nextcloud under OpenBSD server" draft: false tags: ["Nextcloud", "OpenBSD", "upgrade", "tip"] title: "(tip) Nextcloud: Manual upgrade on OpenBSD" translationKey: "openbsd-nextcloud-upgrade" --- ## Description Upgrade {{< abbr NC Nextcloud >}} *(Nextcloud )* is very easy… Either you do it: * With the web updater. * Manually, as me. * Via the packages management. {{< abbr FYI "For Your Information" >}}: 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 "web-nextcloud-stop-web-service" sh >}} ### Preparations Presume user web is `www`. Need to log as: `$ su -l www` 1. Go to the nextcloud folder: `cd www/nextcloud` 2. {{< inside2 t="Need to modify" l="web:nextcloud:nextcloud-php-chroot" >}} the config file: `sed -i -e 's#/htdocs#/var/www/htdocs#' config/config.php` 3. And enable the maintenance mode: `php-7.3 occ maintenance:mode --on` #### Download 1. Go to the parent folder `www\` : 2. Create an usefull version variable named `v`. 3. Download the actual archive and her checksum sha256 file. 4. Check the checksum {{< code "web-nextcloud-upgrade-dl-archive" sh >}} 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 "web-nextcloud-upgrade-install-archive" sh >}} #### 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 "web-nextcloud-upgrade-rights-user" sh >}} ### 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` 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 "web-nextcloud-restart-web-service" sh >}} - 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 "web-nextcloud-upgrade-tldr" sh >}} ### Caveats If the upgrade process fails with one of thoses errors messages: #### Error: Nextcloud is not installed Example: {{< code "web-nextcloud-upgrade-error-not-installed" sh >}} * 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: {{< blockquote "web-nextcloud-upgrade-error-reinstall-en" >}} * 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": {{< inside2 t="occ" l="web:nextcloud:occ" >}}. ----