diff --git a/Bash/Proxmox Scripts/LXC Template/.gitignore b/Bash/Proxmox Scripts/LXC Template/.gitignore new file mode 100644 index 0000000..32c6491 --- /dev/null +++ b/Bash/Proxmox Scripts/LXC Template/.gitignore @@ -0,0 +1,3 @@ +# Your profiles can hold passwords and SSH keys: never commit them. +# The example (profile.conf.example) is not ignored. +*.conf diff --git a/Bash/Proxmox Scripts/LXC Template/create-lxc.sh b/Bash/Proxmox Scripts/LXC Template/create-lxc.sh new file mode 100755 index 0000000..02ea049 --- /dev/null +++ b/Bash/Proxmox Scripts/LXC Template/create-lxc.sh @@ -0,0 +1,2126 @@ +#!/bin/bash +# ============================================================================= +# Proxmox LXC Creator (Ubuntu / Debian) +# ============================================================================= +# +# Author: Alex Lane (modem7) - https://github.com/modem7 +# Licence: MIT - Copyright (c) 2026 Alex Lane +# Free to use, change and share. Keep this notice. +# Provided as-is, with no warranty. Full text: +# https://github.com/modem7/public_scripts/blob/master/LICENSE +# Repo: https://github.com/modem7/public_scripts +# Latest: https://github.com/modem7/public_scripts/blob/master/Bash/Proxmox%20Scripts/LXC%20Template/create-lxc.sh +# Issues: https://github.com/modem7/public_scripts/issues +# Support: https://www.buymeacoffee.com/modem7 +# +# SPDX-License-Identifier: MIT +# +# WHAT IT DOES +# Builds an Ubuntu or Debian container (LXC) on a Proxmox VE host. +# 1. Downloads the official Proxmox container template (pveam). +# 2. Creates the container and starts it. +# 3. Sets it up from the host: updates, packages, locale, time zone, +# plus any optional features you switch on in a profile. +# 4. Either leaves it running, ready to use, or cleans it and converts +# it to a Proxmox template you can clone (--template). +# +# OPTIONAL FEATURES +# Asked about in interactive runs, or set in a .conf profile. +# See "OPTIONAL FEATURES" below. +# ANSIBLE_USER, ADMIN_USER, ROOT_SSH_KEY, ZSH_DOTFILES, POSTFIX_RELAY, +# UNATTENDED_UPGRADES (+ UU_*), REMOVE_SNAPD, DISABLE_IPV6, +# PIP_BREAK_SYSTEM_PACKAGES, SUDO_COREDUMP_FIX, KEYCTL. +# All are off by default. +# +# Hooks, to add your own changes without editing this script: +# UPLOAD_FILES, PROVISION_SCRIPTS +# +# REQUIREMENTS +# - Run as root on a Proxmox VE host. +# - Internet access for the host (template download) and the container +# (packages). The container needs DHCP or a static IP that can reach +# the internet while it is being built. +# +# QUICK START +# First run ./create-lxc.sh +# Answer the prompts. Save a profile when asked. +# +# Re-run ./create-lxc.sh --config .conf +# +# By hand cp profile.conf.example my-lxc.conf (then edit it) +# +# Automated ./create-lxc.sh --config my-lxc.conf \ +# --unattended --ctid 53000 --auto-ctid --template +# +# All options ./create-lxc.sh --help +# +# CONTAINER ID CHEAT SHEET +# --ctid 53001 Use exactly 53001. Stop if taken. +# --auto-ctid Next free ID, starting at 100. +# --ctid 53000 --auto-ctid Next free ID, starting at 53000. +# +# LOGGING IN +# root has no password. From the host: pct enter +# Over SSH: set ROOT_SSH_KEY, ADMIN_USER or ANSIBLE_USER in a profile. +# +# FILES IT CREATES +#