/proxmoxhelperscripts

My Proxmox HelperScripts

Primary LanguageShellMIT LicenseMIT

Proxmox Helperscripts

Datacenter  
└── PVE  
    ├── LXC1  
    ├── ...  
    └── LXCn

🚀 Getting Started

To download the scripts to your system:

  1. Navigate to your home directory.
  2. Open a terminal and paste the comand curl -sL "https://raw.githubusercontent.com/git24chris/proxmoxhelperscripts/main/get_scripts.sh" -o "get_scripts.sh" && chmod +x "get_scripts.sh"
  3. Hit Enter to execute the command. This will create an executable script called get_scripts.sh in your /root or home directory.
  4. Execute the script with ./get_scripts.sh. It will create a full directory structure, and scripts will be downloaded from GitHub into a folder named scripts in either your root or home directory.
  5. Run the script on PVE to access the PVE-level scripts, or run it inside an LXC to access the scripts for LXCs.

Scripts are organized into:

~home
├── pbs-root
├── pve-root
└── container

🪄 Hint:   Consider running get_scripts.sh again at any time in order to update your local scripts with the latest version. 


⚙️ PBS Level Scripts (root)

autoupdate_pbs.sh

Automates updates for Proxmox Backup Server via cron jobs.

  • Location of the script: /root/scripts/pbs-root
  • Runs dist-upgrade to update Proxmox.
  • Logs: /var/log/autoupdate_pbs.log
  • Local copy: A timestamped file is created in the root or home directory.
  • Requires cron for full automation; a cron config example is in the script header.
  • If there are kernel updates, the server will be rebooted.

⚙️ PVE Level Scripts (root)

Autoupdates

autoupdate_proxmox.sh

Automates updates for Proxmox via cron jobs.

  • Location of the script: /root/scripts/pve-root
  • Runs dist-upgrade to update Proxmox.
  • Forced update the list of templates offered for LXC creation.
  • Logs: /var/log/autoupdate_proxmox.log
  • Local copy: A timestamped file is created in the root or home directory.
  • Requires cron for full automation; a cron config example is in the script header.
  • If there are kernel updates, the server will be rebooted.

autoupdate_lxcs.sh

Updates all running LXC containers: apt-get update && apt-get upgrade && apt-get autoremove alternatively use unattended_upgrades

  • Location of the script: /root/scripts/pve-root
  • Logs: /var/log/autoupdate_lxcs.log
  • Summary file: Timestamp and container details are stored in the root or user's home directory.
  • Requires cron for full automation; a cron config example is in the script header.
  • Only affects actively running containers.

msmtp_setup.sh

Configures smtp to sent emails

  • Location of the script: /root/scripts/pve-root
  • Interactive setup: Just enter your mail provider credentials.
  • Safe to re-run for updates or to correct wrong input.

setup_gotify_reporting.sh

Configures msmtp to sent Gotify notification and emails

  • Location of the script: ~/scripts/container
  • configures gotify, redirects an email gotify@localhost to Gotify-App
  • configures email address to send email
  • configures unattended upgrades to inform per gotify or email, errors only or all

patch_lxc_armor.sh

Updates every lxc configuration

  • Location of the script: ~/scripts/pve-root
  • update parameters inside script, in this case deactivate apparmor settings which prevent docker to wrok properly
  • script can be used to update other parameter in <lxc_number>.conf
  • can be run each time a new lxc will be added, works idempotent

Autobackup & Manual Restore

pve_backup_restore_pbs.sh

Interactive tool to select and execute updates and restores. is batch-ready to include backups per cron schedule.

  • Preprequisites an installed PBS.
  • Select and backup local configuration
  • Only affects the configured PVE environment; does not back up CTs/VMs.
  • Requires cron for full automation; a cron config example is in the script header.
  • Restore to /tmp for inspection after selection the desired repository on PBS
  • Disaster restore system configuration after PVE system reinstall
  • for restore the PVE configuration select the timestamp/repository you would like to have restored. WARNING: The current installation will be overridden and the server need to be rebooted if you choose to proceed.
  • Logfile: /var/log/pve_backup_restore_pbs.log

⚙️ LXC Container Scripts

create_login_info.sh

Displays system info during shell login.

  • Location of the script: ~/scripts/container
  • Creates /etc/config.d/show_info.sh
  • Info shown:
    • Storage: mountpoint, size, usage
    • Network: IP, DNS, DHCP
    • System: CPU, RAM, time (UTC)
    • User: sudo eligibility, SSH eligibility
  • Optional welcome file (welcome.txt) for custom messages or LXC information.
  • root account lists all registered userids of the LXC.
  • you need to re-login for the effect.

lxc_postinstallation.sh

ensures locale settings are set: language, timezone

offers to install typcial tools used or are necessary

  • Location of the script: ~/scripts/container
  • run after container creation, or wheneever you like to change or update locales
  • interactive application
  • choose right locale (UTF-8) to ensure Terminal Software does the terminal encoding right
  • approve timezone proposal, chose UTC, or enter your own
  • confirm to-be-changes before implementation

unattended_upgrade_configurator.sh

setup unattended upgrade (automation) offers to install unattended_upgrades if necessary

  • Location of the script: ~/scripts/container
  • run after lxc_postinstallation, interactive application
  • configures options in unattended upgrades, select repositories,
  • configures email alerting (option via Gotify)
  • confirm to-be-changes before implementation

👤 User Management

user_management.sh

  • Location of the script: ~/scripts/container
  • Interactive application
  • Create, Remove user cleanly, SSH config, enable SUDO, home directory.
  • Show list of registered users
  • Maintain passwords

🐳 Docker, Portainer, Portainer_Agent Script

docker_manger.sh

  • Location of the script: ~/scripts/container

  • Install, update, remove docker environment.

  • in case of unattended-upgrades, docker repository will be added to whitelist of updates in case of installation/updates, and will be removed in case docker will be removed

  • Install, update, remove portainer (port parameter can be edited in docker_manager.sh).

  • Install, update, remove portainer_agent (port parameter can be edited in docker_manager.sh).

  • docker run -d \
      -p 9001:9001 \
      --name portainer_agent \
      --restart=always \
      -v /var/run/docker.sock:/var/run/docker.sock \
      -v /var/lib/docker/volumes:/var/lib/docker/volumes \
      -v /:/host \
      portainer/agent:lts
    

Note: Using lts as the version is a trial to avoid updating the script each time. This section will be updated once it's confirmed if this approach works.


otel_collector_setup.sh (deprecated)

  • Location of the script: ~/scripts/container

  • run to setup monitoring configuration for Signoz

promtail_setup.sh (deprecated)

  • Location of the script: ~/scripts/container

  • run to setup monitoring configuration for Loki/Grafana

checkmk_agent_setup.sh

  • Location of the script: ~/scripts/container

  • run to install/remove agent for collecting telemetry information for CheckMK monitoring server


📜 License

Released under the MIT License.

You’re free to Use, Modify, and Redistribute. ⚠️ No warranties or liabilities included.

See the full license in the LICENSE file.