{"id":27974,"date":"2018-09-03T05:53:30","date_gmt":"2018-09-03T10:53:30","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=27974"},"modified":"2022-06-03T03:34:41","modified_gmt":"2022-06-03T08:34:41","slug":"how-to-install-and-configure-nagios-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-nagios-on-centos-7\/","title":{"rendered":"How to Install and Configure Nagios on CentOS 7"},"content":{"rendered":"
<\/p>\n
In this tutorial we will show you how to install Nagios on CentOS 7.\u00a0 Nagios is a powerful open source enterprise-class software that monitors network infrastructures, servers and applications. It can be used to monitor Linux and Windows servers as well as web applications, Linux and Unix applications and Windows applications. Some of the features include: parallelized service checks, plugin system, notifications via email, pager or user defined service, web interface for viewing status, log files, problem history and notifications and much more. This guide should work on other Linux VPS<\/a> systems as well but was tested and written for CentOS 7 VPS<\/a>. Log in to your VPS via SSH as a sudo user:<\/p>\n Once you are logged in, issue the following commands to make sure all installed packages are up to date:<\/p>\n Next, install the install the pre-requisite packages necessary for building Nagios with the following command:<\/p>\n To install Nginx, MariaDB PHP 7 and all the necessary PHP modules on your CentOS server run the following command:<\/p>\n When the MariaDB installation is complete, run the following command to secure your MariaDB installation:<\/p>\n Enable MariaDB and Apache to start on boot with:<\/p>\n Download the latest stable version of the Nagios tar archive in the When the download is completed change to the tmp directory extract the archive with the following commands:<\/p>\n Once the Nagios Plugins archive is extracted, change to the Next step is to run the Now that the configuration is completed start the compilation process using the Run the following command to create the nagios user and group and add apache to the nagios group:<\/p>\n The next step is to install Nagios using the Run the following command to install the Nagios sample configuration files:<\/p>\n Install the initialization script so that you can manage your Nagios service using the systemctl command :<\/p>\n Next, install the Apache web server configuration files with:<\/p>\n Restart apache service:<\/p>\n Use the Run the following command to install and configure the external command file:<\/p>\n Before downloading and compiling Nagios plugins install the following dependencies:<\/p>\n Download the latest stable version of the Nagios tar archive in the When the download is completed change to the tmp directory extract the archive with the following commands:<\/p>\n Once the Nagios Plugins archive is extracted, change to the The following commands will check your system for missing libraries and binaries and prepare the Nagios Plugins source code for the build process:<\/p>\n Once the configuration is completed start the compilation process using the Finally install the Nagios Plugins using the Now that you have both Nagios and Nagios Plugins installed on your CentOS system, start the Nagios service with the following command:<\/p>\n Open your browser and navigate to Enter the login credentials that you created earlier with the <\/p>\n <\/p>\n That\u2019s it. You have successfully installed Nagios on CentOS 7. For more information about how to manage your Nagios installation, please refer to the official Nagios documentation<\/a>.<\/p>\n Of course, you don\u2019t have to install Nagios on CentOS 7, if you use one of our\u00a0Managed Hosting<\/a> services, in which case you can simply ask our expert system administrators to install Nagios on CentOS 7 for you, using the LEMP stack or any other web hosting stack of your choice. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS.<\/strong><\/span>\u00a0If you liked this post, on how to install Nagios on CentOS 7, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this tutorial we will show you how to install Nagios on CentOS 7.\u00a0 Nagios is a powerful open source … <\/p>\n
\n<\/p>\nUpdate your CentOS 7 server and install the necessary packages<\/h3>\n
ssh userame@IP_Address<\/pre>\n
sudo yum update<\/pre>\n
sudo yum install gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix<\/pre>\n
Install Apache, MariaDB and PHP 7<\/h3>\n
sudo yum install httpd mariadb-server php php-mysql<\/pre>\n
sudo mysql_secure_installation<\/pre>\n
sudo systemctl enable httpd.service\r\nsudo systemctl enable mariadb.service<\/pre>\n
Download and Install Nagios<\/h3>\n
\/tmp<\/code> directory on your server with:<\/p>\n
wget https:\/\/github.com\/NagiosEnterprises\/nagioscore\/archive\/nagios-4.4.1.tar.gz -O \/tmp\/nagioscore.tar.gz<\/pre>\n
cd \/tmp\r\nsudo tar xf nagioscore.tar.gz<\/pre>\n
nagioscore-nagios-4.4.1<\/code> directory:<\/p>\n
cd \/tmp\/nagioscore-nagios-4.4.1<\/pre>\n
.\/configure<\/code> script which will check your system for missing libraries and binaries and prepare the Nagios source code for the build process:<\/p>\n
.\/configure<\/pre>\n
make all <\/code> command:<\/p>\n
make all<\/pre>\n
sudo make install-groups-users\r\nsudo usermod -a -G nagios apache\r\n<\/pre>\n
make install<\/code> command:<\/p>\n
sudo make install<\/pre>\n
sudo make install-config<\/pre>\n
sudo make install-daemoninit<\/pre>\n
sudo make install-webconf<\/pre>\n
sudo systemctl restart httpd<\/pre>\n
htpasswd<\/code> command to create a user account called
nagiosadmin<\/code><\/p>\n
sudo htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin<\/pre>\n
sudo make install-commandmode<\/pre>\n
Install Nagios Plugins<\/h2>\n
sudo yum install gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release perl-Net-SNMP\r\n<\/pre>\n
\/tmp<\/code> directory on your server with:<\/p>\n
wget --no-check-certificate -O \/tmp\/nagios-plugins.tar.gz https:\/\/github.com\/nagios-plugins\/nagios-plugins\/archive\/release-2.2.1.tar.gz\r\n<\/pre>\n
cd \/tmp\r\nsudo tar xf nagios-plugins.tar.gz<\/pre>\n
nagioscore-nagios-4.4.1<\/code> directory:<\/p>\n
cd \/tmp\/nagios-plugins-release-2.2.1\/<\/pre>\n
.\/tools\/setup\r\n.\/configure\r\n<\/pre>\n
make<\/code> command:<\/p>\n
make<\/pre>\n
make install<\/code> command:<\/p>\n
sudo make install<\/pre>\n
Access Nagios<\/h2>\n
systemctl start nagios<\/pre>\n
http:\/\/your-domain-or-ip\/nagios<\/code> and you will be presented with the login pop-up.<\/p>\n
htpasswd<\/code> command and you will be redirected to the Nagios home page as shown on the image below:<\/p>\n
\n