Posted: Fri Jan 08, 2010 7:23 pm Post subject: CentOS 5.4 Installing Nagios and Lilac
Here's a dirty script I wrote to install nagios and Lilac on a clean CentOS 5.4 install. This script doesn't care about anyone other than itself (it'll change the mysql password for instance) so may not be entirely perfect for your needs.
It does get PHP 5.2 installed and all of Lilacs annoying deps.
Note at the end there are some edits to do to PHP.ini and sudoers:
#Edit Files, I guess I could do this with sed, but bah.
#Edit /etc/php.ini
#magic_quotes_gpc = Off
#memory_limit = 64M
#Restart httpd fo the php.ini edits take effect
#service httpd restart
#edit /etc/sudoers
#comment out Defaults requiretty
#add the folowing at the end of the file (no pound signs)
#apache ALL=(ALL) NOPASSWD: /usr/bin/nmap
#apache ALL=(ALL) NOPASSWD: /usr/local/nagios/bin/nagios
#apache ALL=(ALL) NOPASSWD: /etc/init.d/nagios restart
#apache ALL=(ALL) NOPASSWD: /etc/init.d/nagios reload
#go to http://<yourserver>/nagios/lilac/install.php and resolve any dependencies
#there should not be any
I guess I could do that with sed or something as stated, if you implement it, send me a copy and I'll add it here. This is not graceful but does a lot of grunt work easily.
Code:
#!/bin/sh
yum clean all
#As found on socalcrew.com, this installs Nagios and Lilac on a clean
#CentOS 5.4 install. This is from gleened sources in the comments below.
#This script IS NOT SAFE, it defaults to weak passwords,
#doesn't care how version changes might affect the rest of your system,
#and will change your mysql password if you let it, so you really
#should edit it to you liking first.
#Must be run as ROOT
#The main reason this is handy is getting an updated PHP 5.2 with all the deps
#Since 5.4 doesn't have it. Tested with 5.4 on various servers, dev on Dell 860 Dual Core
#http://www.webtatic.com/blog/2009/06/php-530-on-centos-5/
#Install PHP 5.2.12-1 !!!! HALT !!!! 5.3.1-1 breaks Lilac! Use 5.2.x
#ask me how I know
#There is no reason update should be needed normally, but I'm anal
#disable all other repos for Troubleshooting if needed
#yum --disablerepo=* --enablerepo=webtatic --exclude=php*5.3* update php
service httpd restart
useradd -m nagios
echo 'password' |passwd --stdin nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
#Let's grab Nagios from Sourceforge
cd /usr/local/src
#reference: http://sourceforge.net/projects/nagios/
wget -nc http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.0/nagios-3.2.0.tar.gz?use_mirror=ufpr
cd /usr/local/src/
tar -zxvf nagios-3.2.0.tar.gz
#rm -f nagios-3.2.0.tar.gz
cd /usr/local/src/nagios-3.2.0/
./configure --with-command-group=nagcmd
#Compile Nagios
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
#Name the Nagios login
htpasswd -nb nagiosadmin password > /usr/local/nagios/etc/htpasswd.users
service httpd restart
#Grab the Nagios Plugins
#Reference: http://nagiosplugins.org/
wget -nc http://downloads.sourceforge.net/project/nagiosplug/nagiosplug/1.4.14/nagios-plugins-1.4.14.tar.gz?use_mirror=ufpr
cd /usr/local/src/
tar -zxvf nagios-plugins-1.4.14.tar.gz
#rm -f nagios-plugins-1.4.14.tar.gz
cd /usr/local/src/nagios-plugins-1.4.14
#Compile the plugins
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
#Make sure Nagios is ON, and stays on
service nagios start
chkconfig nagios on
#Make sure MySQL is on and stays on
service mysqld start
chkconfig mysqld on
#Make sure Apache is on and stays on
service apache start
chkconfig apache on
#Let's grab Lilac and install it.
#this isn't pretty, but works
cd /usr/local/src/
wget -nc http://lilacplatform.com/trac/downloads/5
cp 5 lilac-1.0.3.tar.gz
rm -f 5
cp lilac-1.0.3.tar.gz /usr/local/nagios/share/lilac-1.0.3.tar.gz
cd /usr/local/nagios/share
tar -zxvf lilac-1.0.3.tar.gz
mkdir lilac
cd lilac-1.0.3
cp -r * /usr/local/nagios/share/lilac
cd /usr/local/nagios/share
rm -rf lilac-1.0.3
rm -f lilac-1.0.3.tar.gz
cd /usr/local/nagios/share/lilac
chmod 0777 includes
#You really should edit this and all other password fields
/usr/bin/mysqladmin -u root password password
#Edit Files, I guess I could do this with sed, but bah.
#Edit /etc/php.ini
#magic_quotes_gpc = Off
#memory_limit = 64M
#Restart httpd fo the php.ini edits take effect
#service httpd restart
#edit /etc/sudoers
#comment out Defaults requiretty
#add the folowing at the end of the file (no pound signs)
#apache ALL=(ALL) NOPASSWD: /usr/bin/nmap
#apache ALL=(ALL) NOPASSWD: /usr/local/nagios/bin/nagios
#apache ALL=(ALL) NOPASSWD: /etc/init.d/nagios restart
#apache ALL=(ALL) NOPASSWD: /etc/init.d/nagios reload
#go to http://<yourserver>/nagios/lilac/install.php and resolve any dependencies
#there should not be any
#user=nagiosadmin pass=password
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum