目录
一、实验环境准备
二、server端
1、配置阿里云yum源
2、部署lamp环境
3、启动lamp对应服务
4、准备java环境
5、源码安装zabbix
6、mariadb数据库授权
7、创建zabbix程序用户并授权防止权限报错
8、修改zabbix配置文件
9、配置php与apache
10、web安装zabbix
11、优化中文
12、更改密码
13、解决中文乱码问题
14、刷新查看
15、添加自身为监控机
[root@server ~] vim /etc/hosts
192.168.147.135 server.zabbix.com
192.168.147.136 agent.zabbix.com
192.168.147.132 windows10
关闭防火墙
[root@agent ~] systemctl stop firewalld
[root@agent ~] setenforce 0
[root@agent ~] iptables -F
[root@server ~] hostnamectl set-hostname serverzabbix.com
[root@server ~] bash
[root@server ~] cat /etc/hostname
service.zabbix.com
[root@server ~] cd /etc/yum.repos.d/
[root@server yum.repos.d] wget http://mirrors.aliyun.com/repo/Centos-7.repo
[root@server yum.repos.d] ls
backup Centos-7.repo CentOS-Media.repo
[root@server yum.repos.d] yum install -y httpd mariadb-server mariadb mariadb-devel 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 ntpdate curl-devel
同步清华大学时间服务器
[root@server yum.repos.d] ntpdate time.windows.com
18 Jul 17:57:47 ntpdate[55061]: adjust time server 52.231.114.183 offset 0.006848 sec
[root@service ~] systemctl start mariadb
[root@service ~] systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@service ~] systemctl start httpd
[root@service ~] systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@service ~] mysqladmin -u root password 123123 #设置密码
删除原本的java
[root@service ~] ls
anaconda-ks.cfg jdk-8u191-linux-x64.tar.gz
[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 JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin
[root@server ~] source /etc/profile
[root@server ~] java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
[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] yum -y install gcc gcc-c++
[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 -j2 && make install
[root@server zabbix-3.4.11] ./configure --prefix=/usr/local/Zabbix #指定安装位置
[root@server zabbix-3.4.11] ./configure --enable-server --with-mysql #启动zabbix
[root@server zabbix-3.4.11] ./configure --enable-agent 启动agent
[root@service zabbix-3.4.11]# cd
[root@service ~] mysql -u root -p123123
MariaDB [(none)]> create database zabbix character set utf8;
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> grant all on zabbix.* to zabbix@'192.168.147.135' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec) #为zabbix_server启动授权
MariaDB [(none)]> flush privileges;
[root@service ~] cd /usr/src/zabbix-3.4.11/ #导入zabbix需要的mysql数据
[root@service zabbix-3.4.11] mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
[root@service zabbix-3.4.11] mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
[root@service zabbix-3.4.11] mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
[root@service zabbix-3.4.11] mysql -u root -p123123
MariaDB [zabbix]> use zabbix;
Database changed
MariaDB [zabbix]> show tables;
| valuemaps |
| widget |
| widget_field |
+----------------------------+
140 rows in set (0.00 sec)
#140个
[root@service ~] useradd -M -s /sbin/nologin zabbix
[root@service ~] cd /usr/local/
[root@service local] cd ./zabbix/
[root@service zabbix] pwd
/usr/local/zabbix
[root@service zabbix] mkdir logs
[root@service zabbix] chown -R zabbix:zabbix ../zabbix/
[root@service zabbix] cp -p etc/zabbix_server.conf{,.bak}
[root@service zabbix] cp -p etc/zabbix_agentd.conf{,.bak}
[root@service etc] vim zabbix_server.conf
LogFile=/usr/local/zabbix/logs/zabbix_server.log #指定zabbix日志位置
PidFile=/tmp/zabbix_server.pid #指定zabbix pid文件位置
DBHost=192.168.200.111 #指定数据库主机
DBName=zabbix #指定数据库名为zabbix
DBUser=zabbix #指定用户为zabbix
DBPassword=zabbix #指定密码为zabbix
DBSocket=/var/lib/mysql/mysql.sock #指定mariadb数据库的sock文件
Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf
[root@service etc] vim zabbix_agentd.conf
PidFile=/tmp/zabbix_agentd.pid
Server=127.0.0.1,192.168.200.111
ServerActive=192.168.200.111
Hostname=server.zabbix.com #指定zabbixserver主机名
LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf
[root@service ~] ln -s /usr/local/zabbix/sbin/* /usr/local/bin
[root@service ~] zabbix_server
[root@service ~] zabbix_agentd
[root@service ~] mv /usr/src/zabbix-3.4.11/frontends/php/ /var/www/html/zabbix
[root@service ~] chown -R apache:apache /var/www/html/zabbix
[root@service ~] vim /etc/php.ini
878 date.timezone = Asia/Shanghai ##时区
384 max_execution_time = 300 ##单位秒,通过POST、GET以及PUT方式接收数据时间进行限制
394 max_input_time = 300 ##php程序上传文件解析数据时的时间限制
672 post_max_size = 32M ##POST 方式请求数据所允许的最大大小
405 memory_limit = 128M ##设置php程序的内存限制
854 extension=bcmath.so ##加载zabbix程序需要加载的扩展模块bcmath.so手动添加
[root@service ~] systemctl restart httpd
[root@service ~] netstat -anptl |egrep ':10050|:10051|:80'
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 90502/zabbix_agentd
tcp6 0 0 :::10050 :::* LISTEN 90502/zabbix_agentd
tcp6 0 0 :::80 :::* LISTEN 90655/httpd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 87957/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 87957/zabbix_serv
全部绿色
不写name直接下一步
核对信息,直接下一步
账号:admin 密码:zabbix
选择chinese 然后update,按F5刷新即可
退出测试
[root@service ~] cd /var/www/html/zabbix/fonts/
[root@service fonts]# ls
DejaVuSans.ttf.bak simkai.ttf #中文字包
[root@service fonts] chown -R apache:apache *
[root@service fonts] ll
总用量 4780
-rw-r--r--. 1 apache apache 4135804 7月 17 2020 DejaVuSans.ttf
-rw-r--r--. 1 apache apache 756072 6月 25 2018 DejaVuSans.ttf.bak
变成中文了