Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Last active January 5, 2024 00:10
Show Gist options
  • Save darth-veitcher/e651cc0b3fdb6952306bb3a5749993bd to your computer and use it in GitHub Desktop.
Save darth-veitcher/e651cc0b3fdb6952306bb3a5749993bd to your computer and use it in GitHub Desktop.
Proxmox setup and notes (Community Edition)

Install instruction and notes for setting up a homelab proxmox cluster

Updated as at June 2016 for Proxmox Virtual Environment 4.2-11/2c626aa1

Allow use of community packages

Change the apt sources to point to the community repo. Thanks to niccolox.org

# disable the enterprise repo
sed -i.bak s'/deb/# deb/' /etc/apt/sources.list.d/pve-enterprise.list

# add comunity repo
wget -O /etc/apt/sources.list.d/pve-community.list https://goo.gl/tYnGyt

# update
apt-get update && apt-get -y dist-upgrade

# grab updated templates
pveam update

Now reboot and then download the updated latest LXC templates with pveam update

Passthrough disks to containers

Rather than have individual image files for container disks, passthrough local folder structure (e.g. for media) to the container. See Promox Wiki Examples:

  • media root passthrough to the nfs server container
  • transcoding folder on a RAID0 SSD array passthrough to the plex container

To do this you need to edit the .conf file for the container ID in question (shown next to the name in the browser, usually starts at 100).

For example, to add /data/media as a mount from the host directly into the container with ID 100:

nano /etc/pve/lxc/101.conf
...
# Mount points zero-indexed, just increment by one if adding more
mp0: /data/media,mp=/data/media

NFS Shares

If you have a lxc container that you want to run as a nfs-kernel-server then the following files need to be edited:

  • LXC template
  • Apparmour (to allow clients to mount the exports)

Edit LXC config for NFS server container to allow install of packages

Known bug where nfs-kernel-server package will not install. See Launchpad

nano /etc/pve/lxc/[ID_OF_CONTAINER].conf
...
lxc.aa_profile: unconfined

Edit host Apparmour to allow for mounting in guests

# /etc/apparmour.d/lxc/lxc-default

profile lxc-container-default flags=(attach_disconnected,mediate_deleted) {
  ...
    mount options=(rw, ro, bind, noatime),
  ...

Enabling SSHFS (or other fuse modules) in container

Source: Proxmox forums

Need to run the following command as root inside the container to ensure fuse module is loaded

mknod -m 666 /dev/fuse c 10 229

This change is then lost on a restart of the container.... So create a systemd init service to do it on startup

[Unit]
Description=Workaround for LXC containers to run fuse
Before=network-online.target local-fs.target

[Service]
Type=oneshot
ExecStart=/bin/mknod -m 666 /dev/fuse c 10 229
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Create a cluster

Source: James Coyle

# Initial creation (first node)
pvecm create [CLUSTER_NAME]
pvecm status

# On second node
pvecm add [HOSTNAME_OF_CLUSTER_OR_IP_ADDRESS]

Now, remove the need for more than one node to be online at once (it's a homelab after all). Source serverfault. This stops the dreaded cluster not ready - no quorum?.

pvecm expected 1

Expand / resize filesystem

# pct resize <vmid> <disk> <size> [OPTIONS]
# disk can be: rootfs, mp0, mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9
pct resize 104 rootfs +20G
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment