Migration OC 10.0.7 to NC 12.0.6 - success - Synology DSM

Sins there is so many who have issues with migration I though I would post this as I had success in manually migrating from OC 10.0.7 to NC 12.0.6. I’m by no means an expert, so this might not help everyone.

Though I’m new to nextcloud server, I have been running OC server with NC mobile App for some years. My reason for migration is due to NC app not working with OC server anymore, and the NC app is just way ahead of the OC one in functionality.

My Setup:

  • Synology NAS with DSM 6.1.6-15266.
  • PHP 5.6.34 & MariaDB 5.5.57
  • Initially installed OC v8 from Package Center but kept it updated manually form CLI to latest version.
  • My OC installation didn’t have any additional addons or apps installed
  • My data directory is on a different drive than web

First thing is to figure out what version to migrate to. The NC migration page is helpfull, but not exact. https://nextcloud.com/migration/
Testing the automatic migration tool shows me it will update to NC 12.0.4. But I knew that was not the latest bug fix release, so I cancelled the automation and went for the manual migration.

This manual one told me I could migrate from OC 10.0.x to NC 12.0.x, and always go to the latest bugfix release of NC. https://nextcloud.com/changelog/#latest12 shows me 12.0.6 is the latest and also have a fix for migration from OC 10.0.6 and OC 10.0.7. I should be good to go :slight_smile:

The manual migration is basically just a standard upgrade, just mind you need to go to the specific NC version according to your current OC version.
For upgrading I’ve basically followed this helpful howto from an older OC version.

My steps to success:
SSH in to your server
Maintenance mode on
sudo -su root
cd /volume3/web/owncloud
sudo -u http php56 occ maintenance:mode --on
Change file permissions
chown -R http:http /volume3/web/owncloud/
find /volume3/web/owncloud/ -type f -print0 | xargs -0 chmod 0777
find /volume3/web/owncloud/ -type d -print0 | xargs -0 chmod 0777
datafiles, web and database backup (In case migration fails)
rsync -ax /volume2/owncloud/ /volume2/bckup/data_owncloud-dirbkp_date +"%Y%m%d"/
rsync -ax /volume3/web/owncloud/ /volume2/bckup/web_owncloud-dirbkp_10_0_7_date +"%Y%m%d"/
mysqldump --lock-tables -h localhost -u[DBuser] -p[dbpassword] [databasename] > /volume2/bckup/owncloud-sqlbkp_10_0_7_date +"%Y%m%d".bak
Move owncloud web folder
mv /volume3/web/owncloud/ /volume3/web/owncloud_10_0_7/
Download new nextcloud
wget --no-check-certificate https://download.nextcloud.com/server/releases/nextcloud-12.0.6.tar.bz2 -O /tmp/nextcloud-12.0.6.tar.bz2
cd /tmp
tar jxf nextcloud-12.0.6.tar.bz2
Move new nextcloud to web folder
mv /tmp/nextcloud /volume3/web/
Change file permissions
chown -R http:http /volume3/web/nextcloud/
find /volume3/web/nextcloud/ -type f -print0 | xargs -0 chmod 0777
find /volume3/web/nextcloud/ -type d -print0 | xargs -0 chmod 0777
Copy config.php from old owncloud
rm /volume3/web/nextcloud/config/config.php
cp -av /volume3/web/owncloud_10_0_7/config/config.php /volume3/web/nextcloud/config/config.php
Start the upgrade process
cd /volume3/web/nextcloud
sudo -u http php56 occ upgrade
Add security to .htacces
Add following lines at end of file.
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
Maintenance mode off
sudo -u http php56 occ maintenance:mode --off
After successful testing change permissions
chown -R root:http /volume3/web/nextcloud/
chown -R http:http /volume3/web/nextcloud/apps/
chown -R http:http /volume3/web/nextcloud/config/
chown -R http:http /volume3/web/nextcloud/themes/
find /volume3/web/nextcloud/ -type f -print0 | xargs -0 chmod 0640
find /volume3/web/nextcloud/ -type d -print0 | xargs -0 chmod 0750
chown root:http /volume3/web/nextcloud/.htaccess
chmod 0644 /volume3/web/nextcloud/.htaccess
Remove old owncloud web
rm /volume3/web/owncloud_10_0_7/

That’s all :slight_smile:
So now I’ll just follow the same steps to get NC updated to latest version…

1 Like

I directly moved it to the howtos.

:+1: for the backups, really cool! Thanks for sharing this with us.

No problem. I’ll not take any credits for the scripts, but collecting information from many sources can sometimes be overwhelming.

Have now also performed the upgrade from NC 12.0.6 to 13.0.1 without any problems. Using the same procedure, just omitting the datafile backup.

cd /volume3/web/nextcloud
sudo -u http php56 occ maintenance:mode --on

chown -R http:http /volume3/web/nextcloud/
find /volume3/web/nextcloud/ -type f -print0 | xargs -0 chmod 0777
find /volume3/web/nextcloud/ -type d -print0 | xargs -0 chmod 0777

rsync -ax /volume3/web/nextcloud/ /volume2/bckup/web_nextcloud-dirbkp_12_0_6_date +"%Y%m%d"/
mysqldump --lock-tables -h localhost -u[DBuser] -p[DBUserPW] [Database name] > /volume2/bckup/nextcloud-sqlbkp_12_0_6_date +"%Y%m%d".bak

mv /volume3/web/nextcloud/ /volume3/web/nextcloud_12_0_6/
wget --no-check-certificate https://download.nextcloud.com/server/releases/nextcloud-13.0.1.tar.bz2 -O /tmp/nextcloud-13.0.1.tar.bz2

cd /tmp
tar jxf nextcloud-13.0.1.tar.bz2
mv /tmp/nextcloud /volume3/web/
chown -R http:http /volume3/web/nextcloud/
find /volume3/web/nextcloud/ -type f -print0 | xargs -0 chmod 0777
find /volume3/web/nextcloud/ -type d -print0 | xargs -0 chmod 0777
rm /volume3/web/nextcloud/config/config.php
cp -av /volume3/web/nextcloud_12_0_6/config/config.php /volume3/web/nextcloud/config/config.php

cd /volume3/web/nextcloud
sudo -u http php56 occ upgrade

sudo -u http php56 occ maintenance:mode --off

chown -R root:http /volume3/web/nextcloud/
chown -R http:http /volume3/web/nextcloud/apps/
chown -R http:http /volume3/web/nextcloud/config/
chown -R http:http /volume3/web/nextcloud/themes/
find /volume3/web/nextcloud/ -type f -print0 | xargs -0 chmod 0640
find /volume3/web/nextcloud/ -type d -print0 | xargs -0 chmod 0750
chown root:http /volume3/web/nextcloud/.htaccess
chmod 0644 /volume3/web/nextcloud/.htaccess