Installing and Configuring Zabbix 2.4.5 on Debian 8 and RHEL/CentOS 7
Zabbix is an Open Source, high-level enterprise software designed to monitor and keep track of networks, servers and applications in real time. Build in a server-client model, Zabbix can collect different type of data than are used to create historical graphics and output performance or load trends of the monitored targets.
The server has the ability to check standard networking services (HTTP, FTP, SMTP, IMAP etc) without the need to install extra software on the monitored hosts.
However, in order to gather data and create statistics about local services or other specific system resources that run on remote instances, such as CPU, disks, internal system process, RAM, etc, you need to install and configure a Zabbix agent.
Following are the 4-article series about Zabbix Monitoring application:
This tutorial will focus on how to install and compile Zabbix server from sources on Debian 8 Jessie and RHEL/CentOS 7 with MySQL backend database to store collected data, PHP and Apache Web Server as the mainly web interface.
Important: The given Zabbix instructions also works on all Debian derivatives and RedHat based systems like RHEL/CentOS and Fedora.
Step 1: Install Initial Required Software and Dependencies
1. As for the moment, Zabbix does not provide any official pre-compiled binary package for Debian 8 and RHEL/CentOS 7, so the main solution remains to manually download and compile it for sources.
In order to compile and install Zabbix from sources, your box needs a series of tools and dependencies installed on the system, such as: build-essentials (required for compiling debian packages from sources), devlopment tools (for RedHat based systems) GCC (acronym for the GNU Compiler Collection), some cli network http tools such as curl and wget, and other necessary dependencies in order to add extra functionality (SNMP support).
Install all of this packages on system by issuing the following command:
On Debian 8 Jessie
$ sudo apt-get install build-essential gcc curl wget libsnmp-dev libcurl4-gnutls-dev libxml2-dev
On RHEL/CentOS 7
# yum install gcc gcc-c++ make openssl-devel curl wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel gnutls gnutls-devel libxml2 libxml2-devel
Step 2: Install MariaDB Database and Library
2. On the next step install MariaDB database and MySQL development library from binary packages. As MariaDB installs on your system you will be asked to set a password for the database root user during installation (Only on Debian 8). Choose a strong password, repeat it and wait for the installation to finish.
$ sudo apt-get install mariadb-server mariadb-client libmysqld-dev [On Debian 8] # yum install mariadb-server mariadb-client mariadb-devel [On RHEL/CentOS 7]
3. When the installation of Mariadb finishes, secure the database by issuing mysql_secure_installation command with system root privileges ( answer with yes for removing anonymous users, disable root login remotely, remove test database and access to it and apply all changes).
Use the below screenshot as a guide.
Step 3: Install Apache Web Server and PHP
4. Next, install Apache Web Server alongside with PHP programming language in order to provide the web backed functionality for Zabbix Server by issuing the following command:
$ sudo apt-get install apache2 php5 php5-mysql php5-gd php5-cli php5-xmlrpc [On Debian 8] # yum install httpd php php-mysql php-gd pgp-cli php-xml php-bcmath php-mbstring mod_ssl openssl [On RHEL/CentOS 7]
5. Next, you need to tune PHP interpreter and adjust some values in order to run Zabbix Server. So, open Apache
php.ini configuration file for editing by issuing the following command:
$ sudo nano /etc/php5/apache2/php.ini [On Debian 8] # nano /etc/php.ini [On RHEL/CentOS 7]
Now, search with CTRL+C and replace the following PHP values as it follows:
post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = Continent/City always_populate_raw_post_data = -1
The list of PHP supported Timezones can be found here http://php.net/manual/en/timezones.php.
6. After you’re done, save the file (Ctrl+o) and exit (Ctrl+x) and restart Apache daemon in order to reflect changes by issuing the below command.
$ sudo systemctl restart apache2.service [On Debian 8] # systemctl restart httpd.service [On RHEL/CentOS 7]