first commit
This commit is contained in:
0
proxmox1/akanealw/crontab.bak
Normal file
0
proxmox1/akanealw/crontab.bak
Normal file
25
proxmox1/root/crontab.bak
Normal file
25
proxmox1/root/crontab.bak
Normal file
@@ -0,0 +1,25 @@
|
||||
# Edit this file to introduce tasks to be run by cron.
|
||||
#
|
||||
# Each task to run has to be defined through a single line
|
||||
# indicating with different fields when the task will be run
|
||||
# and what command to run for the task
|
||||
#
|
||||
# To define the time you can provide concrete values for
|
||||
# minute (m), hour (h), day of month (dom), month (mon),
|
||||
# and day of week (dow) or use '*' in these fields (for 'any').
|
||||
#
|
||||
# Notice that tasks will be started based on the cron's system
|
||||
# daemon's notion of time and timezones.
|
||||
#
|
||||
# Output of the crontab jobs (including errors) is sent through
|
||||
# email to the user the crontab file belongs to (unless redirected).
|
||||
#
|
||||
# For example, you can run a backup of all your user accounts
|
||||
# at 5 a.m every week with:
|
||||
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
|
||||
#
|
||||
# For more information see the manual pages of crontab(5) and cron(8)
|
||||
#
|
||||
# m h dom mon dow command
|
||||
@reboot /root/scripts/ping-before-starting-cts-vms.sh
|
||||
30 12 * * * /root/scripts/rsync-import-debian-ubuntu-cloud-images.sh
|
||||
47
proxmox1/root/download-debian-ubuntu-cloud-images.sh
Normal file
47
proxmox1/root/download-debian-ubuntu-cloud-images.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /root/cloud-images
|
||||
|
||||
# remove old images
|
||||
rm * > /dev/null 2>&1
|
||||
|
||||
# debian 12 bookworm cloud
|
||||
wget -q https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.tar.xz
|
||||
tar -xvf debian-12-genericcloud-amd64.tar.xz
|
||||
mv disk.raw debian-12-generic-amd64.raw
|
||||
/usr/sbin/qm set 303 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --scsi0 local-zfs:0,import-from=/root/cloud-images/debian-12-generic-amd64.raw,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 303
|
||||
sleep 3
|
||||
|
||||
# ubuntu jammy 22.04
|
||||
wget -q -O ubuntu-22.04-server-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
|
||||
/usr/sbin/qm set 314 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-server-cloudimg-amd64.qcow2,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 314
|
||||
sleep 3
|
||||
|
||||
# ubuntu jammy 22.04 minimal
|
||||
wget -q -O ubuntu-22.04-minimal-cloudimg-amd64.qcow2 https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
|
||||
/usr/sbin/qm set 315 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 315
|
||||
sleep 3
|
||||
13
proxmox1/root/ping-before-start.sh
Normal file
13
proxmox1/root/ping-before-start.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
until ping -c1 192.168.1.41 >/dev/null 2>&1; do :; done
|
||||
sleep 45
|
||||
mount -t nfs 192.168.1.41:/mnt/data/media /mnt/truenasmedia
|
||||
sleep 15
|
||||
/usr/sbin/pct start 100
|
||||
sleep 15
|
||||
/usr/sbin/pct start 102
|
||||
sleep 15
|
||||
/usr/sbin/pct start 107
|
||||
sleep 15
|
||||
/usr/sbin/qm start 200
|
||||
11
proxmox1/root/ping-before-starting-cts-vms.sh
Executable file
11
proxmox1/root/ping-before-starting-cts-vms.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
until ping -c1 192.168.1.41 >/dev/null 2>&1; do :; done
|
||||
sleep 45
|
||||
mount -t nfs 192.168.1.41:/mnt/data/media /mnt/truenasmedia
|
||||
sleep 15
|
||||
/usr/sbin/pct start 102
|
||||
sleep 15
|
||||
/usr/sbin/pct start 107
|
||||
sleep 15
|
||||
/usr/sbin/qm start 200
|
||||
140
proxmox1/root/proxmox-kernel-clean.sh
Executable file
140
proxmox1/root/proxmox-kernel-clean.sh
Executable file
@@ -0,0 +1,140 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2023 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
cat <<"EOF"
|
||||
__ __ __ ________
|
||||
/ //_/__ _________ ___ / / / ____/ /__ ____ _____
|
||||
/ ,< / _ \/ ___/ __ \/ _ \/ / / / / / _ \/ __ `/ __ \
|
||||
/ /| / __/ / / / / / __/ / / /___/ / __/ /_/ / / / /
|
||||
/_/ |_\___/_/ /_/ /_/\___/_/ \____/_/\___/\__,_/_/ /_/
|
||||
|
||||
EOF
|
||||
}
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit nullglob
|
||||
YW=$(echo "\033[33m")
|
||||
BL=$(echo "\033[36m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
BGN=$(echo "\033[4;92m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
DGN=$(echo "\033[32m")
|
||||
CL=$(echo "\033[m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
CROSS="${RD}✗${CL}"
|
||||
PARTY="🎉"
|
||||
current_kernel=$(uname -r)
|
||||
clear
|
||||
header_info
|
||||
while true; do
|
||||
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) exit ;;
|
||||
*) echo -e "${RD}Please answer y/n${CL}" ;;
|
||||
esac
|
||||
done
|
||||
clear
|
||||
function msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
}
|
||||
|
||||
function msg_ok() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
function check_root() {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
|
||||
exit 1
|
||||
else
|
||||
header_info
|
||||
other_kernel
|
||||
kernel_info
|
||||
kernel_clean
|
||||
fi
|
||||
}
|
||||
|
||||
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
|
||||
function other_kernel() {
|
||||
if [[ "${VERSION}" == "bullseye" ]]; then
|
||||
if [[ "$current_kernel" == *"edge"* ]]; then
|
||||
echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
|
||||
echo -e "\nAn Active PVE Kernel is required to use Kernel Clean\n"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$current_kernel" == *"6.1"* || "$current_kernel" == *"6.2"* ]]; then
|
||||
echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
|
||||
echo -e "\nThe script cannot be used when running opt-in kernels. \nProxmox VE's package management relies directly on the current default kernel, which is 5.15. \nTherefore, it is not possible to utilize this script. In this case, you should use autoremove instead. \n`apt-get autoremove`\n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function kernel_info() {
|
||||
if [[ "$MODE" != "PBS" ]]; then
|
||||
echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}"
|
||||
fi
|
||||
if [[ "$current_kernel" == *"pve"* ]]; then
|
||||
echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}"
|
||||
else
|
||||
echo -e "\n${CROSS} ${RD}ERROR: No PVE Kernel Found\n${CL}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function kernel_clean() {
|
||||
kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
|
||||
remove_kernels=""
|
||||
for kernel in $kernels; do
|
||||
if [ "$(echo $kernel | grep $current_kernel)" ]; then
|
||||
break
|
||||
else
|
||||
echo -e "${BL}'$kernel' ${CL}${YW}has been added to the remove Kernel list\n${CL}"
|
||||
remove_kernels+=" $kernel"
|
||||
fi
|
||||
done
|
||||
msg_ok "Kernel Search Completed\n"
|
||||
if [[ "$remove_kernels" != *"pve"* ]]; then
|
||||
echo -e "${PARTY} ${GN}It appears there are no old Kernels on your system. \n${CL}"
|
||||
msg_info "Exiting"
|
||||
sleep 2
|
||||
msg_ok "Done"
|
||||
else
|
||||
read -p "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
|
||||
/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
|
||||
msg_ok "Successfully Removed Kernels"
|
||||
msg_info "Updating GRUB"
|
||||
/usr/sbin/update-grub >/dev/null 2>&1
|
||||
msg_ok "Successfully Updated GRUB"
|
||||
msg_info "Exiting"
|
||||
sleep 2
|
||||
msg_ok "Done"
|
||||
else
|
||||
msg_info "Exiting"
|
||||
sleep 2
|
||||
msg_ok "Done"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if ! command -v pveversion >/dev/null 2>&1; then
|
||||
echo -e " Switching to PBS mode"
|
||||
MODE="PBS"
|
||||
sleep 2
|
||||
else
|
||||
MODE="PVE"
|
||||
fi
|
||||
|
||||
check_root
|
||||
243
proxmox1/root/proxmox-post-pve-install.sh
Executable file
243
proxmox1/root/proxmox-post-pve-install.sh
Executable file
@@ -0,0 +1,243 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2023 tteck
|
||||
# Author: tteck (tteckster)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
header_info() {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
____ _ ________ ____ __ ____ __ ____
|
||||
/ __ \ | / / ____/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||
/ /_/ / | / / __/ / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ `/ / /
|
||||
/ ____/| |/ / /___ / ____/ /_/ (__ ) /_ _/ // / / (__ ) /_/ /_/ / / /
|
||||
/_/ |___/_____/ /_/ \____/____/\__/ /___/_/ /_/____/\__/\__,_/_/_/
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
RD=$(echo "\033[01;31m")
|
||||
YW=$(echo "\033[33m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
CL=$(echo "\033[m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
CROSS="${RD}✗${CL}"
|
||||
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit nullglob
|
||||
|
||||
msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
}
|
||||
|
||||
msg_ok() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
msg_error() {
|
||||
local msg="$1"
|
||||
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||
}
|
||||
|
||||
start_routines() {
|
||||
header_info
|
||||
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
|
||||
if lscpu | grep -qP 'Vendor ID:.*GenuineIntel' && lscpu | grep -qP 'Model name:.*N' && [[ "$VERSION" == "bullseye" ]]; then
|
||||
whiptail --msgbox --title "N-SERIES PROCESSOR DETECTED" "To ensure compatibility with Proxmox VE on systems equipped with N-series processors, it is recommended to install Proxmox Virtual Environment 8" 10 58
|
||||
fi
|
||||
|
||||
CHOICE=$(whiptail --title "SOURCES" --menu "The package manager will use the correct sources to update and install packages on your Proxmox VE server.\n \nCorrect Proxmox VE sources?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Correcting Proxmox VE Sources"
|
||||
cat <<EOF >/etc/apt/sources.list
|
||||
deb http://ftp.debian.org/debian ${VERSION} main contrib
|
||||
deb http://ftp.debian.org/debian ${VERSION}-updates main contrib
|
||||
deb http://security.debian.org/debian-security ${VERSION}-security main contrib
|
||||
EOF
|
||||
msg_ok "Corrected Proxmox VE Sources"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Correcting Proxmox VE Sources"
|
||||
;;
|
||||
esac
|
||||
|
||||
CHOICE=$(whiptail --title "PVE-ENTERPRISE" --menu "The 'pve-enterprise' repository is only available to users who have purchased a Proxmox VE subscription.\n \nDisable 'pve-enterprise' repository?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Disabling 'pve-enterprise' repository"
|
||||
cat <<EOF >/etc/apt/sources.list.d/pve-enterprise.list
|
||||
# deb https://enterprise.proxmox.com/debian/pve ${VERSION} pve-enterprise
|
||||
EOF
|
||||
msg_ok "Disabled 'pve-enterprise' repository"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Disabling 'pve-enterprise' repository"
|
||||
;;
|
||||
esac
|
||||
|
||||
CHOICE=$(whiptail --title "PVE-NO-SUBSCRIPTION" --menu "The 'pve-no-subscription' repository provides access to all of the open-source components of Proxmox VE.\n \nEnable 'pve-no-subscription' repository?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Enabling 'pve-no-subscription' repository"
|
||||
cat <<EOF >/etc/apt/sources.list.d/pve-install-repo.list
|
||||
deb http://download.proxmox.com/debian/pve ${VERSION} pve-no-subscription
|
||||
EOF
|
||||
msg_ok "Enabled 'pve-no-subscription' repository"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Enabling 'pve-no-subscription' repository"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${VERSION}" == "bookworm" ]]; then
|
||||
CHOICE=$(whiptail --title "CEPH PACKAGE REPOSITORIES" --menu "The 'Ceph Package Repositories' provides access to both the 'no-subscription' and 'enterprise' repositories.\n \nEnable 'ceph package repositories?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Enabling 'ceph package repositories'"
|
||||
cat <<EOF >/etc/apt/sources.list.d/ceph.list
|
||||
# deb http://download.proxmox.com/debian/ceph-quincy bookworm enterprise
|
||||
deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription
|
||||
EOF
|
||||
msg_ok "Enabled 'ceph package repositories'"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Enabling 'ceph package repositories'"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
CHOICE=$(whiptail --title "PVETEST" --menu "The 'pvetest' repository can give advanced users access to new features and updates before they are officially released.\n \nAdd (Disabled) 'pvetest' repository?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Adding 'pvetest' repository and set disabled"
|
||||
cat <<EOF >/etc/apt/sources.list.d/pvetest-for-beta.list
|
||||
# deb http://download.proxmox.com/debian/pve ${VERSION} pvetest
|
||||
EOF
|
||||
msg_ok "Added 'pvetest' repository"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Adding 'pvetest' repository"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f /etc/apt/apt.conf.d/no-nag-script ]]; then
|
||||
CHOICE=$(whiptail --title "SUBSCRIPTION NAG" --menu "This will disable the nag message reminding you to purchase a subscription every time you log in to the web interface.\n \nDisable subscription nag?" 14 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
whiptail --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58
|
||||
msg_info "Disabling subscription nag"
|
||||
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/no-nag-script
|
||||
apt --reinstall install proxmox-widget-toolkit &>/dev/null
|
||||
msg_ok "Disabled subscription nag (Delete browser cache)"
|
||||
;;
|
||||
no)
|
||||
whiptail --msgbox --title "Support Subscriptions" "Supporting the software's development team is essential. Check their official website's Support Subscriptions for pricing. Without their dedicated work, we wouldn't have this exceptional software." 10 58
|
||||
msg_error "Selected no to Disabling subscription nag"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! systemctl is-active --quiet pve-ha-lrm; then
|
||||
CHOICE=$(whiptail --title "HIGH AVAILABILITY" --menu "Enable high availability?" 10 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Enabling high availability"
|
||||
systemctl enable -q --now pve-ha-lrm
|
||||
systemctl enable -q --now pve-ha-crm
|
||||
systemctl enable -q --now corosync
|
||||
msg_ok "Enabled high availability"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Enabling high availability"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if systemctl is-active --quiet pve-ha-lrm; then
|
||||
CHOICE=$(whiptail --title "HIGH AVAILABILITY" --menu "If you plan to utilize a single node instead of a clustered environment, you can disable unnecessary high availability (HA) services, thus reclaiming system resources.\n\nIf HA becomes necessary at a later stage, the services can be re-enabled.\n\nDisable high availability?" 18 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Disabling high availability"
|
||||
systemctl disable -q --now pve-ha-lrm
|
||||
systemctl disable -q --now pve-ha-crm
|
||||
systemctl disable -q --now corosync
|
||||
msg_ok "Disabled high availability"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Disabling high availability"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
CHOICE=$(whiptail --title "UPDATE" --menu "\nUpdate Proxmox VE now?" 11 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Updating Proxmox VE (Patience)"
|
||||
apt-get update &>/dev/null
|
||||
apt-get -y dist-upgrade &>/dev/null
|
||||
msg_ok "Updated Proxmox VE"
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Updating Proxmox VE"
|
||||
;;
|
||||
esac
|
||||
|
||||
CHOICE=$(whiptail --title "REBOOT" --menu "\nReboot Proxmox VE now? (recommended)" 11 58 2 \
|
||||
"yes" " " \
|
||||
"no" " " 3>&2 2>&1 1>&3)
|
||||
case $CHOICE in
|
||||
yes)
|
||||
msg_info "Rebooting Proxmox VE"
|
||||
sleep 2
|
||||
msg_ok "Completed Post Install Routines"
|
||||
reboot
|
||||
;;
|
||||
no)
|
||||
msg_error "Selected no to Rebooting Proxmox VE (Reboot recommended)"
|
||||
msg_ok "Completed Post Install Routines"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
header_info
|
||||
echo -e "\nThis script will Perform Post Install Routines.\n"
|
||||
while true; do
|
||||
read -p "Start the Proxmox VE Post Install Script (y/n)?" yn
|
||||
case $yn in
|
||||
[Yy]*) break ;;
|
||||
[Nn]*) clear; exit ;;
|
||||
*) echo "Please answer yes or no." ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! command -v pveversion >/dev/null 2>&1; then
|
||||
header_info
|
||||
msg_error "\n No PVE Detected!\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
start_routines
|
||||
73
proxmox1/root/proxmox-pve-essentials.sh
Executable file
73
proxmox1/root/proxmox-pve-essentials.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
# autoreply config update dialog with no
|
||||
if [[ ! -f /etc/apt/apt.conf.d/local ]] ; then
|
||||
echo "Dpkg::Options {" >> /etc/apt/apt.conf.d/local
|
||||
echo " "--force-confdef";" >> /etc/apt/apt.conf.d/local
|
||||
echo " "--force-confold";" >> /etc/apt/apt.conf.d/local
|
||||
echo "}" >> /etc/apt/apt.conf.d/local
|
||||
fi
|
||||
|
||||
# update and upgrade
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
|
||||
# download and install packages
|
||||
apt-get install -y sudo curl wget zip unzip git man-db cifs-utils nfs-common ntfs-3g parted libtalloc2 libwbclient0 net-tools gnupg apt-transport-https tmux gdisk bash-completion
|
||||
|
||||
# update templates
|
||||
pveam update
|
||||
|
||||
# remove all motd
|
||||
rm /etc/motd > /dev/null 2>&1
|
||||
|
||||
# set input preferences
|
||||
if [[ ! -f /etc/inputrc.bak ]] ; then
|
||||
cp /etc/inputrc /etc/inputrc.bak > /dev/null 2>&1
|
||||
fi
|
||||
rm /etc/inputrc > /dev/null 2>&1
|
||||
cp /etc/inputrc.bak /etc/inputrc
|
||||
echo "" >> /etc/inputrc
|
||||
echo "set completion-ignore-case On" >> /etc/inputrc
|
||||
|
||||
# set bash preferences and aliases
|
||||
if [[ -f /etc/bash.bashrc.default ]] ; then
|
||||
mv /etc/bash.bashrc.default /etc/bash.bashrc.bak > /dev/null 2>&1
|
||||
fi
|
||||
if [[ ! -f /etc/bash.bashrc.bak ]] ; then
|
||||
cp /etc/bash.bashrc /etc/bash.bashrc.bak > /dev/null 2>&1
|
||||
fi
|
||||
rm /etc/bash.bashrc > /dev/null 2>&1
|
||||
cp /etc/bash.bashrc.bak /etc/bash.bashrc
|
||||
echo "" >> /etc/bash.bashrc
|
||||
echo "# custom settings and aliases" >> /etc/bash.bashrc
|
||||
echo "set -o noclobber" >> /etc/bash.bashrc
|
||||
echo "alias lsa='ls -alhvF'" >> /etc/bash.bashrc
|
||||
echo "alias systart='sudo systemctl start'" >> /etc/bash.bashrc
|
||||
echo "alias systop='sudo systemctl stop'" >> /etc/bash.bashrc
|
||||
echo "alias sysrest='sudo systemctl restart'" >> /etc/bash.bashrc
|
||||
echo "alias systat='sudo systemctl status'" >> /etc/bash.bashrc
|
||||
echo "alias aptupy='sudo apt update && sudo apt upgrade -y'" >> /etc/bash.bashrc
|
||||
echo "alias aptiy='sudo apt install -y'" >> /etc/bash.bashrc
|
||||
echo "alias aptry='sudo apt remove -y'" >> /etc/bash.bashrc
|
||||
echo "alias aptrpy='sudo apt remove --purge -y'" >> /etc/bash.bashrc
|
||||
echo "alias aptary='sudo apt autoremove -y'" >> /etc/bash.bashrc
|
||||
echo "alias apts='sudo apt search'" >> /etc/bash.bashrc
|
||||
echo "alias aptl='sudo apt list --installed'" >> /etc/bash.bashrc
|
||||
echo "alias aptsh='sudo apt show'" >> /etc/bash.bashrc
|
||||
echo "alias aptac='sudo apt-get autoclean'" >> /etc/bash.bashrc
|
||||
echo "alias dpkgi='sudo dpkg -i'" >> /etc/bash.bashrc
|
||||
echo "alias tmxls='tmux ls'" >> /etc/bash.bashrc
|
||||
echo "alias tmxa='tmux attach -t'" >> /etc/bash.bashrc
|
||||
|
||||
# create tmux config
|
||||
rm /etc/tmux.conf* > /dev/null 2>&1
|
||||
echo "unbind C-b" >> /etc/tmux.conf
|
||||
echo "set-option -g prefix C-a" >> /etc/tmux.conf
|
||||
echo "bind-key C-a send-prefix" >> /etc/tmux.conf
|
||||
|
||||
# git config
|
||||
git config --global credential.helper store
|
||||
git config --global user.name "akanealw"
|
||||
git config --global user.email "akanealw@gmail.com"
|
||||
git config --global init.defaultBranch main
|
||||
49
proxmox1/root/rsync-import-debian-ubuntu-cloud-images.sh
Executable file
49
proxmox1/root/rsync-import-debian-ubuntu-cloud-images.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /root/cloud-images
|
||||
|
||||
# remove old images
|
||||
rm * > /dev/null 2>&1
|
||||
|
||||
rsync -avz root@proxmox2:/root/cloud-images/*.tar.xz /root/cloud-images/
|
||||
rsync -avz root@proxmox2:/root/cloud-images/*.qcow2 /root/cloud-images/
|
||||
|
||||
|
||||
# debian 12 bookworm cloud
|
||||
tar -xvf debian-12-genericcloud-amd64.tar.xz
|
||||
mv disk.raw debian-12-generic-amd64.raw
|
||||
/usr/sbin/qm set 303 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --scsi0 local-zfs:0,import-from=/root/cloud-images/debian-12-generic-amd64.raw,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 303 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 303
|
||||
sleep 3
|
||||
|
||||
# ubuntu jammy 22.04
|
||||
/usr/sbin/qm set 314 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-server-cloudimg-amd64.qcow2,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 314 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 314
|
||||
sleep 3
|
||||
|
||||
# ubuntu jammy 22.04 minimal
|
||||
/usr/sbin/qm set 315 --delete scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --delete unused0
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --scsi0 local-zfs:0,import-from=/root/cloud-images/ubuntu-22.04-minimal-cloudimg-amd64.qcow2,discard=on,ssd=1
|
||||
sleep 3
|
||||
/usr/sbin/qm set 315 --boot order=scsi0
|
||||
sleep 3
|
||||
/usr/sbin/qm cloudinit update 315
|
||||
sleep 3
|
||||
curl -fsS -m 10 --retry 5 -o /dev/null https://uptimekuma.akanealw.com/api/push/HFKN90p5e9?status=up&msg=OK&ping=
|
||||
Reference in New Issue
Block a user