Install Nextcloud with a different data location?

I would like to install a fresh copy of Nextcloud on my server which is running Ubuntu 20.04, but I want to point the data location to a different HDD (instead of /var/www/nextcloud)

I have found lots of guides on how to move the data location ‘after’ installation and all seem to be hit and miss.

But I can’t find any guides showing how to point to a different data location during the installation process ?

The OS is running on a 1TB SSD and I want the data location to be on a different 4TB HDD (which is pointed to in the /media folder).

How can I change the location of the data during installation and are there any security issues I need to consider ?

Hi @freeflyer, you just have to create a mounting point or folder on your disk, give it the right permission for apache or nginx user ( www-data) and when you configure your server using the web page for create admin user and add database info. Just change the location of datadirectory with the path of your folder/mounting point.
It is recommended only www-data and root user have access to this directory.

sudo chown -R www-data:www-data /...
sudo chmod -R 750 /...

1 Like