In part 1 we discussed about basics of Nagios ,features and architecture …
Here we discussed How to install nagios on linux →
Pre-requisite for Nagios → means what you needed in your device before installing nagios
- Apache 2.0( a broswer)
- Php (dashboard)
- Gec and gd (compiler to convert raw code into binaries)
- Makefile ( to build)
- perl( Script)
- Main configuration file path → /usr/local/nagios/etc/nagios.cfg
Install Nagios on Linux →
Step 1→ Install pre-requisite software on your linux machine prior to changes installation like Apache,php, GCC compiler and GD development libraries.
- apt install apache 2.0 php
- apt install gcc glibc glibc — common
- apt install gd gd -devel
Step 2 → create account information you need to set up for Nagios user Run the following commands.
- //create a new user → add user -m nagios
- passwd nagios // now it asks to enter a new password
- groupadd nagioscmd
- usermod -a -G nagioscmd nagios
- usermod -a -G nagioscmd apache
Step 3 → download nagios core and plugins create a directory for storing downloads
- mkdir ~/downloads
- cd ~/downloads
Step 4 → download the source code Tar balls of both Nagiosn and the Nagios plugins
- wget https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqbGI3X1phUWNtdGNVNzA0dWNkMkRranJqZW1QZ3xBQ3Jtc0tsbEdfWmxBMDc0anBBN0QyeFcweWZsV1hheTBkYUtFdEJMTlFKc1J6YWRQSDRNTDhETThxTG1fVWpBUWJRemM4MVlKOVZDNUs2S29lTmJaNnpGRFBLUG01LVQtc3prVmV0b3RWaUhVY2EyQU1ndjk3QQ&q=http%3A%2F%2Fprdownloads.sourceforge.net%2Fsourceforge%2Fnagios%2Fnagios-4.0.8.tar.gz&v=H9uRoLS_8ks
- wget https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqblBOUDU5TlAyeUZKWWhGWnd5ZlEwQVFsQ0JpUXxBQ3Jtc0tuODBJRWVvUHFPQjdJNlF0VnhKaE1oRUJmcUtsaUoyMTVVMEFvdTVVNk56ZTFTck41Y2dNT2R5MUZhdFFtMTNkRVFQaXdBNXhyTTZkUDJPTkNEM1FwWWh0azgyWUx6UGsxcnNNSnVvZG83MXRGenlLTQ&q=http%3A%2F%2Fnagios-plugins.org%2Fdownload%2Fnagios-plugins-2.0.3.tar.gz&v=H9uRoLS_8ks
Step 5 → compile and install Nagios. Extract the nagios source code
- tar zxvf nagios-4.0.8.tar.gz
- cd nagios-4.0.8
Step 6 → Run the configuration script with the name of the group which you have created in above step
- ./configure — with-command-group=nagioscmd
Step 7→ compile the nagios source code
- make all
Step 8→ Install binaries , init script, sample config files and set permission on the External Command directory.
- make install
- make install-init
- make install-config
- make install-commandmode
Step 9→ Config the web interface
- make install-webconf
Step 10→ Create Nagios admin account for login.
- htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
- // asking for pass → service apache restart
Step 11→ Install the plugins and compile.
- cd ~/downloads
- tar zxvf nagios-plugins-2.0.3.tar.gz
- cd nagios-plugins-2.0.3
step 12 → Compile install plugins
- ./configure — with-nagios-user=nagios — with-nagios-group=nagios
- make (for compile)
- make install
Step 13 → Start Nagios, add Nagios to the list of system services, and have it automatically start when the system boots
- chkconfig — add nagios
- chkconfig nagios on
Verify the sample Nagios configuration files →
- /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios →
- service nagios start
- service apache restart
Step 14→ Copy public IP of your machine and paste in Google Chrome enter following → <public ip>/nagios/
- username
- passwd
suggested video for nagios installation →https://www.youtube.com/watch?v=H9uRoLS_8ks&list=PLBGx66SQNZ8aPsFDwb79JrS2KQBTIZo10&index=44