Cài đặt ZABBIX server trên Centos 7

22
4003

ZABBIX là phần mềm monitor phổ biến nhất hiện nay
Sau đây mình sẽ hướng dẫn các thím các bước cài đặt và cấu hình ( đã test trên centos 7)

1.Cài đặt Apache (httpd) để cấu hình Web Server

Cài đặt apache:  yum -y install httpd
Khởi động apache :     service httpd start
Nếu đang sử dụng tường lửa mở port 80 :
Centos7:

sudo firewall-cmd --permanent --zone=public --add-port=80/tcp

Centos6:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Reload firewall

systemctl reload firewalld

Truy cập địa chỉ IP ra như hình bên dưới là OK !

 

2. Cài đặt PHP ( ở đây mình chọn sử dụng PHP 5.6)

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo rpm -Uvh remi-release*.rpm
sudo nano /etc/yum.repos.d/remi.repo       , sau đó enable php5.6
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
Hoặc
sudo yum install php php-fpm php-mysql php-gd php-mbstring php-pear php-xml php-xmlrpc php-devel

Mở php.ini để sửa lại time_zone cho đúng : vi /etc/php.ini

# line 878: sửa lại timezone

date.timezone = “Asia/Ho_Chi_Minh”

Sau đó khởi động lại Apache :   systemctl restart httpd

 

3. Cài đặt MariaDB

 

yum -y install mariadb-server

 

Mở file my.cnf    :nano /etc/my.cnf

Thêm đoạn sau vào file my.cnf

[mysqld]

character-set-server=utf8

 

Khởi động MariaDB:

systemctl start mariadb

 

Chạy lệnh : mysql_secure_installation   sau đó hoàn tất các bước khai báo ban đầu

Mở Port 3306 :

sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp
sudo firewall-cmd --reload

 

4. Cài đặt Zabbix trên centos 7  

Trong bài viết này mình sẽ sử dụng phiên bản Zabbix 3.2

yum -y install php-mysql php-gd php-xml php-bcmath
yum -y install http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent

 

 

Tạo database cho Zabbix:

 

mysql -u root -p

 

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 10

Server version: 5.5.50-MariaDB MariaDB Server

 

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

 

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

 

MariaDB [(none)]> create database zabbix;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'password';

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

Bye

 

 

 

Giải nén và import database có sẵn cho Zabbix

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

gunzip create.sql.gz

mysql -u root -p zabbix < create.sql

 

Cấu hình và Khởi động Zabbix Server

vi /etc/zabbix/zabbix_server.conf

 

# line 82: add

DBHost=localhost

# line 116: add DB password for Zabbix

DBPassword=password

systemctl start zabbix-server

systemctl enable zabbix-server

 

Mở port 10050 :

firewall-cmd --add-port={10051/tcp,10050/tcp} --permanent
sudo firewall-cmd --reload
service httpd restart

 

 Cấu hình zabbix trong httpd 

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

 

# line 10: add access permittion for Zabbix Web frontend

Require all granted

 

# line 20: uncomment và thay đổi timezone

php_value date.timezone Asia/Ho_Chi_Minh

 

Truy cập Zabbix và hoàn tất các khai báo ban đầu
http://IP/zabbix/setup.php

User mặc định: admin
Pass: zabbix

 

Đây chỉ là các bước cấu hình zabbix server, để tiến hành monitor các bạn cần có đối tượng để theo dõi ( zabbix agent)

Bài viêt sau mình sẽ hướng dẫn các thím cách sử dụng và cấu hình Zabbix agent

 

22
Leave a Reply

avatar
5 Comment threads
17 Thread replies
9 Followers
 
Most reacted comment
Hottest comment thread
6 Comment authors
adminLE HAI NAMManhnguyễn quang Vinhtuan Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Newbie
Guest
Newbie

Ad ơi mình cài bị lỗi no package avaiable thì xử lý thế nào ạ

tuan
Guest
tuan

loi nhu nay la sao a
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

nguyễn quang Vinh
Guest
nguyễn quang Vinh

zabbix server is not running: the information displayed may not be current sửa thế nào ạ

Manh
Guest

zabbix server is not running: the information displayed may not be current sửa thế nào ạ
bij giong cac ban qua moi hoc ko biet sua the nao luon

LE HAI NAM
Guest
LE HAI NAM

This page is used to test the proper operation of the nginx HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly.
Website Administrator

This is the default index.html page that is distributed with nginx on EPEL. It is located in /usr/share/nginx/html.

You should now put your content in a location of your choice and edit the root configuration directive in the nginx configuration file /etc/nginx/nginx.conf.
Cho e hỏi e đã cài xong hết trên centos 6 nhưng giao diện cài đặt k ra ạ