- 安装mariadb(mysql)
// 执行安装命令
# yum -y install mariadb mariadb-server mariadb-devel
// 启动服务
# systemctl start mariadb
// 设置为开机启动
# systemctl enable mariadb
// 修改root登录密码
# mysql_secure_installation
Enter current password for root (enter for none): [回车]
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
// 测试登陆
# mysql -uroot -ppassword
// 设置root访问权限
# mysql -uroot -ppassword
MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by 'qwe123' with grant option;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;
- 安装依赖库
// 以下二选一
// 最小
# yum -y install gcc net-snmp-devel libxml2-devel libcurl-devel libevent libevent-devel
// 完全
# yum -y install gcc net-snmp-devel net-snmp net-snmp-utils libxml2 libxml2-devel libcurl libcurl-devel libevent libevent-devel
- 下载源码,并配置安装
下载地址:
https://www.zabbix.com/download
https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.4/zabbix-3.4.4.tar.gz
上传zabbix-3.4.4.tar.gz到/home目录下
# cd /home
# tar -zxf zabbix-3.4.4.tar.gz
# cd zabbix-3.4.4
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make && make install
- 初始化数据
# mysql -uroot -ppassword
MariaDB [none]> create database if not exists zabbix default character set utf8 collate utf8_general_ci;
MariaDB [none]> use zabbix;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/schema.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/images.sql;
MariaDB [zabbix]> source /home/zabbix-3.4.4/database/mysql/data.sql;
- 安装fping
zabbix 3之后把ping更换为fping了,所以需要安装fping
# wget http://www.fping.org/dist/fping-4.0.tar.gz
# tar -zxvf fping-4.0.tar.gz
# cd fping-4.0
# ./configure --prefix=/usr/local/fping
# make && make install
- 配置
// server配置
# cd /usr/local/zabbix/
# vi ./etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=root
DBPassword=password
AllowRoot=1
FpingLocation=/usr/local/fping/sbin/fping
// agent配置
# vi ./etc/zabbix_agentd.conf
Server=0.0.0.0/0
Hostname=Zabbix server #注释掉
AllowRoot=1
- 启动服务
# /usr/local/zabbix/sbin/zabbix_server
# /usr/local/zabbix/sbin/zabbix_agent
- 配置前端环境
// 安装apache+php
# yum -y install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath
// 复制前端代码到站点下
# cp -r /home/zabbix-3.4.4/frontends/php /var/www/html/zabbix
// 关闭防火墙
# systemctl stop firewalld
# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled
// 修改php配置
# vi /etc/php.ini
memory_limit=128M
post_max_size=16M
upload_max_filesize=20M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
// 重启站点
# systemctl restart httpd
访问站点按提示进行配置即可
http://localhost/zabbix