How to install Nextcloud on a separate (Veracrypt) HDD

Hi all,

Im coming from a Windows environment feat. Seafile setup and my target is to setup nextcloud on ubuntu. Im following the official deployment guide and have read several how-tos online.
However, none of them highlights how to install nextcloud or its database on a separate drive.

I have setup a RAID array with Verycrypt container which is mounted to /media/veracrypt1.
I would like to have at least the database (best case the whole nextcloud installation) on that drive. Im aware that the LAMP stack most probably needs to be on the main drive, but it should be able to have the nextcloud installation somewhere else.

Surprisingly there seems to be no information out there on how to do it?!
Any hints? Since, Im really new to Linux I would appreciate step by step instructions or to point out the most relevant dependencies or whatsoever.
Thanks!

I am not an expert too, but i did the following:
since my / is on an cf-Card (ro) i made a symlink to my SSD (/var/www - /mnt/usbdisk/rootfs/var/www). Also made this for the mysql libdir and several others. Is working wihout issues here…

Using an thinclient (HP-T5730) with

  • 8 GB CF-Card (System) ReadOnly (Flashybrid)
  • 40 GB SSD (Data)
  • 2TB SATA (Backup)
  • Nextcloud 11.0.1
  • Debian 8.7

Hey thanks for the swift answer!
Could you elaborate in more detail on which commands you used to make the settings for mysql /libdir?
How do I set up this symlink? Since I have my designated disk under/media/verycrypt1 would that mean I need to point to /media/verycrypt1/Nextcloud/var/www?

Even though the Apacha runs under my standard drive?

After installation, when you point your browser for the 1st time to your Nextcloud installation, do you not have the option to alter the path to the data directory?
Default is something like

/var/www/html/nexcloud/data/

and I changed it to

/media/pi/HD1TB/nexcloud/data/

I have problems with Nextcloud stating it is not allowed to write or create on my drive. I will try the symbolic link tonight and see if that helps.

Very simple: I used mc (Midnight Commander) in an ssh shell.
First stopped apache and mysql

  • Made a seperate dir on my target ssd (/mnt/usbdrive/rootfs) [mkdir]
  • Move the chosen dir to target with analoge strukture. (/var/lib/mysql -> /mnt/usbdrive/rootfs/var/lib/mysql) [mv]
  • make symbolic link (via menu) [ln -s]

Do this wiith all dirs you want to move to external disk. Then start apache and nextcloud and chech that everything works
is working here since i have owncloud without issues.

my mapped dirs: /var/lib/mysql and /var/www

if you only want to link nextcloud in www it will look like (/var/www/nextcloud -> /mnt/usbdrive/rootfs/var/www/nextcloud)

Be sure to keep the rights that were set original (www-data:ww-data). By moving via mc they are kept.