Skip to content
Permalink
Browse files

Bring base to Docker

  • Loading branch information...
Cat5TV committed Aug 21, 2019
1 parent 9b87de0 commit 0458e17ec5093b2b98d853d187080249ccd22e4a
Showing with 51 additions and 76 deletions.
  1. +2 −0 build/{153-mysql → 034-mariadb}
  2. +0 −3 build/045-nagios
  3. +21 −28 build/046-plugins-prep
  4. +1 −0 build/047-nrpe
  5. +5 −14 build/packages.add
  6. +21 −30 nems-build.sh
  7. +1 −1 nems-cleanup.sh
@@ -1,6 +1,8 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

apt-get install -y mariadb-server

# Replace the database with Sample database
/bin/systemctl stop mysql
rm -rf /var/lib/mysql/
@@ -52,9 +52,6 @@ fi

# Finished installing Nagios Core

# Install some needed extras
apt install -y nagios-nrpe-plugin nagios-nrpe-server nagios-images

# Set the nagios user shell
usermod -s /bin/bash nagios

@@ -3,38 +3,36 @@ echo $0 > /var/www/html/userfiles/nems-build.cur

# This script cleans up / removes all installed Nagios plugins to prepare for installation/re-installation

# Remove old apt installed version
# Ensure apt installed versions don't exist
apt -y remove --purge monitoring-plugins*

apt -y remove --purge nagios-nrpe-plugin

apt -y autoremove

# Install dependencies
# Doing one per apt instance to avoid it failing if one package is missing
apt update
apt install -y libnet-snmp-perl
apt install -y snmp
apt install -y snmpd
apt install -y snmp-mibs-downloader
apt install -y dnsutils
apt install -y fping
apt install -y iputils-ping
apt install -y libfreeradius-client-dev
apt install -y libldap2-dev
apt install -y default-libmysqlclient-dev
apt install -y libdbi-dev
apt install -y libdbi-perl
apt install -y smbclient
apt install -y qstat
apt install -y openssl
apt install -y openssl-devel
apt install -y gettext
apt install -y openssl
apt-get update
apt-get install -y libnet-snmp-perl
apt-get install -y snmp
apt-get install -y snmpd
apt-get install -y snmp-mibs-downloader
apt-get install -y dnsutils
apt-get install -y fping
apt-get install -y iputils-ping
apt-get install -y libfreeradius-client-dev
apt-get install -y libldap2-dev
apt-get install -y default-libmysqlclient-dev
apt-get install -y libdbi-dev
apt-get install -y libdbi-perl
apt-get install -y smbclient
apt-get install -y qstat
apt-get install -y openssl
apt-get install -y openssl-devel
apt-get install -y gettext
apt-get install -y openssl

# Install PostgreSQL development libraries so
# check_psql (monitoring-plugins) can compile
apt install -y libpq-dev
apt-get install -y libpq-dev



@@ -59,8 +57,3 @@ echo $0 > /var/www/html/userfiles/nems-build.cur
ln -s /usr/lib/nagios/plugins /usr/local/nagios/libexec
fi

# Reinstall check_nrpe, which will now pop into the correct folder due to the symlink
if [[ ! -e /usr/lib/nagios/plugins/check_nrpe ]]; then
apt install -y nagios-nrpe-plugin
fi

@@ -6,6 +6,7 @@ nrpeVer="3.2.1"
APT_LISTCHANGES_FRONTEND=cat
echo $0 > /var/www/html/userfiles/nems-build.cur
/bin/systemctl stop nrpe
# these plugins shouldn't even exist anymore since they were pulled from packages.add and 045-nagios
yes | apt remove --purge nagios-nrpe-plugin
yes | apt remove --purge nagios-nrpe-server
yes | apt autoremove
@@ -1,8 +1,5 @@
# NEMS Linux - nemslinux.com
# This is the package list to install on all platforms
apache2
avahi-dnsconfd
avahi-utils
build-essential
ca-certificates
cifs-utils
@@ -13,19 +10,13 @@ hdparm
htop
iotop
keyboard-configuration
libapache2-mod-python
libapache2-mod-security2
libcryptsetup4
libgcrypt20
libsqlite3-0
lm-sensors
lua5.1
luajit
lua-sec
mariadb-server
monit
#monitoring-plugins
monitorix
openssl
perl
perl-base
@@ -44,8 +35,6 @@ tzdata
unzip
vim
w3m
webmin
wpasupplicant
ntp
locate

@@ -70,18 +59,20 @@ hddtemp

# For Nagios Core
libgd-dev
# nagios-images -- part of nems-www now
#nagios-nrpe-plugin -- orphaned. Compile from github instead
#nagios-nrpe-server

# *.local Resolution
avahi-dnsconfd
avahi-utils
avahi-daemon
libnss-mdns

# Apache2 dependencies
apache2
libapache2-modsecurity
modsecurity-crs
php-curl
libapache2-mod-python
libapache2-mod-security2

# NEMS

@@ -103,45 +103,36 @@ cd /root/nems/nems-admin

echo "" > /tmp/errors.log

# Don't do this for Docker - Keep Docker as slim as possible (No need to install Distro base)
if (( $1 != 21 )); then

echo "Usage before build:"
df -hT /etc
sleep 5

# Remove cruft
apt update
apt -y --allow-remove-essential clean
apt -y --allow-remove-essential --purge remove $(grep -vE "^\s*#" build/packages.remove | tr "\n" " ")
apt autoremove --purge -y
rm -R /usr/share/fonts/*
rm -R /usr/share/icons/*
echo "Usage before build:"
df -hT /etc
sleep 5

# Fix any broken packages to allow installation to occur in next step
apt -y --fix-broken install
# Remove cruft
apt update
apt -y --allow-remove-essential clean
apt -y --allow-remove-essential --purge remove $(grep -vE "^\s*#" build/packages.remove | tr "\n" " ")
apt autoremove --purge -y
rm -R /usr/share/fonts/*
rm -R /usr/share/icons/*

echo "Usage after cruft removal:"
df -hT /etc
sleep 5
# Fix any broken packages to allow installation to occur in next step
apt -y --fix-broken install

fi
echo "Usage after cruft removal:"
df -hT /etc
sleep 5

# Install base packages (This will happen on all platforms including Docker)
# Install base packages
for pkg in $(grep -vE "^\s*#" build/packages.base | tr "\n" " ")
do
apt -y --no-install-recommends install $pkg
done

if (( $1 != 21 )); then

# Add packages from repositories
for pkg in $(grep -vE "^\s*#" build/packages.add | tr "\n" " ")
do
apt -y --no-install-recommends install $pkg
done

fi
# Add packages from repositories
for pkg in $(grep -vE "^\s*#" build/packages.add | tr "\n" " ")
do
apt -y --no-install-recommends install $pkg
done

# Install dependencies, if any
apt -y install -f
@@ -186,7 +186,7 @@ nameserver 2001:4860:4860::8844
/root/nems/nems-admin/nems-restore-sample-db.sh

# Replace the database with Sample database
/root/nems/nems-admin/build/153-mysql
/root/nems/nems-admin/build/034-mariadb

# Remove nconf history, should it exist
mysql -u nconf -pnagiosadmin nconf -e "TRUNCATE History"

0 comments on commit 0458e17

Please sign in to comment.
You can’t perform that action at this time.