一:实验环境
server.zabbix.com-------------------- 192.168.200.11
agent.zabbix.com------------------------192.168.200.12
二:配置主机名修改host文件
[root@localhost ~]# hostname server.zabbix.com
[root@server ~]# vim /etc/hosts
server.zabbix.com 192.168.200.11
agent.zabbix.com 192.168.200.12
[root@server ~]# scp /etc/hosts 192.168.200.12:/etc/
三:安装相应的依赖包
[root@localhost ~]# yum -y install httpd mariadb mariadb-devel mariadb-server php php-mbstring php-mysql php-bcmath php-gd php-xmlrpc php-ldap php-xml libevent libevent-devel net-snmp net-snmp-devel libxml2 libxml2-devel curl-devel ntpdate
[root@localhost ~]#ntpdate s1a.time.edu.cn #同步清华大学时间
四:启动服务
[root@server ~]# systemctl start mariadb #开启MySQL
[root@server ~]# systemctl enable mariadb #设置开机自启
[root@server ~]# systemctl start httpd
[root@server ~]# systemctl enable httpd
[root@server ~]# mysqladmin -uroot password 123123 #设置MySQL密码
五:安装JDK
[root@server ~]# ls
anaconda-ks.cfg jdk-8u191-linux-x64.tar.gz
[root@server ~]# rm -rf /usr/bin/java
[root@server ~]# tar xf jdk-8u191-linux-x64.tar.gz
[root@server ~]# mv jdk1.8.0_191 /usr/local/java
[root@server ~]# vim /etc/profile
export PATH=$PATH:$JAVA_HOME/bin
[root@server ~]# java -version
java version "1.8.0_191"
anaconda-ks.cfg jdk-8u191-linux-x64.tar.gz zabbix-3.4.11.tar.gz
[root@server ~]# tar xf zabbix-3.4.11.tar.gz -C /usr/src/
[root@server ~]# cd /usr/src/zabbix-3.4.11/
[root@server zabbix-3.4.11]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --enable-java && make && make install
Query OK, 1 row affected (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
[root@server ~]# mysql -uzabbix -pzabbix zabbix < /usr/src/zabbix-3.4.11/database/mysql/images.sql
[root@server ~]# mysql -uzabbix -pzabbix zabbix < /usr/src/zabbix-3.4.11/database/mysql/data.sql
[root@server ~]# mysql -uzabbix -pzabbix
[root@server ~]# cd /usr/local/
[root@server local]# chown -R zabbix:zabbix zabbix/
[root@server local]# cd zabbix/
[root@server zabbix]# mkdir logs
[root@server zabbix]# chown zabbix:zabbix logs
[root@server zabbix]# cd /usr/local/zabbix/etc/
[root@server etc]# cp zabbix_server.conf zabbix_server.conf.bak
[root@server etc]# cp zabbix_agentd.conf zabbix_agentd.conf.bak
[root@server etc]# vim zabbix_server.conf
LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=192.168.200.11
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf
PidFile=/tmp/zabbix_agentd.pid
Server=127.0.0.1,192.168.200.11
ServerActive=192.168.200.11
Hostname=server.zabbix.com
LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf
#启动server端服务
[root@server ~]# zabbix_server
#启动agentd端服务
#配置zabbix的web页面
[root@server ~]# mv /usr/src/zabbix-3.4.11/frontends/php/ /var/www/html/zabbix
[root@server ~]# chown -R apache:apache /var/www/html/zabbix/
#修改PHP配置,使其兼容zabbix
vim /etc/php.ini
394 max_input_time = 300 #程序上传文件解析数据时间
672 post_max_size = 32M #post方式请求数据所允许的最大大小
405 memory_limit = 128M #设置PHP的内存限制
878 date.timezone = Asia/Shanghai #时区
854 extension=bcmath.so #加载zabbix程序需要的扩展模块 手动添加
十一:设置中文
修改自己想用的字体
[root@server fonts]# ls
DejaVuSans.ttf
[root@server fonts]# rz #上传字体
mv:是否覆盖"DejaVuSans.ttf"? yes