Skip to content

Instantly share code, notes, and snippets.

@rmb938
Last active October 19, 2024 17:30
Show Gist options
  • Save rmb938/47de40fefe71024ccc30c6029574aed8 to your computer and use it in GitHub Desktop.
Save rmb938/47de40fefe71024ccc30c6029574aed8 to your computer and use it in GitHub Desktop.
Bootstrap Proxmox Container Template Commands

Bootstrap

  1. Create Proxmox Container based on Ubuntu with SSH Key, not a password
    1. No IPv4, SLAAC for IPv6
  2. Modify container via host shell to add tun device, this will get copied when cloning /etc/pve/lxc/$ID.conf
    lxc.cgroup2.devices.allow: c 10:200 rwm
    lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
  3. Start Container
  4. In Proxmox host shell run lxc-info -n $ID to get IPv6 Address to ssh
  5. Commands to run in the bootstrap container template during first creation
    apt update
    apt upgrade
    apt install python3-launchpadlib ssh-import-id
    adduser --disabled-password --comment "" rbelgrave
    echo 'rbelgrave    ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/rbelgrave
    sudo -u rbelgrave ssh-import-id-lp rmb1993
    apt install curl net-tools
    curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/$(lsb_release -cs).noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
    curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/$(lsb_release -cs).tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
    apt update
    apt install tailscale
  6. Remove root authorized ssh key : > /root/.ssh/authorized_keys
  7. TODO: figure out how to regenerate ssh host keys
  8. Shutdown Container in Proxmox UI
  9. Convert to Template
@rmb938
Copy link
Author

rmb938 commented Oct 19, 2024

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