TrueNAS Core Nextcloud 23.0.2 Plugin update -> 27.0.2

A nextcloud plugin in a TrueNAS Core system that hadn’t been updated is well, a problem. If you update the Plugin it will go straight to Nextcloud 27 which well you can’t do an update like that. So here’s what we did.

Update to the latest version of 23 in the web browser and proceed with this until you get to version 25. You will notice that you cannot get past here if you’re on a Jail running 12.2 because it has PHP74 installed by default with the original Nextcloud package.

After this point you have to install PHP 8. But doing so will try and remove nextcloud-php74 package which would remove Nextcloud of course and kinda make the whole thing pointless so, we need to force that to remain installed while we gut PHP and reinstall PHP 8.

Lock the nextcloud package, we don’t want to remove it.

pkg lock nextcloud-php74

Install PHP80

pkg install php80-bcmath php80-bz2 php80-ctype php80-curl php80-dom php80-exif php80-fileinfo php80-filter php80-gd php80-gmp php80-iconv php80-intl php80-ldap php80-mbstring php80-opcache php80-pcntl php80-pcntl php80-pdo_mysql php80-pecl-APCu php80-pecl-imagick php80-pecl-redis php80-posix php80-session php80-simplexml php80-xmlreader php80-xmlwriter php80-xsl php80-zip php80-zlib

Restart FPM to reload the web UI:
/usr/local/etc/rc.d/php-fpm restart

Perform the update through to v27 from the Web UI.

Update the plugin in TrueNAS Core once the web UI update completes. THIS WILL FAIL.

Once it fails, log back into the console and manually uninstall/install the following:

pkg unlock nextcloud-php74
pkg remove nextcloud-php74-23.0.2
pkg install nextcloud-php80 nginx mysql80-server redis php80-pecl-redis wget rsync

Now, the included nextcloud version is 27.0.0 and we’re already above that and downgrading is not supported so, we need to pull the archive from nextcloud and copy over our install;

mkdir /root/scratch
cd /root/scratch
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
tar -xjvf latest.tar.bz2
rsync -avz /root/scratch/nextcloud/ /usr/local/www/nextcloud/

Now we need to fix some permission:

cd /usr/loca/www
chown www:www nextcloud
cd nextcloud
chown -R www:www .htaccess .user.ini 3rdparty/ apps AUTHORS config/ console.php COPYING core/ cron.php dist/ index.html index.php lib/ occ ocm-provider/ ocs* public.php remote.php resources/ robots.txt status.php themes/ updater/ version.php

Now start redis and mysql and, restart fpm;

/usr/local/etc/rc.d/redis start
/usr/local/etc/rc.d/mysql-server start
/usr/local/etc/rc.d/php-fpm restart

All done, easy right? LOL.