Getting started with NextCloudPi on Proxmox

Warning, use this “How to” with caution and at your own risk, it’s a work in progress.

Latest Update 24.01.2023

  • This should, be a beginner-friendly tutorial on how to get NCP running on Proxmox.
  • Please give feedback if you have issues.
  • Thanks in advance for any help & contributions.

The goal

  1. Running NCP on a Proxmox server (obviously)

    There are 5 ways of achieving this:

    1.1 Use the official LXC/LXD NCP image in a CT :hammer_and_wrench: :x:
    1.2 Use the official curl installer script in a Debian 11 VM :white_check_mark: (recommended)
    1.3 Use the official ncp-VM image :x: DISCONTINUED
    1.4 Use the official NCP Docker image in a CT or VM :white_check_mark:
    1.5 Use the Unofficial Proxmox Helper Script in a CT :white_check_mark: :warning:

  2. Pass through a drive that is used for NCP data only.

  3. Restore NCP Backup from external USB Drive


1. Running NCP on a Proxmox

Option 1: Official LXC/LXD NCP image in a CT

This option, together with option 4 and 5 seem to be the most resource friendly option.
As of 1. October 2021 @nachoparker added LXD support. which is great news, as this will be a NCP with all the functionality, as opposed to the docker image that misses some features.

However, things are more complicated than they seem. To my knowledge, there is no streight forward way to install it in a Proxmox CT (October 2022).
Please head over to this post if you want to make it happen.

Option 2: Official Curl Installer in Debian 11 VM (Recomennded)

Works well and easy. However, the drawback here is, that this is not a BTRFS file system that would allow nc-snapshots (except if you do are doing some manual partitioning or add a separate drive with BTRFS)

See Official NCP Documentation for the more polished and up-to-date guide of this option.

  1. Download debian-11.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 section 2. below), 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 virtual 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
Option 3: Official VM image

Using the VM image from NCP was the easiest and most straightforward option.
However, currently the NCP project does not offer a VM image.
:warning: Therefore this option is currently not possible.
I don’t want to delete the section just yet in case a VM image in provided in the future.
Please check the NCP Release Page on GitHub to see if one is available.

  1. Create a new VM on your Proxmox server and chose the option “Do not use any media” in the OS section.

  1. In the main Proxmox terminal

    1. Change directory: cd /var/lib/vz/images/

    2. Use the wget command to download the latest VM image from the NCP Project on GitHub:
      wget https://FULL-URL-TO-THE-VM-IMAGE-ON-GITHUB

    3. When finish, use the tar -xf command to extract the download.
      Currently, (April 2021):
      tar -xf NextCloudPi_VM_XX-XX-XX.tar.bz2

    4. Finally create a VM disk using
      qm importdisk VIRTUAL-MACHINE-NUMBER NextCloudPi_VM_XX-XX-XX.img DRIVE-NAME
      (Example: qm importdisk 104 NextCloudPi_VM_11-30-20.img local-zfs)

  2. Close the terminal and in the Proxmox Web interface:

    1. Go to your VM you wish to use and select Hardware

    2. Find the disk you have just created (usually disk-1)

    3. Use the Edit function to add it to your VM

    4. On the left go to Option and set boot to the new disk

    5. Start the VM and run updates.

  3. Access & Activate NCP using the browser

(2021) The default user and password of your VM will be:
user: root
password: ownyourbits or vagrant

Option 4: Official Docker image in a CT or VM

Together with option 1 this is resource-friendly (if you use a CT). However, you will miss some features and Proxmox does not recommend running Docker in CTs but only in VMs.
The installation is, for people used to docker, just like any other docker image there is even a comprehensive guide in the NCP documentation. But I did not have time to work on this Proxmox specific guide, but you can use the official Docker Documentation to install Docker in a CT or VM and then use the NCP Documentation mentioned above to get the NCP Container up and running,
If you like to write a specific tutorial, you are welcome to contribute!

Option 5: Unofficial Proxmox Helper Script

A project, that is not part of the NCP Project Proxmox Helper Scripts Offers one line scripts to install all kinds of software in CTs.
The script works (as attested here) however, you should check what the script does and not blindly trust it. (If you don’t know how to check the script and feel overwhelmed by such a task, the Video from DT might help to remove some of the anxiaty :wink:

  1. Simply use the Proxmox Shell to run the following script: bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/nextcloudpi-v4.sh)" this will create a CT with NCP installed.
  2. Use your browser to access and activate your NCP installation.

If you are migrating from a RaspberryPi to a Proxmox CT @johndoe0815 wrote a guide on this


2. Pass through a drive that is used for NCP data to a VM.

In this case, we are going to pass through an entire, physical drive to a VM.
(If you wish to only pass through only part of a drive, as virtual drive commands will be slightly different. Check out this and the official Proxmox docs
If you wish to pass through a drive to a CT the process might be very different. Maybe here you can get help on that?)

How to
  1. Use the main 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

  4. Leave the Terminal and navigate to your VM

  5. In the Hardware section you should now see the drive.

  6. Boot your VM and open it’s Terminal.

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

  8. 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 partion, 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)
  9. Create a mountpoint, mount it and set auto-mount

    1. Type mkdir /media/MY-MOUNT-NAME create mountpoint
    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:
      /dev/sda1 /media/ncdata ext4 4,nofail 0 0 (if you use BTRFS please see here how to mount and edit fstab)

3. Restore NCP Backup from external USB Drive

(This section needs some love (work), but here is a summary:)

How to

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 .

Credit to @OliverV
for helping out.

Credit to @johndoe0815
for pointing out about the PVE Helper Script

4 Likes

Yes, you add the drive later.
In terminal:

From Proxmox Web interface

  • add the unused disk to the VM
  • In VM options set boot to the new disk
  • start the VM

I see a 4th way and that is to create a VM install docker-ce and run docker NCP image inside the VM.

1 Like

Thanks @OliverV forgot about wget, that makes it more easy.

But it seems I’m still doing something wrong.
I can see the unused disk, and I’m able to add it, but the VM does not boot.

Go to Options and edit the boot device and set to scsi1, then boot.
(edit) edited earlier comment also, to add this step.

1 Like

Thanks, I added it to the guide and followed the steps myself.

I now work on post installation, which I also want to document.

But I once again reach my technical knowledge limit.

I want to add a drive just for data to the VM.
I was able to passthrough the secondary internal drive to the VM and with lsblk it shows up as sda in the ncp-VM

Should I format manually to BTRFS so I can use snapshots?
If so, how to do that, I struggle to find information on how to go about it.

in vm terminal run
(this will destroy any data on the drive!!!)

fdisk -c /dev/sda

(g)create a gpt partition table
(n)create a new partion, just hit enter to all (defaults to Linux and max size)
(w)save and exit

run
mkfs.ext4 /dev/sda1

You can now create a mountpoint and mount it
mkdir /media/mymount
mount /dev/sda1 /media/mymount

Check with
df -hT

1 Like

I’ve just realsed that @nachoparker added LXC/LXD support https://github.com/nextcloud/nextcloudpi/commits/master/README.md

However, I have no idea on how to deploy it.
:point_down: :point_down: :point_down: :point_down:

Run in LXD

lxc import NextCloudPi_LXD_09-29-21.tar.bz
lxc start ncp

Anyone knows how this works?
Please reach out to me, so I can update documentation or just edit the doc in the first post (wiki) yourself.

2 Likes

thanks, it would be great to add this here and to docs.nextcloudpi.com

1 Like

I try to keep the

Getting started with: NextCloudPi on Proxmox on docs.nextcloudpi.com updated.

And once we got together a complete guide on LXC/LXD I will also post it there.

2 Likes

I have been trying to install NCP via method 3. It is successful but I am not presented with the activation for the initial password. Am I missing something?

Thanks for the feedback.
I did not use this method myself, so I’m not certain, but it thinks the activation screen should show up.

So what happens if you go to the IP of the VM? You say there is no activation page, are you landing at the login?

If yes, you can use the terminal and sudo ncp-config to reset the password.


otherwise, maybe @OliverV can help?

yes I just hit the landing page. In the terminal page it asks for login but again I don’t know the credentials.

oh, yes, obviously, as you have installed a finished VM image that is all set.

@nachoparker what is the default user and passwd of the VM image?

@gullygossner try
user: root
password: root

in the meantime.

And drop me a line if it worked, I will add it in the doc above.

1 Like

unfortunately root root does not work :frowning:

try

user: root
password: ownyourbits
or password: vagrant

thanks @nachoparker

1 Like

This is tested automatically and definitely works. You have to find out the IP of the VM and then input that IP in your browser. The activation page will pop up.

To clarify, root/vagrant (will be root/ownyourbits in the next release) is the Unix password if you use the VM directly from the hypervisor (not ncp-web, not NC, not SSH).

1 Like

vagrant was the ticket to get in from the console and reset my password. Thank you

@nachoparker I believe someone else already reported that they have never seen the Activation page but got straight to the NC-Login page.

Can it be that the VM Image is activated already?

I will keep an eye on it and might test myself, and if there is something, I’ll raise a issue on github.

2 Likes

oh gosh, I tested it and I guess you are right, must have been packaged after the activation automatic testing. I’ll create a new one