Migrating from ownCloud to Nextcloud

Hey everyone,

The support was a little vague on the Nextcloud site.

Here are some more specific directions:

:smile:

  1. First you want to make a copy/backup of your Owncloud folder.

sudo cp -r /var/www/owncloud /var/www/owncloud.old

  1. Then remove everything inside your owncloud folder.

sudo rm -rf /var/www/owncloud/*
sudo rm -rf /var/www/owncloud/.*

  1. The reason we made a backup of the Owncloud folder was to make sure we still
    have the config and data, so cp that in to the owncloud folder again

sudo cp -r /var/www/owncloud.old/config /var/www/owncloud/
sudo cp -r /var/www/owncloud.old/data /var/www/owncloud/
sudo cp /var/www/owncloud.old/.htaccess /var/www/owncloud/
sudo cp /var/www/owncloud.old/.user.ini /var/www/owncloud/

  1. Install Nextcloud

We are going to download nextcloud, make sure you get the latest release

cd /temp
wget https://download.nextcloud.com/server/releases/nextcloud-9.0.50.tar.bz2

  1. Extract the tar ball and move it to Apacheā€™s web root.

tar -vxjf nextcloud-9.0.50.tar.bz2
cd nextcloud
mv * /var/www/owncloud/

  1. Change the permissions while in the owncloud directory(it now has newcloud files inside of it):

wwwrun:www * -R or chown www-data

  1. The last thing we will need to do is the upgrade to Nextcloud.

cd /var/www/owncloud
sudo -u www-data php occ upgrade

And that should be it! open up your browser and enter your IP/FQDN to confirm it works!

I did copy most of this information from:
https://techknight.eu/2016/06/15/migrate-owncloud-nextcloud-linux/

and

They were good posts, but missing some commands. Hopefully this helps!

Cheers,

Mack

Can I as which commands are missing in the post from techknight ? (author here)
I have done it that way without any issue :wink:

1 Like

Yes, unless I am mistaken, you have to change the permissions for the nextcloud files after
they are copied to the owncloud folder. Anyways, your work was the best I found, it helped my migration immensly. Thank you so much.

:slight_smile:

Thanks for the reply and you are one hundred procent right :smiley:
the article have been edited by now

1 Like

I got error from migrating, says ā€œDirectory is unavailableā€¦ā€.
Is it because that Iā€™m migrating from ownCloud 9.1.x to Nextcloud 9.0.53?
Iā€™m running nextcloud on CentOS 7.

2 Likes

Ok, so I did try migrate from ownCloud 8.2.7 -> Nextcloud 9.0.53

I still got the same issue which is directory is not showing.

I get many errors similar to this: fopen(/var/www/html/nextcloud/data/admin/thumbnails/27/150-150.png): failed to open stream: No such file or directory at /var/www/html/nextcloud/lib/private/files/storage/local.php#261

Both files 150-150.png, and local.php exist in those directory.
How do I fix this?

Is this also possible with updating to Nextcloud 10 (from owncloud 9)? And is there this mentioned automatic process available?

The updater app is not ready yet. I would go OC 9.0->NC 9.0.53 ā†’ NC 10. OC 9.0->NC 10 could be possible, if not, it should show you an error that you cannot skip major versions.

Am I good to use this method to upgrade from OC 9.1.0-1.1 to NC 10?

1 Like

Can we also have some function to mirror an account on an owncloud system? I have a hosted owncloud and I donā€™t have access to the raw data, just the user credentials. It seems like a big job to get that data into nextcloud and I even have over 20 accounts.

No you canā€™t just mirror or migrate an account. On the new system, you can use the federated cloud sharing to include the owncloud folder into your nextcloud account. The files stay in the owncloud account, but you can then copy the files to your local Nextcloud folder (either via webinterface or via webdav).

Thank you for the detailed upgrade instructions. Unfortunately I managed to destroy my server by running the set-nextcloud-permissions.sh script.

I set the ocpath and ocdata variables matching my system, but somehow the ā€œfindā€ commands still changed the permissions of all files and directories in my system. When the script was done running I had an unusable system and I could not log back into the server. Sad. Iā€™m now restoring the backup from 4 days ago.

The script at this page?
https://docs.nextcloud.com/server/9/admin_manual/installation/installation_wizard.html

The script that was shared above by mvance, which is based on the one you linked. I donā€™t know how it happened, as the script looks ok. Unfortunately since I lost access to the server I canā€™t see the content of the script. But the symptoms were those: I did not have permission to ā€˜lsā€™, nor to stop or start apache, and when I tried logging out and in again, my access was refused. I log in as non-root with my public key.

Anyway, I just lost an hour and maybe a few e-mails, no much harm caused.

The script from @mvance works but it is dangerous. One typo at the variables ā€¦ and the system is broken.
The script at the doc.nextcloud.com is wrong regarding the missing ā€œ/ā€ behind the variable

find ${ncpath}/ -type f -print0 | xargs -0 chmod 0640

I migrated today from ownCloud 9.1.1 to Nextcloud 10.0.1 using the manual upgrade via terminal without any issue. :white_check_mark:
Many thanks for your great work!

2 Likes

An even better script can be found here: https://github.com/enoch85/ownCloud-VM/blob/master/static/move-to-nextcloud.sh

Be careful with this script, it is for very specific systems and might need some modifications:

  • You can only install Nextcloud with this script, when a direct upgrade to the current NC version is possible (currently OC 9.0 or newer)
  • Only for debian systems or derivates (webserver-user www-data)
  • why do you backup all databases thatā€™s perhaps something you donā€™t want to
  • some parts about the vhosts are very specific to vm-image (idea: you want perhaps a redirect from example.org/owncloud to example.org/nextcloud)
  • it installs php7??? Itā€™s unrelated to Nextcloud migration.

So it is probably a good solution for your previous owncloud-vmā€™s to migrate them to Nextcloud. But for all others it needs some modifications.

1 Like

@tflidd
You are right, it doesnā€™t cover all scenarios and yes, it is very specific for our (Tech and Me) previous ownCloud users.

Thanks for the clarification.

If you on the other hand want personal help with migrating (connecting to your server and do it for you) we have a product in our shop: https://shop.techandme.se/index.php/product/migrate-from-owncloud-to-nextcloud/