NextCloudPi [VM] on Proxmox

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.



Goal

  • Run a Debian (11) Bullseye VM and install NCP using the curl installer

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. Navigate to the latest debian-11.X.X-amd64-netinst.iso image and copy the URL in order to directly download it to your Proxmox host.
    a. using the shell of the Proxmox host change to the directory where Proxmox stores its images:
    cd /var/lib/vz/template/iso/
    b. with the ẁget commend pull the latest image (example: wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.6.0-amd64-netinst.iso)
    Note: Alternativly you can also download the netinst.iso to your computer first and then upload it to your proxmox over the Web UI.

  2. 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. Pass-through a Drive for NC Data), you don’t need more than 8GB of disk space, if not, just give it as much as you need for your data.)

  3. Boot into the VM and use the Proxmox shell of the VM to go thorough the installation process.
    Note: A bare minimum installation of Debian will be sufficient.

  4. 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)

  5. Install updates: apt updates && apt upgrade -y

  6. Install curl: apt install curl

  7. Install NCP as root by running: curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | bash

  8. 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)

Note: If you gave the VM enough disk space to hold all NC data on its own, you can skip this step.

Proxmox Host 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)

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

Debian NCP 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!)
  4. Type fdisk -c /dev/sda (This will delete all data on sda)
  5. Type g to create a gpt partition table
  6. Type n to create a new portion, just hit enter to all (defaults to Linux and max size)
  7. Type w to save and exit
  8. Run mkfs.ext4 /dev/sda1 (alternatively you can format as BTRFS, to later use the snapshot function of NCP)
  9. Create a mount point, mount it and set auto-mount
  10. Type mkdir /media/MY-MOUNT-NAME create mount point
  11. Type mount /dev/sda1 /media/MY-MOUNT-NAME mount drive to system
  12. Type df -hT to see if it is mounted (if it is listed, it’s mounted)
  13. 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

[incomplete - needs more details]
Attach your Backup drive to your Proxmox host and pass it through to your NCP VM.
In the NCP VM mount it, and restore the backup: How to restore NextcloudPi Backup.

We hope this doc was helpful, if you encounter any issues please reach out to the community.
These docs are written by volunteers, please consider becoming one of them.
Contact the wiki team at Matrix or Telegram

https://docs.nextcloudpi.com/