kb:intranet:platforms:proxmox:lxc
LXC
https://www.reddit.com/r/Proxmox/comments/yy0kha/confused_on_when_to_use_vm_vs_lxc/
Changelog
- 2024-08-06: Init
Command-line interface
root:~# pveam available --section system system centos-9-stream-default_20221109_amd64.tar.xz system debian-11-standard_11.7-1_amd64.tar.zst system debian-12-standard_12.2-1_amd64.tar.zst ... root:~# pveam list local NAME SIZE local:vztmpl/alpine-3.19-default_20240207_amd64.tar.xz 2.84MB local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst 120.29MB
Well, it's possible to do it by CLI, but the web GUI is just much useful.
Useful commands:
- Copy file from host to container:
pct push <VMID> <FILE> <DESTINATION>
Set up scripts
From vanilla Debian:
root:~# apt update && apt upgrade root:~# apt install vim root:~# vim .bashrc # ll # Get IP address root:~# ip a # Stop SSH and Postfix services root:~# postfix stop root:~# systemctl stop sshd
Others
- LXC containers do not need passwords, since user already authenticated on host. Enter root shell using
lxc-attach <ID>
orpct enter <ID>
- Script provided by tteck himself to disable password authentication. Not tested.
- Alternatively, remove the password with
bash -c "passwd -d root"
.
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" mkdir -p $(dirname $GETTY_OVERRIDE) cat <<EOF >$GETTY_OVERRIDE [Service] ExecStart= ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM EOF systemctl daemon-reload systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
kb/intranet/platforms/proxmox/lxc.txt · Last modified: 2 months ago (24 February 2025) by justin