Post

How to Install Nextcloud AIO in a Proxmox LXC

Step-by-step guide to installing Nextcloud AIO in a Proxmox LXC container. Learn how to set up a secure, efficient, and self-hosted cloud solution for your files, calendars, and contacts using Proxmox and a reverse proxy.

How to Install Nextcloud AIO in a Proxmox LXC

Nextcloud is an open-source, self-hosted cloud storage solution that allows you to manage your files, calendars, contacts, and more. Installing Nextcloud on a Proxmox LXC (Linux Container) offers a lightweight, efficient, and resource-friendly method to run Nextcloud on your home server.

I’ve been running this setup for several months without any issues - the system has been stable and reliable, and weekly upgrades have always completed smoothly.

This guide will walk you through installing Nextcloud AIO (All-In-One) in a Proxmox LXC container. Additionally, you’ll learn how to enable secure, public access to your Nextcloud instance using a reverse proxy with Nginx Proxy Manager (NPM).


⚙️ Prerequisites

Before you begin, ensure that you have:

  • A Proxmox server set up and running (you can use this article as a reference).
  • A folder/storage mount created on your Proxmox server for holding all your data (ZFS in this example).
  • An internet connection to download packages and dependencies.
  • Additionally, a Nginx Proxy Manager (NPM) instance for accessing the Nextcloud instance (you can use this article as a reference) - any other reverse proxy will also work.

📦 Step 1: Create an LXC for Nextcloud

We will create a Proxmox LXC container to host Nextcloud.

  1. Log in to Proxmox Web Interface: Open your Proxmox Web Interface (https://<your-proxmox-ip>:8006).

  2. Create a New LXC Container:
    • Navigate to the Create CT button in Proxmox.
    • Fill in the basic details (like hostname, password, etc.). You can name the container nextcloud-aio or something relevant.
    • For the template, use a Debian-based template (Debian 12 or Ubuntu 24.04 is a good choice) for compatibility with Nextcloud.
    • Set up the resources like CPU, RAM, and Disk as per your needs. I used 4 cores and 8GB RAM - according to the Proxmox dashboard this is far more than I ever needed the last months.
  3. Mount the Storage in the LXC: During the creation process, you will need to add a mount point for the storage (ZFS in this example) to the container. In Proxmox, this can be done by mapping a directory from the host to the LXC container.

    For example:

    • Host directory: /pool/nextcloud_data (created on the ZFS pool)
    • Container directory: /srv/nextcloud (where Nextcloud stores user data)

    After creating the container, go to the LXC config file (found at /etc/pve/lxc/<container_id>.conf) and add the following line (replacing <container_id>with the numeric id of your container):

    1
    
    mp0: /pool/nextcloud_data,mp=/srv/nextcloud
    

    or use the following command on the Proxmox host (replacing <container_id>with the numeric id of your container):

    1
    
    pct set <container_id> -mp0 /pool/nextcloud_data,mp=/srv/nextcloud  
    

    This line ensures that the storage is mounted inside the LXC at the location where Nextcloud expects to find its data.


🧰 Step 2: Install Nextcloud AIO in the LXC

Now that the LXC container is set up and has access to the storage, we will proceed with the installation of Nextcloud AIO.

  1. Start the LXC: Start the newly created LXC container from the Proxmox Web Interface or via the command line:

    1
    
    pct start <container_id>
    
  2. Access the LXC: Enter the container using the console in the Proxmox Web Interface or via command line:

    1
    
    pct enter <container_id>
    
  3. Install Dependencies: Install required packages such as curl, git, and Docker (since Nextcloud AIO runs via Docker).

    1
    2
    
    apt update
    apt install -y curl git sudo lxc
    
  4. Install Docker: Nextcloud AIO uses Docker to run its services. To install Docker, run:

    1
    
    curl -fsSL https://get.docker.com | bash
    

    After installation, check Docker’s status:

    1
    
    sudo systemctl status docker
    
  5. Install Nextcloud AIO: Use the following command to fetch and install the Docker-based setup for Nextcloud AIO:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    sudo docker run \
    --init \
    --sig-proxy=false \
    --name nextcloud-aio-mastercontainer \
    --restart always \
    --publish 8080:8080 \
    --volume /srv/nextcloud/aio-config:/mnt/docker-aio-config \
    --volume /var/run/docker.sock:/var/run/docker.sock:ro \
    --env NEXTCLOUD_DATADIR="/srv/nextcloud/data" \
    --env APACHE_PORT=11000 \
    --env APACHE_IP_BINDING=0.0.0.0 \
    --env APACHE_ADDITIONAL_NETWORK="" \
    --env SKIP_DOMAIN_VALIDATION=false \
    nextcloud/all-in-one:latest   
    

    This script will automatically configure and deploy Nextcloud AIO with all necessary components. The env parameter NEXTCLOUD_DATADIR forces Nextcloud AIO to use your mounted storage to be used in the container! The other env parameters prepare the mastercontainer to start Nextcloud itself with reverse proxy support - for more details, please visit the official documentation.

  6. Access the Nextcloud AIO Web Interface: Once the installation is complete, you can access the Nextcloud AIO web interface by navigating to:

    1
    
    http://<container_ip>:8080
    

    The default port is 8080, but you can configure it as needed.


🛡️ Step 3: Post-Installation Configuration

Once Nextcloud AIO is installed, you can proceed with further configuration:

  1. Set Up Admin Account: After accessing the web interface, set up the admin account and configure Nextcloud settings (e.g., enable HTTPS, configure email notifications, etc.).

  2. Mount Additional Storage (Optional): If you’d like to mount additional storage or set up network shares, you can add them to the container via Proxmox and then configure them within the Nextcloud settings.

  3. Secure Nextcloud:

    • Set up SSL for secure HTTPS access.
    • Set up 2FA for logon (using the app Two-Factor TOTP Provider).
    • Ensure regular backups are configured for your LXC.
    • Ensure regular backups are configured for your Nextcloud data.

🧰 Step 4: Prepare the Reverse Proxy

The Nextcloud AIO mastercontainer will publish the Nextcloud HTTP port to the port you have chosen with the env parameter APACHE_PORT (11000 in our case). After the Nextcloud container has started and initially configured, you can point the reverse proxy to the IP address of the LXC and port 11000.

Using the Nginx Proxy Manager this should look like:

  1. Add a new proxy host
  2. Set the configuration like:
    • Domain Names: The desired DNS name for your Nextcloud instance
    • Scheme: HTTP
    • Forward Hostname / IP: The IP address of the LXC
    • Forward Port: 11000
    • Cache Assets, Block Common Exploits and Websockets Support: Enabled
  3. Generate a SSL certificate using Let’s Encrypt
    • Force SSL and HTTP/2 Support: Enabled
  4. Save

After you have finished the reverse proxy configuration and installed the certificate, your Nextcloud instance is securely and publicly accessible.


🔄 Step 5: Maintaining the Nextcloud AIO Server

Regular maintenance tasks for the Nextcloud server will include:

  • Updating Nextcloud: Keep your Nextcloud installation up to date by regularly checking for updates within the AIO interface.
  • Monitoring ZFS: Check the health of your ZFS pool with zpool status.
  • Backing Up Data: Set up automatic backups for Nextcloud data to ensure your files are protected.

🧠 Final Thoughts

Installing Nextcloud AIO in a Proxmox LXC container using a reverse proxy provides a lightweight, efficient, and highly reliable way to run your own cloud storage server. By using ZFS for redundancy, you ensure your data is protected against drive failure, and with Proxmox LXC, you can enjoy resource-efficient virtualization.

By following this guide, you’ll have a powerful, secure, and scalable Nextcloud server that can be accessed from anywhere, all hosted in your own environment.

This post is licensed under CC BY 4.0 by the author.