How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8

Zabbix is an enterprise-class monitoring solution for servers, network devices, and other components of your infrastructure. Zabbix uses client (Zabbix Agent) installed on the monitored client-server to collect the data. Also, it can monitor standard services such as e-mail, web service without installing a client on the monitored devices.

With Zabbix, you can monitor almost everything that is on your infrastructure. Since Zabbix is enterprise ready, you can use Zabbix monitoring for environments ranging from small to larger.

Zabbix can act pro-actively for some of the issues and can fix the problem by restarting service or powering up a spare server through IPMI. With Zabbix, you will be able to analyze and decide server capacity planning easily.

Zabbix is free, released under the GPL license, so it is free commercial and non-commercial use.

Article Series:

PART 1: How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8

PART 2: How to Install Zabbix Agent on CentOS 7 / Ubuntu 16.04 / Debian 8

PART 3: How to Add a Node to Zabbix Server for Monitoring

Features of Zabbix:

  • Monitor the metrics like CPU, memory, disk space, network and process of servers (Requires Zabbix Agent)
  • Monitoring of VMware vCeneter, VMware hypervisor, and virtual machines.
  • Automatically discovers VMware hypervisor and virtual machines using low-level discovery.
  • Monitoring of MySQL, PostgreSQL, Oracle and Microsoft SQL Server.
  • Zabbix has built-in Java application server monitoring.
  • Monitoring the network device with SNMP.
  • Web services monitoring.
  • Hardware monitoring such as temperature, fan speed, and disk state.

More features.

In this guide, we will talk about installing Zabbix Server and Client on CentOS 7 / RHEL 7, Ubuntu 16.04, and Debian 8.

System Requirements:

Hardware:

Zabbix requires atleast 128MB memory and 256MB of disk space to start with, however, the amount of memory depends on the number of hosts and parameters are being monitored.

2GB RAM and 2GB of disk space would be sufficient to monitor 500 hosts.

Software:

Apache: 1.3.12 or later
MySQL: 5.0.3 or later
PHP: 5.4.0 or later

Setup LAMP Environment:

Before installing Zabbix server, you need to setup LAMP server to meet the system requirements for Zabbix.

READ: How to setup LAMP on CentOS 7 / RHEL 7
READ: How to setup LAMP on Ubuntu 16.04 / Debian 8

If you have already configured LAMP on your server, you can skip the above steps.

Install PHP and PHP Extensions:

Install the required PHP extension using the following command.

### CentOS 7 ###

yum -y install php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml

### Ubuntu 16.04 ###

apt-get install -y php-pear php-gd php-mbstring php-xml php-bcmath

### Debian 8 ###

apt-get -y install php5 php5-mysql php5-gd php5-cli php5-xmlrpc

Firewall:

Configure the firewall to allow Zabbix agent to reach Zabbix server.

FirewallD:

firewall-cmd --permanent --add-port=10050/tcp
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload
systemctl restart firewalld

UFW:

ufw status
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload
ufw enable

Configure Zabbix repository:

Zabbix is not available in our base OS by default, so install Zabbix repository configuration package.

### CentOS 7 ###

rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

### Ubuntu 16.04 ###

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
sudo dpkg -i zabbix-release_3.2-1+xenial_all.deb
sudo apt-get update

### Debian 8 ###

wget http://repo.zabbix.com/zabbix/3.2/debian/pool/main/z/zabbix-release/zabbix-release_3.2-1+jessie_all.deb
sudo dpkg -i zabbix-release_3.2-1+jessie_all.deb
sudo apt-get update

Install Zabbix Server with MySQL:

Use the following command to install Zabbix server along with MySQL database support package on your system.

### CentOS 7 ###

yum install -y zabbix-server-mysql zabbix-web-mysql mariadb-server

### Ubuntu 16.04 / Debian 8 ###

apt-get install -y zabbix-server-mysql zabbix-frontend-php mariadb-server

Timezone:

To begin using the Apache with Zabbix server. Zabbix configuration file needs to be updated with TimeZone.

### CentOS 7 ###

vi /etc/httpd/conf.d/zabbix.conf

### Ubuntu 16.04 / Debian 8 ###

vi /etc/zabbix/apache.conf

Update the below line with correct timezone, more time zones.

php_value date.timezone Asia/Kolkata

Also, in addition to the above. It is recommended to set the following parameters.

php_value max_execution_time 600
php_value memory_limit 128M
php_value post_max_size 32M
php_value upload_max_filesize 16M
php_value max_input_time 600
php_value always_populate_raw_post_data -1

Restart the apache service.

### CentOS 7 ###

service httpd restart

### Ubuntu 16.04 / Debian 8 ###

service apache2 restart

SELinux (CentOS 7):

If you have SELinux enabled on your server, you need to run the following command to enable successful connection of Zabbix web frontend to the server.

setsebool -P httpd_can_connect_zabbix on

If you get an error like below,

Job for zabbix-server.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-server.service" and "journalctl -xe" for details.

You may need to create custom exceptions and allow those through SELinux.

yum install policycoreutils-python
cat /var/log/audit/audit.log | grep zab | audit2allow -M zabbix-server
semodule -i zabbix-server.pp

Credit: Treg’s Blog

Create Zabbix database:

Start the database service.

### CentOS 7 ###

service mariadb restart

### Ubuntu 16.04 / Debian 8  ###

service mysql restart

Login to MariaDB and create the database and user for our Zabbix installation.

If you are starting/setting up MariaDB server for the first time then consider taking a look at Securing MariaDB, this is to ensure the MariaDB instance has root password set, no anonymous users, disallow root login remotely, and removing test database.

### CentOS 7 / Ubuntu 16.04 / Debian 8 ###

mysql -u root -p

Create a database with the following details.

Example:

Zabbix DBName=zabbixdb
Zabbix DBUser=zabbixuser
Zabbix DBPassword=zabbixpasswordd

mysql> create database zabbixdb character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbixdb.* to zabbixuser@localhost identified by 'zabbixpassword';
mysql> quit;

Once you are done creating the database for Zabbix installation, then import initial schema and data to the newly created database.

cd /usr/share/doc/zabbix-server-mysql*/
zcat create.sql.gz | mysql -u zabbixuser -p zabbixdb

Update Database Configuration:

Edit the zabbix_server.conf file to set the database details.

vi /etc/zabbix/zabbix_server.conf

Make sure you set as follows.

DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=zabbixpassword

Services:

Restart all the services.

### CentOS 7 ###
service zabbix-server restart
service httpd restart
service mariadb restart

### Ubuntu 16.04 / Debian 8 ###

service zabbix-server restart
service apache2 restart
service mysql restart

Enable the service to start automatically on system reboot.

### CentoS 7 ###

systemctl enable zabbix-server
systemctl enable httpd
systemctl enable mariadb

### Ubuntu 16.04 / Debian 8 ###

update-rc.d zabbix-server enable
update-rc.d apache2 enable
update-rc.d mysql enable
How To Install Zabbix Server 3.2 on CentOS 7 / Ubuntu 16.04 / Debian 8
4.2 (84%) 5 votes

POSTS YOU MAY LIKE -:)

Share This Post

Shares