Skip to content

Instantly share code, notes, and snippets.

@luu123
Forked from ilude/proxmox-setup-notes.md
Created March 17, 2023 21:47
Show Gist options
  • Save luu123/1059d4ea4e9ee3e7a0a15b8ccf0358a5 to your computer and use it in GitHub Desktop.
Save luu123/1059d4ea4e9ee3e7a0a15b8ccf0358a5 to your computer and use it in GitHub Desktop.
How to setup a community version of Proxmox VE 5.x-7.x
# copy and paste oneliner below to run
# curl -s https://gist.github.com/ilude/32aec45964bc1207810f7e6e49544064/raw/proxmox_setup.sh?$(date +%s) | /bin/bash -s
# Disable Commercial Repo
sed -i "s/^deb/\#deb/" /etc/apt/sources.list.d/pve-enterprise.list
# Add PVE Community Repo
echo "deb http://download.proxmox.com/debian/pve $(grep "VERSION=" /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p') pve-no-subscription" > /etc/apt/sources.list.d/pve-no-enterprise.list
# setup no nag script to run on upgrade
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/99-proxmox-no-nag-script
# setup dark-theme to reinstall on upgrade
tee -a /etc/apt/apt.conf.d/99-proxmox-dark-theme >/dev/null <<'EOF'
DPkg::Post-Invoke { "wget https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.sh && bash PVEDiscordDark.sh install || true"; };
EOF
apt-get update
apt-get dist-upgrade -y
# disable kerbose authentication for sshd, this will speed up logins
sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
systemctl restart ssh
# force post-invoke scripts to run
apt --reinstall install proxmox-widget-toolkit
# keep a record of when the system was setup
date > /etc/birth_certificate
if [ -f /var/run/reboot-required ]; then
sudo reboot
fi
# barrowed from https://github.com/DeadlockState/Proxmox-prepare/blob/master/proxmox_prepare.sh
apt-get install -y fail2ban > /dev/null 2>&1
cd /etc/fail2ban/
touch jail.local
echo "[proxmox]
enabled = true
port = http,https,8006
filter = proxmox
logpath = /var/log/daemon.log
maxretry = 4
bantime = 43200" > jail.local
cd filter.d/
touch proxmox.conf
echo "[Definition]
failregex = pvedaemon\[.*authentication failure; rhost=<HOST> user=.* msg=.*
ignoreregex =" > proxmox.conf
service fail2ban restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment