#!/bin/bash # Filename: pve9-setup.sh # Perform basic config/tuning on a newly installed Proxmox v9.x host # Run this script only once! # # To run to run use one of the below commands: # wget -O - -q https://go.porna.net/go/pve9-setup.sh | bash # curl -s https://go.poorna.net/go/pve9-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' # Speed up ZFS at the cost of possible risk data loss on power loss echo 'Setting sync=disabled on rpool' zfs get sync rpool zfs set sync=disabled rpool zfs get sync rpool echo 'Setting atime=off on rpool' zfs get atime rpool zfs set atime=off rpool zfs get atime rpool echo 'Setting relatime=off on rpool' zfs get relatime rpool zfs set relatime=off rpool zfs get relatime rpool echo 'Updating PVE no-subscription lists' rm /etc/apt/sources.list.d/{pve-*,ceph*}.sources cat > /etc/apt/sources.list.d/pve-no-subscription.sources << EOF Types: deb URIs: http://download.proxmox.com/debian/pve Suites: trixie Components: pve-no-subscription Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg EOF cat > /etc/apt/sources.list.d/ceph-no-subscription.sources << EOF Types: deb URIs: http://download.proxmox.com/debian/ceph-squid Suites: trixie Components: no-subscription Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg EOF 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 nomodeset/' /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 echo 'Please reboot the Proxmox host now for the new settings to take effect.'