Raja's Exocortex

Proxmox v8.x Base Setup

Run this bash script immediately after a new Proxmox v8.x installation to automate most of the best practices setup.

#!/bin/bash
# Filename: pve8-setup.sh
# Perform basic config/tuning on a newly installed Proxmox v8.x host
# Run this script only once!
#
# To run to run use one of the below commands:
# wget -O - -q https://static.rsubr.in/pve8-setup.sh | bash
# curl -s https://static.rsubr.in/pve8-setup.sh | bash

# Ensure that we are running on a proxmox host
if [ ! -f /usr/bin/pveversion ]; then
  echo 'This script is intended to run only on a Proxmox host'
  exit 1
fi

set -eoux pipefail

echo 'Setting up a new proxmox host'

echo 'Setting sync=disabled on rpool'
zfs get sync rpool
zfs set sync=disabled rpool
zfs get sync rpool


echo 'Updating PVE no-subscription lists'
rm /etc/apt/sources.list.d/{pve-*,ceph*}.list 

cat > /etc/apt/sources.list.d/pve-no-subscription.list <<EOT
# Filename: /etc/apt/sources.list.d/pve-no-subscription.list
# This is for Proxmox 8.x only
# Proxmox VE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription
EOT

cat > /etc/apt/sources.list.d/ceph.list <<EOT
# Filename: /etc/apt/sources.list.d/ceph.list
# This is for Proxmox 8.x only
deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription
EOT

echo 'Updating installed packages'
apt update; apt -y full-upgrade; apt clean

echo 'Setting optimal CPU settings'
sed -i ' 1 s/$/ cpufreq.default_governor=powersave mitigations=off/' /etc/kernel/cmdline
echo 'New /etc/kernel/cmdline'
cat /etc/kernel/cmdline
proxmox-boot-tool refresh 

echo 'Updating LXC templates'
pveam update

echo 'Downloading Ubuntu LXC templates'
pveam download local ubuntu-24.04-standard_24.04-2_amd64.tar.zst
pveam download local ubuntu-22.04-standard_22.04-1_amd64.tar.zst

echo 'Please reboot the Proxmox host now for the new settings to take effect.'