Re-install Nextcloud from scratch

Hi all,
I have messed with my Nextcloud installation a while ago and it seems that I broke my webinterface somehow. It isn’t responding properly, e.g. when switching folders.
Desktop and mobile apps work fine so I let it slide for a while.
As I’m still on v18 I’d like to use the upgrade to start from scratch, however, keep all my data of course.

Is there a best-practice guide on how to exchange the underlying Nextcloud server installation but keep all the data (and, if possible, even all the config data)?

did you check the official guide?

That doesn’t exactly help me as this guide pretty much explains how to take what I have and copy it somewhere else.
However, I don’t want to copy everything but just my basic files (and optionally, if possible, my config data).
I want to remove and replace the Nextcloud application, let’s say.


If you just want to keep the files, you can backup and reupload them, not a big deal. All the files are stored in yor data folder. Just copy them to some external drive or whatever storage media you prefer or have available. But if you want to keep your settings, calendars, contacts and other things, the article linked by @wwe tells you exactly what you have to backup in order to migrate it over to a fresh installation.

How exatley did you install it the first time?

And in addition to my previous post: A complete backup or at least a file backup is definitely necessary. Always! No matter if you only update / reinstall Nextcloud itself or if you rebuild the whole system or some components of it. Even if you don’t plan to do anything to the system, you should have a backup. Something can always go wrong.

1 Like

Alright, I guess there is no easier way than this. I mostly have files, nothing fancy, pretty much no apps.
I’ll make a backup of everything, clean all my nextlcoud DBs and folders and start from scratch.
Afterwards I’ll move back my files.

Question for this: Will it be okay to simply move the folder structure of user x (e.g. nextcloud/data/chris/files) on the server from backup to productive location or should I properly sync it over a client?

If you just want to migrate the files, it is relatively easy. You can install a new Nextcloud instance from scratch with a new database. Then you have to create all the user accounts again, copy the files back into the respective user folders and rescan them with the following command…

sudo -u www-data php /path/to/datafolder/occ files:scan --all

If you want to migrate the user accounts, calendars, contacts etc. as well, it gets more complicated. Because then you have to backup the relevant database tables too and migrate those over to the new database.

1 Like