1、安装数据库mariadb
代码语言:javascript复制[root@node1 ~]# yum install -y mariadb mariadb-server
[root@node1 ~]# systemctl start mariadb
[root@node1 ~]# systemctl enable mariadb
代码语言:javascript复制[root@node1 ~]# vi /etc/my.cnf
[root@node1 ~]# cat /etc/my.cnf
[mysqld]
character-set-server=utf8
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[root@node1 ~]#
2、下载(Choose your platform for Zabbix server)
https://www.zabbix.com/
3、Install and configure Zabbix server
(1)Install Repository with MySQL database
代码语言:javascript复制[root@node1 ~]# rpm -i http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.IcrMTU: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
(2)Install Zabbix server, frontend, agent
代码语言:javascript复制[root@node1 ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
...
Installed:
zabbix-agent.x86_64 0:3.0.16-1.el7 zabbix-server-mysql.x86_64 0:3.0.16-1.el7 zabbix-web-mysql.noarch 0:3.0.16-1.el7
Dependency Installed:
OpenIPMI-libs.x86_64 0:2.0.19-15.el7 OpenIPMI-modalias.x86_64 0:2.0.19-15.el7 apr.x86_64 0:1.4.8-3.el7_4.1
apr-util.x86_64 0:1.5.2-6.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7
fping.x86_64 0:3.10-4.el7 httpd.x86_64 0:2.4.6-67.el7.centos.6 httpd-tools.x86_64 0:2.4.6-67.el7.centos.6
iksemel.x86_64 0:1.4-6.el7 libXpm.x86_64 0:3.5.12-1.el7 libtool-ltdl.x86_64 0:2.4.2-22.el7_3
libxslt.x86_64 0:1.1.28-5.el7 libzip.x86_64 0:0.10.1-8.el7 mailcap.noarch 0:2.1.41-2.el7
mariadb-libs.x86_64 1:5.5.56-2.el7 net-snmp-libs.x86_64 1:5.7.2-28.el7_4.1 php.x86_64 0:5.4.16-43.el7_4.1
php-bcmath.x86_64 0:5.4.16-43.el7_4.1 php-cli.x86_64 0:5.4.16-43.el7_4.1 php-common.x86_64 0:5.4.16-43.el7_4.1
php-gd.x86_64 0:5.4.16-43.el7_4.1 php-ldap.x86_64 0:5.4.16-43.el7_4.1 php-mbstring.x86_64 0:5.4.16-43.el7_4.1
php-mysql.x86_64 0:5.4.16-43.el7_4.1 php-pdo.x86_64 0:5.4.16-43.el7_4.1 php-xml.x86_64 0:5.4.16-43.el7_4.1
t1lib.x86_64 0:5.1.2-14.el7 unixODBC.x86_64 0:2.3.1-11.el7 zabbix-web.noarch 0:3.0.16-1.el7
Complete!
[root@node1 ~]#
(3)Create initial database
代码语言:javascript复制[root@node1 ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, 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 character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@node1 ~]#
Import initial schema and data. You will be prompted to enter your newly created password.
代码语言:javascript复制[root@node1 ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@node1 ~]# mysql -uzabbix -pzabbix
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 6
Server version: 5.5.56-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> show databases;
--------------------
| Database |
--------------------
| information_schema |
| zabbix |
--------------------
2 rows in set (0.01 sec)
MariaDB [(none)]> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [zabbix]>
(4)Configure the database for Zabbix server
代码语言:javascript复制[root@node1 ~]# vi /etc/zabbix/zabbix_server.conf
代码语言:javascript复制DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
(5)Configure PHP for Zabbix frontend
代码语言:javascript复制[root@node1 ~]# vi /etc/php.ini
代码语言:javascript复制max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Shanghai
(6)Start Zabbix server and agent processes
代码语言:javascript复制[root@node1 ~]# systemctl restart zabbix-server zabbix-agent httpd
[root@node1 ~]# systemctl enable zabbix-server zabbix-agent httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@node1 ~]#
4、Configure Zabbix frontend
https://www.zabbix.com/documentation/3.0/manual/installation/install#installing_frontend
http://node1/zabbix/