ASCII smiley face (site logo) Wild Tech "Garden"
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode

Resetting Nextcloud

Jump to Table of Contents

Preface

Once you have experimented with Nextcloud and gotten the system tweaked as you wish, you may realize that you really wish you could start the Nextcloud instance from scratch, but without the hassle of a reinstalling. That’s what this article is about.

WARNING: All existing data is erased during this procedure!

Caveat

Configuration done inside Nextcloud (like app installations) is destroyed by this procedure.

Backup Everything

Since this is a destructive procure, make sure you can recover if you change your mind, or make a mistake and lose configuration you actually want.

Details depend on how you have decided to do backups, so are not detailed here.

Disconnect All Your Clients

  • On any connected clients for which you are using the ‘Nextcloud’ app, remove the server.
  • For any ‘calendar’ or ‘contacts’ (and so on) clients, remove the server you are resetting.

Shutdown the Server

On the Nextcloud server:

sudo systemctl stop nginx

sudo systemctl stop php7.4-fpm (or 7.3 on debian/raspbian buster)

Remove Your Nextcloud Data

Remove Data in The Filesystem

sudo su -
rm -rf /srv/nextcloud-data/* /srv/nextcloud-data/.htaccess /srv/nextcloud-data/ .ocdata
exit

(assuming you have chosen /srv/nextcloud-data as your data directory)

Alternatively you could unmount /srv/nextcloud-data and recreate the filesystem.

Drop the Nextcloud Database and Recreate

sudo su - postgres
dropdb nextclouddb

For C.UTF-8 below substitute the appropriate UTF-8 locale:

createdb -O nextclouddb --encoding UTF8 --locale C.UTF-8 --template template1 nextclouddb
exit

Remove Your Previous Nextcloud Instance Config

sudoedit /var/www/nextcloud/config/config.php

Remove instanceid, passwordsalt, secret, dbtableprefix and installed config keys.

sudo touch /var/www/nextcloud/CAN_INSTALL

Start Your Servers

systemctl start php7.4-fpm (or 7.3 for debian buster)
systemctl start nginx

Use the Installation Wizard (First Login)

Or the command line tool (occ). For more details see Installation wizard or Installing from the command line.

Login

Once you have a successful configuration I recommend a test login. In addition, it would be a good idea to enable “Server-side Encryption” in “Settings” (but only if you do not have full disk encryption enabled, otherwise the system will get too slow).

Table of Contents