Some time ago this solution was given. Nowadays it is obsolete as NethServer has an integrated release lock mechanism (via How to lock to a specific distribution release), so I don’t know if that would still work.
I’ve partially tried updating specific packages (nethserver-{base,subscription,release,nethforge-release} centos-release
) and editing some db props, forced Version prop and yum vars, but manual repo edits were required to make it work and I desisted.
A related approach would be to manually edit urls of repositories and using CentOS Vault.
If it’s just for Nextcloud, there shall be an easier and more direct approach (once we find out, I’ll pull my hairs out for overthinking this ), but at the moment I came up with a generic workaround (not nextcloud specific, and based on same concept as nsreleaselock) which shall work for CentOS and/or NethServer version updates just by tweaking the custom repo file in use. For same problem but on more up to date servers or to “rollback” unsupported nextcloud upgrade paths, the wiki has some notes.
Excuses, in advance, for the long post… not to be afraid of the wall of text, at the end it’s easier than it seems.
Background
In this example we will focus on *nextcloud updates. Officially, Nextcloud does not support updates between multiple major version so if, like in this case, we have a server that has not been updated for a long while, and Nextcloud is managed through rpm packages, we might end up in a situation where we are only offered the latest *nextcloud version while previous major versions and its requirements are no longer available in our configured repos.
We could manually download all the required packages for each major version of nextcloud, but that would be cumbersome. Another approach is to manually edit the repos or create a custom repo file pointing to older CentOS/NethServer repositories, if available.
Note: FTR, there could be other nextcloud tricks to accomplish unsupported upgrade paths, like manually editing nextcloud version number in some files. Untested.
Example
Initial state:
- NethServer/Centos 7.3.1611
- Nextcloud 10.0.2
- Nextcloud located at
/var/www/html/nextcloud/
# rpm -qa *nextcloud {nethserver,centos}-release # *php* versions omitted
nextcloud-10.0.2-1.ns7.noarch
nethserver-release-7-0.6.ns7.noarch
nethserver-nextcloud-1.0.4-1.ns7.noarch
centos-release-7-3.1611.el7.centos.x86_64
Create a custom repository file (remember to inspect contents of downloaded file):
curl https://gist.githubusercontent.com/dnutan/1d21e6f7e3bd8bc516a73b718a96de11/raw/52c7ebc0a937f37909c4a2a414c7490cf217cc66/Custom.repo -o /etc/yum.repos.d/Custom.repo
Set a custom yum var (used in the custom repo file to specify the desired minor version release of the distribution):
echo '7.3.1611' > /etc/yum/vars/customrelease
Clean yum repository data:
yum --enablerepo=\* clean all
optional step - Visually verify whether the repositories are correct (–nogpgcheck is used because some old nethserver repos were not gpg signed):
yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
repolist -v
Find out which *nextcloud
packages are provided in the custom repos. We can relate nextcloud package version to nethserver-nextcloud package by looking at the changelog:
yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
--showduplicates \
list nethserver-nextcloud nextcloud
Update packages specifying the desired version (e.g. update to nextcloud 11.x). After each update we can also verify nextcloud is working and check logs for errors:
yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.1.3-1.ns7 nextcloud-11.0.3-2.ns7
Example updating from Nextcloud 11.x to Nextcloud 12.x:
yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.1.7-1.ns7 nextcloud-12.0.2-2.el7
Changing yum repositories to another CentOS/NethServer distribution release:
echo '7.5.1804' > /etc/yum/vars/customrelease
yum --enablerepo=\* clean all
# optionally, repeat other previous steps to verify repos urls and available packages
Update from Nextcloud 12.x to Nextcloud 13.x:
yum --nogpgcheck \
--disablerepo=\* \
--enablerepo=custom-C7-{base,updates,extras},\
custom-nethserver-{base,updates},\
epel,custom-centos-sclo-{sclo,rh} \
update nethserver-nextcloud-1.2.4-1.ns7 nextcloud-13.0.6-1.el7
Removing custom yum var, custom repos and cleaning yum repo data. Next updates shall come from the latest available original repositories:
rm /etc/yum/vars/customrelease
rm /etc/yum.repos.d/Custom.repo
yum --enablerepo=\* clean all
Update from Nextcloud 13.x to Nextcloud 14.x (lock for available packages, as before, if needed):
yum update nethserver-nextcloud-1.3.0-1.ns7 nextcloud-14.0.4-1.el7
Update all system packages as usual (at the time of writing, the following will update nextcloud to 15.x):
yum update
End result:
- NethServer/Centos 7.6.1810
- Nextcloud 15
- Nextcloud located at
/usr/share/nextcloud/
# rpm -qa *nextcloud {nethserver,centos}-release # *php* versions omitted
nethserver-release-7-12.ns7.noarch
centos-release-7-6.1810.2.el7.centos.x86_64
nextcloud-15.0.0-1.el7.noarch
nethserver-nextcloud-1.4.0-1.ns7.noarch
Don’t forget to check and update disabled nextcloud apps.
Of course, if for some reason there were missing dependencies we should investigate and find our way through.