Skip to main content
  1. Services/

Self-Hosting Nextcloud AIO on Proxmox with a Synology iSCSI LUN

·1373 words·7 mins
Table of Contents

In this guide, we’ll walk through a powerful and scalable way to self-host Nextcloud All-in-One (AIO). Nextcloud AIO comes with an installer wizard to help us install all necessary parts as Docker container.

We will install it in a Proxmox virtual machine with an iSCSI LUN on my Synology.

We’ll cover everything from the Synology LUN creation to the final Nextcloud setup behind an Nginx reverse proxy.

Part 1: Configuring the Storage Backend
#

The foundation of this setup is reliable, block-level storage. We’ll achieve this by creating an iSCSI LUN on the Synology NAS.

Step 1: Create the Synology iSCSI LUN and Target
#

First, log in to your Synology DSM and open the iSCSI Manager. The iSCSI wizard will guide us through creating the iSCSI target, the LUN and LUN mapping.

  1. Create a new iSCSI Target to expose the LUN over the network. If you have an existing target, you can use that as well.

    Creating a new LUN on Synology DSM

  2. Choose LUN mapping. Here I want to create a new LUN.

    Creating a new iSCSI Target on Synology DSM

  3. Create a new LUN. It’s highly recommended to use Thick Provisioning. This allocates all the disk space immediately, leading to better performance and reliability compared to thin provisioning. However, I’m using Thin Provisioning because I will be using it alone without any other users and performance is not my main goal. For me flexibility is more important.

    Mapping the LUN to the Target

  4. Take note of the Target’s IQN (iSCSI Qualified Name). You will need this in Proxmox.

    Synology iSCSI Target Details with IQN

Part 2: Proxmox Host Configuration
#

Now we’ll connect Proxmox to our newly created iSCSI storage.

Step 2: Add the iSCSI LUN to Proxmox
#

In the Proxmox web UI, navigate to Datacenter -> Storage -> Add -> iSCSI.

  • Portal: Enter the IP address or hostname of your Synology NAS.
  • Target: Proxmox should discover the target automatically. Select the correct IQN you noted earlier.

Adding the iSCSI storage in Proxmox

After adding the storage, you can head back to your Synology’s iSCSI Manager. You should now see a connection from your Proxmox server, confirming everything is working.

Verifying the iSCSI connection on Synology

Step 3: Create a Volume Group and LVM Storage
#

With the iSCSI disk available to the host, we’ll format it as an LVM storage pool. This allows for flexible volume management.

  1. Navigate to Datacenter -> Storage -> Add -> LVM.
  2. ID: Give your new storage a descriptive name (e.g., syn-nextcloud-lvm).
  3. Base storage: Select the newly attached iSCSI LUN.
  4. Volume group: Select “Create new volume group” and give it a name (e.g., vg-nextcloud).
  5. Shared: Tick this box if you are running a Proxmox cluster and want to use this storage for live migrations.

Creating the LVM storage pool in Proxmox

Part 3: Creating the Nextcloud VM
#

Step 4: Choose an Isolation Method: VM vs. LXC
#

For running a multi-service stack like Nextcloud, the choice between a full Virtual Machine and a Linux Container is important.

  • VM: Provides full kernel-level isolation and better security. It behaves like a completely separate machine. This is the recommended approach for Nextcloud.
  • LXC: Is more lightweight and less resource-intensive as it shares the host kernel. However, running Docker inside an LXC container requires special configuration (e.g., nesting, privileged mode) which can complicate the setup and reduce the security benefits.

We will proceed with a Virtual Machine.

Step 5: Create and Configure the VM
#

Create a new VM with a standard Ubuntu Server installation.

  • OS Storage: Install the operating system on your local Proxmox storage (e.g., local-lvm). A disk size of 32 GB is plenty for the OS and Docker images.
  • CPU: Allocate at least 2 cores.
  • RAM: Allocate at least 4 GB.

After the VM is created, attach the data disk from our iSCSI LUN.

  1. Select the VM and go to its Hardware tab.
  2. Click Add -> Hard Disk.
  3. Storage: Select the LVM storage pool you created earlier (syn-nextcloud-lvm).
  4. Disk size: Use the desired size for your Nextcloud data.
  5. Important: In the “Advanced” options, uncheck “Backup”. This prevents Proxmox from including this large data disk in the VM’s snapshot backups. You should have a separate strategy to back up the data itself, either at the Synology or data level.

Adding the iSCSI-backed data disk to the VM

Step 6: Install Ubuntu Server and Prepare the Data Disk
#

Start the VM and proceed with the Ubuntu Server installation.

  1. When you get to storage configuration, only select the internal 32 GB disk for the OS installation. Leave the large data disk untouched for now.

    Selecting the OS disk during Ubuntu installation

  2. The Ubuntu installer gives us a convenient option to format and mount the second disk. Choose to format the data disk.

    Formatting the data disk in the Ubuntu installer

  3. For the filesystem, I chose Btrfs to experiment with its advanced features like snapshots and data-integrity checksums. Another performant and stable choice would be ext4. Both are excellent options. Mount it at a memorable location, like /mnt/data.

  4. During the installation, you’ll be prompted to install featured server snaps. Do not install the Nextcloud snap. Instead, for convenience install the Docker snap. Alternatively, you can install Docker after the VM is running.

    Selecting Docker during Ubuntu installation

Step 7: Configure Networking (DHCP Reservation & DNS)
#

For easy management, it’s best to assign a static IP to your Nextcloud VM. The easiest way is via a DHCP reservation in your DHCP server, for me that is UniFi. While you’re there, create a local DNS record (e.g., nextcloud.your.lan) that points to this new IP. This allows you to easily SSH into the machine by name.

Creating a DHCP reservation and local DNS entry in UniFi

Part 4: Reverse Proxy and Nextcloud AIO
#

Step 8: Configure the Nginx Reverse Proxy
#

Nextcloud can be set up to either expose the HTTP ports directly or to run behind a reverse proxy, which will handle SSL termination and present a clean URL to the world. We will set it up to run behind an external Nginx server. Here is a sample Nginx configuration. You’ll need to create a new config file (e.g., in /etc/nginx/sites-available/) on your separate Nginx server.

server {
    listen 443 ssl http2;
    server_name next.your-public-domain.com; # Your public domain

    # SSL configuration (Certbot, etc.) goes here
    # ssl_certificate /path/to/your/fullchain.pem;
    # ssl_certificate_key /path/to/your/privkey.pem;

    error_log  /var/log/nginx/nextcloud.error.log warn;
    access_log /var/log/nginx/nextcloud.access.log;

    location / {
        proxy_pass http://nextcloud.your.lan:11000; # The local DNS name and port for Nextcloud
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Make sure your public DNS records are pointing next.your-public-domain.com to your Nginx server’s public IP.

Step 9: Install Nextcloud AIO with Docker
#

With all the groundwork laid, installing Nextcloud AIO is straightforward. SSH into your new VM and run the following Docker command. We’ve modified the official AIO command to suit our setup.

Key changes:

  • --env APACHE_PORT=11000: This tells AIO’s internal Apache webserver to listen on port 11000, which is what our reverse proxy is pointing to.
  • --env NEXTCLOUD_DATADIR="/mnt/data": This is the most important part. It tells Nextcloud to store all of its data on our mounted Btrfs/ext4 filesystem, which resides on the iSCSI LUN.
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 8080:8080 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--env APACHE_PORT=11000 \
--env APACHE_IP_BINDING=0.0.0.0 \
--env NEXTCLOUD_DATADIR="/mnt/data" \
ghcr.io/nextcloud-releases/all-in-one:latest

Step 10: The Web-Based Setup
#

Now open a web browser and navigate to https://<ip-of-vm>:8080 or https://nextcloud.your.lan:8080. You’ll be greeted by the AIO setup interface. For this step it is recommended to use the IP address to reduce the risk of running into problems with HSTS, if you are using Nextcloud without a reverse proxy.

Nextcloud AIO initial setup screen

Enter your public domain name (next.public.domain). Since our reverse proxy and DNS are already configured, the domain validation should pass without issue.

Entering the domain in the AIO setup

Click “Download and start containers.” AIO will now pull all the necessary Docker images and configure them.

Nextcloud AIO downloading and starting containers

Once it’s finished, you’ll be given your initial admin password. Save this password securely.

Nextcloud AIO setup finished with initial password

Congratulations! Your Nextcloud instance is fully installed and operational.

Part 5: Final Steps
#

Change the Admin Password
#

Log in to your new Nextcloud instance using the provided credentials. The first thing you should do is change your password. Go to Personal Settings -> Security to set a new, strong password.

Changing the admin password in Nextcloud settings

Create Users
#

To create new user accounts, click your profile icon in the top right and select Administration settings -> Users. For more detailed information on user management, refer to the official documentation.

Nextcloud user management screen

And that’s it! You now have a secure, scalable, and feature-rich Nextcloud setup!

Bjarne
Author
Bjarne
I’m a network engineer from Germany and like to tinker with my homelab