How to install zabbix on centOS 7

Zabbix is one of the best open source monitoring system out there with flexibly and ready templates it is easy to install and get started fast. Here is step by step installation guide to run it on Linux CentOS 7.X

install repository: (make sure the path to the latest version by surfing to http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/ )

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

On CentOS you might get error on missing libssh2, you can install it from here:

dnf -y install https://rpmfind.net/linux/centos/7.8.2003/os/x86_64/Packages/libssh2-1.8.0-3.el7.x86_64.rpm

install zabbix using MYSQL (Mariadb) as database, recommended for large scale systems:

yum -y install zabbix-server-mysql zabbix-web-mysql mysql mariadb-server httpd php zabbix-get zabbix-sender

make run and start automatic when booting

systemctl start mariadb
systemctl enable mariadb

Lats start MariaDB installation, enter the password for SQL administrator (none if you run it for the first time,Then choose password) :

mysql_secure_installation
mysql -u root -p

We will create Database called: zabbix_db

create database zabbix_db;

Lets create user for the Database=zabbix_user and the password=zabbix

grant all privileges on zabbix_db.* to zabbix_user@localhost identified by 'zabbix' ;
flush privileges;
exit

Then import initial schema and data. Make sure to insert correct version for 3.4.X. You will be prompted to enter your newly created password.the script are here:

/usr/share/doc/zabbix-server-mysql

zcat /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql -u zabbix_user -p zabbix_db

Enter the password that you use to create the database, make sure you have zabbix_user@localhost and that he have full permission to the database, IF not just create the user with WEBMIN on mysql .

another option is to just extract the db schema and create in steps :

cd /usr/share/doc/zabbix-server-mysql-4.0.0
gunzip create.sql.gz 
mysql -u zabbix_user -p zabbix_db < create.sql   (you can create the db with webmin and then execute the script)

Now lets edit the Zabbix config files :

nano /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix_db
DBUser=zabbix_user
DBPassword=XXXXXXX

Edit the PHP file to support the zabbix on apache :

nano /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 300
php_value memory_limit 256M
php_value post_max_size 32M
php_value upload_max_filesize 32M
php_value max_input_time 600
php_value always_populate_raw_post_data -1
php_value date.timezone  Asia/Jerusalem

Make the zabbix run and start automatic (if it do not run disable the SElinux):

systemctl start zabbix-server
systemctl enable zabbix-server
systemctl start httpd
systemctl enable httpd

Open the firewall ports for the system to communicate :

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

Check the firewall status :

firewall-cmd --zone=public --permanent --list-ports

Allow Zabbix with SElinux

setsebool -P httpd_can_connect_zabbix=1

Now open browser and surf to :

http://your-zabbix-server-IP/zabbix

The default Zabbix admin username :

user= Admin  pass=zabbix

Follow the first time wizard to complete the installation


Tamplates can be downloaded from https://share.zabbix.com/

Presentation of Zabbix : http://www.zabbix.com/presentation

All downloads including ready Zabbix on ubuntu system ISO : http://www.zabbix.com/download

Good Luck

Leave a Reply

Your email address will not be published. Required fields are marked *