Installation Advice

Hello,

After reading your long post, looking at your configuration, I have a personal and off topic suggestion.

I personally feel, TrueNAS Scale may be a better base operating system for the job.

But in anyway, in case you wish to stick with Windows 11 as base OS and want to use Nextcloud, here is how I also do with my Home Server (yes, I am too on Windows 11 as base OS).

Using a lot of Hyper-V and staying away from WSL. Especially when you have enough RAM.

Ensure to create a Storage Sense Mirror Drive with 2 of your large HDDs. This is to be used for Nextcloud User data and also DB backups.

You may need to create an external virtual switch under Hyper-V to allow Guest and Host on same subnet (IP Range) as your primary router

You may need a primary VM running Ubuntu 24 LTS with Docker / Docker Compose and NginX Proxy Manager. This is to handle your Reverse proxy / SSL termination. Ensure to put this on that external virtual switch.

You may need a second VM running Ubuntu 24 LTS and Snap Nextcloud with cisf (To access Windows Shared Drives). Ensure to put this on that external virtual switch.

Use your router mac binding to issue static lan ip for both these VMs & your Host Windows 11. Or if you wish, you can setup static lan ip via each Ubuntu VM network settings.

Lets assume your,

Windows 11 Host has Static LAN IP → 192.168.1.50
Ubuntu VM (Nginx) has Static LAN IP → 192168.1.51
Ubuntu VM (Nextcloud) has Static LAN IP → 192.168.1.52
Windows Storage Sense Mirror Drive Letter → M

Step 1 (Share that M Drive)

Under your Host OS, share that M drive and ensure to edit sharing permission to allow just your Windows user with full access.

Double check from any network system that drive is shared as some times, windows need a reboot for share to come into effect

Step 2 (Nextcloud)

Lets proceed with the installation on a clean Ubuntu 24 LTS Server VM.

Update the OS

  1. sudo su
  2. apt update && apt upgrade -y
  3. reboot

Access and Mount the Windows 11 Share

  1. sudo su
  2. apt install cifs-utils -y

We need to create a directory, in where we shall store a text file with Windows 11 user id and password for network access. Lets assume your user name is “hello”.

  1. cd /home/hello
  2. mkdir pw
  3. cd pw
  4. nano Win11

This will bring up the text editor, just write this in same format. Where you inlude your own Windows 11 user name and password.

username=YourOwn
password=YourPW

Save the file (CTRL+X, Y then enter)

Lastly, change the permission of this file.

  1. chmod 600 Win11

Now we need to mount Windows 11 M drive in to Ubuntu VM via Network. This needs to mounted under /mnt or /media. I am mounting under /media

  1. sudo su
  2. cd /media
  3. mkdir M_Drive
  4. nano /etc/fstab

This will open text editor for this configuration file. Just add this line (with your own values off course) at the end.

//192.168.1.50/m /media/M_Drive cifs vers=3.0,credentials=/home/hello/pw/Win11,file_mode=0777,dir_mode=0777 0 0

Save and exit.

Run command → sudo mount -a or just reboot to check if the drive is mounted successfully or not.

Installation of Nextcloud

  1. sudo su
  2. snap install nextcloud
  3. nextcloud.manual-install user password
    (use your own user name and password as per your liking. This is the primary admin user of nextcloud)
  4. snap connect nextcloud:network-observe
  5. snap connect nextcloud:removable-media
  6. nextcloud.occ config:system:set trusted_domains 1 --value=192.168.1.52

By this, your basic nextcloud installation is completed. You can now access the server from any system on this same subnet (LAN) via browser with url http://192.168.1.52

Go ahead and check if its working

Changing Default User Data Storage

By default Snap Nextcloud will save everything at this at this following location, /var/snap/nextcloud/common/nextcloud/data

So we need to change it to your Windows 11 storage sense Raid drive. Which we have mounted at /media/M_drive under this VM.

  1. sudo su
  2. nextcloud.occ maintenance:mode --on
  3. mv /var/snap/nextcloud/common/nextcloud/data /media/M_Drive/

The moving is complete but we need to edit the nextcloud config file to ensure that its pointing to this new location.

  1. sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php

Here, find the entry called data directory and change the default location to /media/M_Drive/data. You also need to add an extra line bellow that entry, 'check_data_directory_permissions' => false, otherwise it complains about that mounting 777 permission.

Save the file and exit. Then bring nextcloud out of maintainace mode with command sudo nextcloud.occ maintenance:mode --off

Now reboot the VM and try to access nextcloud to check if data is now getting saved in that drive or not.

SSL and Reverse Proxy

You may need to install Docker / Docker compose under that first VM. Use the Nginx Reverse Proxy manager Docker or their .yml compose file to install and start Nginx Reverse proxy Manager.

Or you may also use a service like CloudFlare Zero trust tunnel by installing that.

Simply point the reverse proxy entry (Your ccTDL or TLD) to this Nextcloud VM IP and port 80 (http) to make it work.

Nextcloud DB Backup

Your user data is safe at that external location but your DB is still at VM root drive. So according to your need or update schedule, you can run following command to create backup of DB (only DB)

sudo nextcloud.export -b

This will create database backup and store it in this location, /var/snap/nextcloud/common/backups/. Use mv command to move those backups out to your M_Drive.

In case something goes wrong, you can recover your nextcloud from user data and this databse backup located in your mirror drive. You can also take these two and restore this in any other system running snap nextcloud

If needed, you can automate this but I haven’t tried due to lack of my knowledge with linux bash and laziness

Thanks.

2 Likes