Post

How to Install Nextcloud AIO in a Proxmox LXC with ZFS Storage

How to Install Nextcloud AIO in a Proxmox LXC with ZFS Storage

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.

In this article, we will guide you through the steps of installing Nextcloud AIO (All-In-One) in a Proxmox LXC, using a newly created ZFS file system as the storage backend.

Prerequisites

Before you begin, ensure that you have:

  • A Proxmox server set up and running (you can use this article as a reference).
  • ZFS pool created on your Proxmox server.
  • Basic understanding of Proxmox and ZFS.
  • An internet connection to download packages and dependencies.

Hardware & Setup Recap

  • Proxmox is installed and running on your server.
  • You have a ZFS file system created to store Nextcloud data (you can use an existing ZFS pool or create one specifically for Nextcloud).
  • A Linux Container (LXC) is the preferred method for running Nextcloud AIO for its resource efficiency.

Step 1: Create an LXC for Nextcloud

We will create a Proxmox LXC container to host Nextcloud AIO.

  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 11 is a good choice) for compatibility with Nextcloud.
    • Set up the resources like CPU, RAM, and Disk as per your needs.
  3. Mount the ZFS Storage in the LXC: During the creation process, you will need to add a mount point for the ZFS file system 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:

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

    This line ensures that the ZFS 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 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 pct enter:

    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
    2
    
    curl -fsSL https://get.docker.com | bash
    sudo usermod -aG docker $USER
    

    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
    
    sudo docker run \
    --init \
    --sig-proxy=false \
    --name nextcloud-aio-mastercontainer \
    --restart always \
    --publish 80:80 \
    --publish 8080:8080 \
    --publish 8443:8443 \
    --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" \
    nextcloud/all-in-one:latest   
    

    This script will automatically configure and deploy Nextcloud AIO with all necessary components. The Nextcloud AIO config and the Nextcloud data will be put into ZFS storage rather than locally in the LXC.

  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.
    • Ensure regular backups are configured for your Nextcloud data.

Step 4: 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 words

Installing Nextcloud AIO in a Proxmox LXC container using ZFS storage 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.