Last active
July 30, 2023 00:04
-
-
Save Rockz1152/16c9fd2bd0bacdceff2ff058bfba568c to your computer and use it in GitHub Desktop.
Setup script for Proxmox VE 8.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Modified script from: https://gist.github.com/ilude/32aec45964bc1207810f7e6e49544064 | |
# Copy and paste oneliner below to run | |
# curl -s https://gist.githubusercontent.com/Rockz1152/16c9fd2bd0bacdceff2ff058bfba568c/raw/proxmox_setup.sh | /bin/bash -s | |
# Check if Proxmox is installed | |
if [ ! -f /usr/bin/pvecm ]; then | |
echo "Proxmox is not installed" | |
exit 1 | |
fi | |
# Check Proxmox version | |
pveversion=$(pveversion 2>/dev/null) | |
if [ -z "$pveversion" ]; then | |
echo "Unable to determine Proxmox version" | |
exit 1 | |
fi | |
# Print Proxmox version | |
echo -e "\nProxmox version: $pveversion" | |
# Disable Commercial Repos | |
echo "Disabling subscription repos" | |
#sed -i "s/^deb/\#deb/" /etc/apt/sources.list.d/pve-enterprise.list | |
dpkg-divert --divert /etc/apt/sources.list.d/pve-enterprise.list.bak --rename --local /etc/apt/sources.list.d/pve-enterprise.list > /dev/null 2>/dev/null | |
dpkg-divert --divert /etc/apt/sources.list.d/ceph.list.bak --rename --local /etc/apt/sources.list.d/ceph.list > /dev/null 2>/dev/null | |
# Add PVE Community Repos | |
echo "Enabling community repos" | |
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 | |
echo "deb http://download.proxmox.com/debian/ceph-quincy $(grep "VERSION=" /etc/os-release | sed -n 's/.*(\(.*\)).*/\1/p') no-subscription" > /etc/apt/sources.list.d/ceph-no-enterprise.list | |
# Setup no nag script to run on upgrade | |
echo "Setting up 'no nag script'" | |
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 | |
#echo 'DPkg::Post-Invoke { "curl -s https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.sh | /bin/bash -s install || true"; };' > /etc/apt/apt.conf.d/99-proxmox-dark-theme | |
# Install updates | |
echo "Installing updates" | |
sleep 1 | |
echo '--apt-update' | |
apt-get -q update > /dev/null 2>/dev/null | |
echo '--htop' | |
apt-get install -q -y htop > /dev/null 2>/dev/null | |
echo '--apt-upgrade' | |
apt-get -q -y dist-upgrade > /dev/null 2>/dev/null | |
echo '--apt-autoremove' | |
apt-get autoremove -q -y > /dev/null 2>/dev/null | |
# Disable Kerberos authentication for sshd, this will speed up logins | |
echo 'Configuring SSH' | |
sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config | |
systemctl restart ssh | |
# Force post-invoke scripts to run | |
echo "Running post-invoke scripts" | |
apt-get --reinstall install -q -y proxmox-widget-toolkit > /dev/null 2>/dev/null | |
# Check if reboot is required | |
if [ -f /var/run/reboot-required ]; then | |
echo "Rebooting" | |
reboot | |
else | |
echo "Done" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment