NextcloudPi Documentation

repository·master·Indexed 25 days ago

https://github.com/nextcloud/nextcloudpi

NextcloudPi provides ready-to-use images and build scripts for deploying Nextcloud on hardware such as Raspberry Pi, Odroid, and Rock64, as well as virtualized environments like LXD and Proxmox. It includes a suite of management tools including ncp-config for TUI configuration, ncp-backup for database and application backups, ncp-diag and ncp-report for system diagnostics, and ncp-update for software maintenance.

Tokens
26.6K
Snippets
37
Records
162
Agent score
84%

What's inside NextcloudPi

  1. Build NextcloudPi images

    master

    Developers can build various NextcloudPi images using the provided build scripts. Ensure you have the required dependencies (such as qemu, git, jq, and build-essential) installed.

    # Build Raspberry Pi IMG
    git clone https://github.com/nextcloud/nextcloudpi.git
    cd nextcloudpi
    ./build/build-SD-rpi.sh
    
    # Build Armbian-based board (e.g., odroidxu4)
    ./build-SD-armbian.sh odroidxu4
    
    # Build LXD image
    ./build/build-LXD.sh
  2. Run NextcloudPi in LXD

    master

    To run NextcloudPi in an LXD environment, import the LXC image, launch the container, and then start it. Replace X.XX.X with the specific version number from the release files.

    # Imports the LXC image
    lxc image import "NextcloudPi_LXD_vX.XX.X.tar.gz" --alias "nextcloudpi"
    
    # Launches a container from the image
    lxc launch "nextcloudpi" ncp
    
    # Starts the container
    lxc start ncp
  3. Run NextcloudPi in Proxmox

    master

    There are two methods for deploying NextcloudPi on Proxmox:

    1. Official Release Image

    Download the latest LXC image from the NextcloudPi releases page directly into your Proxmox storage pool using the 'Download from URL' feature in the CT Templates section. You can optionally provide a checksum to verify the download.

    2. Community-Scripts Installer

    Use the automated helper script from community-scripts to install an LXC container.

    Default Settings: 2GB RAM, 8GB Storage, 2vCPU.

    bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/nextcloudpi.sh)"
  4. Configure NextcloudPi via TUI or Web Panel

    master

    NextcloudPi features can be activated and configured using two primary methods:

    1. Command Line (TUI): Use the ncp-config tool for easy setup of RAM logs, USB drives, and more.
    2. Web Interface: Access the NextcloudPi Web Panel at HTTPS port 4443 to manage extras and settings.
    sudo ncp-config
  5. Understand NextCloudPi Activation behavior

    master

    The NextCloudPi activation page is a one-time setup entrypoint. Once the ncp-activation Apache module is enabled, this page returns a 404 error and becomes inaccessible to prevent re-activation.

    During the initial activation, the system generates unique, random passwords for both the ncp user (NextCloudPi web interface) and the ncp user (Nextcloud application).

    Key Credentials:

    • NextCloudPi User: ncp (Access via https://nextcloudpi.local:4443)
    • Nextcloud User: ncp (Access via https://nextcloudpi.local)

    Password Management:

    • To change the NextCloudPi password, use the CLI command: nc-passwd.
    • To change the Nextcloud password, use the Nextcloud user configuration interface.
  6. Configure the MariaDB data directory

    master

    The nc-database configuration script allows you to move the MariaDB database data directory to a new location (e.g., an external drive).

    Requirements & Constraints:

    • The target directory must be on an ext, btrfs, or zfs filesystem.
    • The mysql user must have access permissions over the base directory of the new location.
    • If the target directory is on the same partition as the root (/), the script will notify you that the database is being moved to the SD card.

    Process:

    1. The script stops the mysql service.
    2. It moves the existing data from /var/lib/mysql (or the current configured datadir) to the new $DBDIR.
    3. It updates the MariaDB configuration file at /etc/mysql/mariadb.conf.d/90-ncp.cnf using the mysql/90-ncp.cnf.sh template.
    4. It restarts the mysql service.
    5. Maintenance mode is automatically toggled during this process to ensure data integrity.
  7. Install dnsmasq DNS server with cache

    master
    Installs the dnsmasq package on Raspbian and applies a workaround for conflicts with systemd-resolved. The installation process masks existing dnsmasq services, installs the package without recommended dependencies, and configures systemd-resolved to disable the DNSStubListener if it is active to prevent port conflicts.
  8. Configure data-at-rest encryption using nc-encrypt.sh

    master

    The nc-encrypt.sh script manages data-at-rest encryption for NextcloudPi using gocryptfs. It allows you to encrypt your Nextcloud data directory or decrypt it back to a standard directory structure.

    Prerequisites

    • The gocryptfs package must be installed (the script includes an install function for this).
    • You must provide a PASSWORD environment variable when running the configuration.

    Encryption Workflow

    To encrypt your data directory:

    1. Set the PASSWORD environment variable.
    2. Set ACTIVE=yes.
    3. Run the script's configure function.

    The script will:

    • Initialize a gocryptfs directory (located at ${parentdir}/ncdata_enc).
    • Move your existing data to a temporary location.
    • Mount the encrypted directory using systemd-run as a service named ncp-encrypt.
    • Move the data into the encrypted mount point.
    • Update the NextcloudPi configuration (datadir) to point to the new mount point.
    • Switch Apache virtual hosts from ncp-activation to ncp and 001-nextcloud.

    Decryption Workflow

    To decrypt your data directory:

    1. Set ACTIVE=no.
    2. Run the script's configure function.

    The script will:

    • Unmount the gocryptfs volume.
    • Move the encrypted data back to the original directory path.
    • Remove the ncdata_enc directory and associated gocryptfs configuration.
    • Restore access to Nextcloud via standard virtual hosts.
  9. Manually add trusted proxies in NextcloudPi

    master

    Use the nc-trusted-proxies.sh script to configure trusted proxies for your NextcloudPi instance. This script reads proxy parameters (PROXY1, PROXY2, PROXY3) and applies them to the Nextcloud system configuration using the ncc command. It also updates the Apache configuration by reinstalling the nextcloud.conf.sh template to /etc/apache2/sites-available/001-nextcloud.conf.

    To use this script, you must provide the proxy addresses via environment variables. The script supports up to three proxies.