Install Nextcloud 21 on NFS Share

Hello community,

after tinkering around with settings for almost a week I am out of ideas and so seems google. I want to install NC21 on a VM with an NFS share mounted to the path /mnt/www. I tried the following share setups on my file server:
rw,sync,fsid=0,crossmnt,no_subtree_check,no_root_squash
rw,sync,anonuid=33,anongid=33,no_subtree_check

Then I mounted this share on the webserver under /mnt/www. There is a folder on the base of that share that will contain any websites called html. I changed the apache config file 000-default.conf to:
ServerAdmin webmaster@localhost

    DocumentRoot /mnt/www/html
    <Directory /mnt/www/html/>
            Options -Indexes
            Require all granted
            AllowOverride All
            Options FollowSymLinks MultiViews
            <IfModule mod_dav.c>
                    Dav off
            </IfModule>
    </Directory>

With that change I was able to see the my default website now on the NFS share. After that I downloaded the web installer and executed it. All dependencies were found and I started the process of installing NC21. The package (nc.zip) was downloaded and properly unzipped. I clicked next to move to the config screen. That is the first time I ran into the issue that NC told me there was an error and I should check the logs. At that point there are no logs, it is a fresh install. Nothing is defined in the config.php. So I went into the NC folder and executed
sudo -u www-data php8.0 occ check
That was the first time I got an error that the file config.php could not be locked and that is where I am stuck now. I was able to install NC on a smb share but that is too slow. I want that speed that NFS is offering. Is anyone out there that can help?
I am sure it is a config thing but I could not find if it was a config thing on the NFS server or the apache2 server.

Thanks so much for your help.

realshadow

I think you over complicate things…

Manual installation of Nextcloud consists of two parts: first - the command line, second - web-based. There are quite a few how-tos on the web depending on requirements
You don’t have to worry about the data partition (that you want to be on an NFS share) during the first part…

It’s before you start the second you need to decide where your data will be located and mounted.
This is when you create a new VMDK (virtual drive) and mount it where you want it…

After this is done, start the web-based part and specify where the data partition is located…

The NFS (Versions 2 and 3) protocol does not support file locking. Are you sure you are connection with version 4? You may also have to change some config params to enable it. Since you are not supplying info on OS and version, it’s a little hard to diagnose further.

@vikinggeek you are correct. The mounting happens with NFS v3 NOT 4 which is why your comment explains perfectly why it is not working. I am using Debian 10 so now I at least have an indication where I can start looking and trying to figure out if I can install NC completely on a NFS share.

@anon71540698 well, I do know how to install NC which I did but it is not installed like I want it. If a VM goes down all its’ content will go down with it. That includes a NC install. Having everything stored outside, including the filesystem of NC allows me to be much faster in restoring everything. That is why I wanted to have a NFS share as my installation drive. I already use a “virtual drive” or a NFS mount for the data directory.

Thanks to both of you for your answers. They help me to plot a path forward. Really appreciate it.

realshadow

I don’t know if you figured this out, but I’m using a nfs share for the nc data folder too.

/etc/fstab contains the following line. IP of nas
10.10.1.7:/mnt/pool1/ncdata /mnt/ncdata nfs4 defaults 0 0

nfs share on truenas looks like this

And nfs service screen

total 13
drwxr-x--- 9 www-data www-data   21 Mar 17 19:30 ncdata
1 Like

@das1996 thanks for your reply. I managed to get the data on my NFS share as well. That works fine. What I am still struggling with is getting the whole nextcloud installation on there. That never worked for me due to working with NFS3 instead of 4. I haven’t had a chance to test that with an NFS4 share yet. But your screenshot help to get something going.

Thanks.

realshadow

@realshadow My starting point was the Hansson nextcloud vm. In its original state it uses 2 drives, one for the os/nextcloud service files and another for the actual user data. I kept the first as is but replaced the second with an nfs share.

I make periodic backup images (proxmox) of the nc vm which are generally pretty small - ~3.4GB in size.

There’s also a nice backup script - BernieO/ncupgrade: Bash script to perform backups and manual upgrades of a local Nextcloud installation based on the Nextcloud documentation<br> - ncupgrade - Codeberg.org - which will generate tarballs for the nc config data only. Use the “-ed” parameter if your nc data folder is not local (as is in my case).

@das1996 Thanks. my userdata is already backed up nightly (is pretty easy when it lies on an NFS share with a script) but I will have to start doing the same for the VM (Proxmox as well). Shouldn’t be too bad. the upgrade script looks interesting. I will give that a try.

Thanks.