nmis:provisioning_script
Table of Contents
installatie
context
dit document bevat een bash script (<ChatGPT) om Debian12 klaar te maken voor NMIS installatie.
#!/bin/bash # ========================================================== # NMIS 9.6.2 Prerequisites Setup Script for Debian 12 (Bookworm) # ========================================================== # This script prepares a clean Debian 12 system for installing NMIS 9.6.2. # It installs all necessary build tools, Perl dependencies, SNMP utilities, # and MongoDB 7.0 (officially supported by NMIS 9.6.2). # All actions and output are logged to /var/log/nmis9_provision.log # ========================================================== set -e # Exit immediately on error set -o pipefail # --- Logging setup ------------------------------------------------------------ LOGFILE="/var/log/nmis9_provision.log" exec > >(tee -a "$LOGFILE") 2>&1 echo "=====================================================================" echo " NMIS 9.6.2 Debian 12 Provisioning Script" echo " Log file: $LOGFILE" echo " Started on: $(date)" echo "=====================================================================" # --- Step 1: Update and upgrade system packages ------------------------------- echo "=== STEP 1: Update and upgrade system packages ===" apt update && apt full-upgrade -y # --- Step 2: Install general utilities ---------------------------------------- echo "=== STEP 2: Install general utilities ===" apt install -y curl wget gnupg lsb-release ca-certificates apt-transport-https # --- Step 3: Install build tools and Perl development libraries --------------- echo "=== STEP 3: Install build tools and Perl development libraries ===" apt install -y \ build-essential make gcc g++ \ libperl-dev perl-modules perl-doc \ libssl-dev libreadline-dev zlib1g-dev \ libsnmp-dev libxml-simple-perl libnet-snmp-perl \ libjson-xs-perl libdata-dumper-simple-perl \ libdbi-perl libdbd-mysql-perl \ libio-socket-ssl-perl libcrypt-ssleay-perl \ libmojolicious-perl libterm-readkey-perl \ cpanminus # --- Step 4: Install networking and SNMP utilities ---------------------------- echo "=== STEP 4: Install networking and SNMP utilities ===" apt install -y snmp snmpd netcat-openbsd fping iputils-ping traceroute unzip tar git # --- Step 5: Optional Apache web stack ---------------------------------------- echo "=== STEP 5: (Optional) Install Apache web server and mod_perl ===" # Comment out this line if you prefer to use NMIS's internal Mojolicious web service apt install -y apache2 libapache2-mod-perl2 # --- Step 6: Add official MongoDB 7.0 repository ------------------------------ echo "=== STEP 6: Add official MongoDB 7.0 repository ===" wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb-server-7.0.gpg echo "deb [signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg] https://repo.mongodb.org/apt/debian bookworm/mongodb-org/7.0 main" \ > /etc/apt/sources.list.d/mongodb-org-7.0.list # --- Step 7: Install MongoDB 7.0 ---------------------------------------------- echo "=== STEP 7: Install MongoDB 7.0 ===" apt update apt install -y mongodb-org # --- Step 8: Enable and start MongoDB service --------------------------------- echo "=== STEP 8: Enable and start MongoDB service ===" systemctl enable mongod systemctl start mongod # --- Step 9: Pre-install key Perl modules via cpanminus ----------------------- echo "=== STEP 9: Pre-install key Perl modules via cpanminus ===" cpanm \ Mojolicious \ Mojo::UserAgent \ Mojo::File \ Term::ReadKey \ Devel::Size \ File::Spec \ Sys::Hostname \ Data::Dumper \ JSON \ Config::Tiny # --- Step 10: Verify MongoDB service is active -------------------------------- echo "=== STEP 10: Verify MongoDB service is active ===" systemctl status mongod --no-pager || true # --- Step 11: Print summary --------------------------------------------------- echo echo "=====================================================================" echo " Debian 12 provisioning for NMIS 9.6.2 completed successfully!" echo " Log file saved at: $LOGFILE" echo echo "Next steps:" echo " 1. Download the NMIS installer:" echo " curl -O https://downloads.opmantek.com/install_nmis9" echo " 2. Make it executable and run:" echo " chmod +x install_nmis9 && sudo ./install_nmis9" echo echo "To review what happened:" echo " less $LOGFILE" echo echo "Finished on: $(date)" echo "====================================================================="
Problemen, problemen
- Open
/var/log/nmis9_provision.log
meer info
nmis/provisioning_script.txt · Last modified: by admin
