Difficulty Level: medium

There are multiple ways of running NCP on a Proxmox Server. All have their advantages and disadvantages. This tutorial will present you with one of the options. It is intended to help beginners and does not claim to be the best solution. We encourage you to try multiple ways and choose the one that suits you best.

3 Possible ways of running NCP on a Proxmox Server

This tutorial only guides you through Option 1.

  1. Run a Debian (10) Buster VM and install NCP using the curl installer (works)
  2. Create a VM and use the official ncp-VM image (works)
  3. Create a VM or LXC, install docker-ce and run the official docker NCP image inside the VM. (works)

Note: At the point of writing this tutorial, it is not possible to install NCP with the curl installer on a Debian Buster LXC.

There is a WIKI in the NC Forum that attempts to document all 4 options. Feel free to contribute.

Note: There is a turnkey-nextcloud LXC in the Proxmox container repo. This is a ready NC installation. However, it is not NextcloudPi and as this tutorial focuses on NCP only it is excluded.

Topics covered in this Tutorial

  1. Install NCP on a Proxmox Server
  2. Pass-through a drive for NC data
  3. Restore NC data from an external USB backup drive.

1. Install NCP on a Proxmox Server

  1. Download debian-10.X.X-amd64-netinst.iso
  2. upload the debian .iso to your Proxmox Server
  3. Set up the Debian VM in Proxmox and give it the resources you wish. (min 2GB of RAM but ideally much more. If you want to use a separate physical drive for data (see 2.), you don't need more than 4-8GB of disk space, if not, just give it as much as you need for your data.)
  4. Boot into the VM and use the Proxmox shell of the VM to go thorough the installation process.
  5. After the initial installation, ssh as root into the VM (you might need to enable root login from the Proxmox shell before you can use ssh (here is how). Alternatively, just use the Proxmox shell for the steps below (note: copy and paste does not work in the VM shell)
  6. Install updates: apt updates && apt upgrade -y
  7. Install curl: apt install curl
  8. Install NCP as root by running: curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash
  9. Access & Activate NCP using the VM's IP from your browser

2. Pass-through a Drive for NC Data

In this case, we are going to pass-through an entire, physical drive. If you wish to only pass-through part of a drive, as virtual drive commands will be slightly different. (Check out this and the official Proxmox docs)

If you gave the VM enough disk space on its own, you can skip this step.

Proxmox configuration
  1. Use the main (host) Proxmox Terminal and type: ls /dev/disk/by-id/ a list of all your drives, physical and virtual will appear.
  2. Find the drive you wish to pass through to your VM and copy the full drive name.
  3. Use this command to add it: qm set VM-ID-NUMBER -scsi2 /dev/disk/by-id/FULL-DRIVE-NAME (see example below)

4. Leave the Terminal and navigate to your VM
5. In the Hardware section you should now see the drive.

Debian VM Configuration
  1. Boot your VM and open it’s Terminal or use ssh.
  2. With the lsblk command, you should see your drive listed.
    NOTE: If you are coming from e.g. a RaspberryPi setup and want to use the data drive, still containing the data from the old setup, do not follow the steps below. Simply let your NCP VM instance know where your data directory is & restore your NCP by loading a data-less backup. (How to restore backups)
  3. Delete all data on the drive you want to use as data drive.(sda as example!)
    1. Type fdisk -c /dev/sda (This will delete all data on sda)
    2. Type g to create a gpt partition table
    3. Type n to create a new portion, just hit enter to all (defaults to Linux and max size)
    4. Type w to save and exit
    5. Run mkfs.ext4 /dev/sda1 (alternatively you can format as BTRFS, to later use the snapshot function of NCP)
  4. Create a mount point, mount it and set auto-mount
    1. Type mkdir /media/MY-MOUNT-NAME create mount point
    2. Type mount /dev/sda1 /media/MY-MOUNT-NAME mount drive to system
    3. Type df -hT to see if it is mounted (if it is listed, it’s mounted)
    4. Type nano /etc/fstab and add the following line so that the drive will be mounted automatically every time you reboot:
      /dev/sda1 /media/ncdata ext4 4,nofail 0 0
      (it is actually better to use the UUID of the drive instate of /dev/sda1 (which identifies what has to be mounted), this way it will still mount correctly even if you move or add drives in your server)

If you use BTRFS, please see here how to mount and edit fstab and adjust the commands above accordingly.

3. Restore NCP Backup from external USB Drive

Let your NCP VM instance know where your data directory is & restore your NCP by loading a full backup (How to restore backups).

Updated: 2021-10-13