Zabbix4.X (f) compile and install Zabbix4.2

1. Solution source compiler installation dependencies zabbix4.2 the
command:
yum the install the libevent -Y-NET-SNMP devel-devel
Zabbix4.X (f) compile and install Zabbix4.2

2. Add zabbix user
command:
useradd -s / sbin / nologin zabbix
Zabbix4.X (f) compile and install Zabbix4.2

3. Download zabbix4.2 version to / usr / local / src directory
command:
cd / usr / local / src
tar XF zabbix-4.2.5.tar.gz
directly downloaded zabbix4.2.5 uploaded to the server's / usr / local / src directory
Zabbix4.X (f) compile and install Zabbix4.2

4.预编译zabbix 4.2.5
命令:
cd /usr/local/src/zabbix-4.2.5
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
Zabbix4.X (f) compile and install Zabbix4.2

The compiler installation zabbix 4.2.5
command:
the make the make the install &&
Zabbix4.X (f) compile and install Zabbix4.2

6. set the environment variable
command:
VI /etc/profile.d/zabbix.sh
add the following
PATH = $ PATH: / usr / local / zabbix / sbin /: / usr / local / zabbix / bin /
Zabbix4.X (f) compile and install Zabbix4.2

7. making environment variables to take effect immediately
command:
Source /etc/profile.d/zabbix.sh
Zabbix4.X (f) compile and install Zabbix4.2

8. Check zabbix version
command:
zabbix_server -V
Zabbix4.X (f) compile and install Zabbix4.2

9. mysql database into the database and create this database authorized zabbix
command:
the Create Database Character zabbix the SET utf8 COLLATE utf8_bin;
Grant * All privileges ON zabbix to zabbix@'127.0.0.1 'IDENTIFIED by' zabbixpwd ';.
Flush privileges;
the SET names UTF8;
use ZABBIX;
Zabbix4.X (f) compile and install Zabbix4.2

10.初始化zabbix数据库(导入zabbix安装目录中mysql中的sql语句)
命令:
source /usr/local/src/zabbix-4.2.5/database/mysql/schema.sql;
source /usr/local/src/zabbix-4.2.5/database/mysql/data.sql;
source /usr/local/src/zabbix-4.2.5/database/mysql/images.sql;
Zabbix4.X (f) compile and install Zabbix4.2
Zabbix4.X (f) compile and install Zabbix4.2
Zabbix4.X (f) compile and install Zabbix4.2

11.编译zabbix的配置文件zabbix_server.conf
命令:
vi /usr/local/zabbix/etc/zabbix_server.conf
Zabbix4.X (f) compile and install Zabbix4.2

12.对zabbix目录所属主和组更换为zabbix
命令:
chown -R zabbix:zabbix /usr/local/zabbix/
Zabbix4.X (f) compile and install Zabbix4.2

13.启动zabbix_server是否报错
命令:
zabbix_server
Zabbix4.X (f) compile and install Zabbix4.2

14.由于zabbix_server进程的ID太多,故无法使用kill -9 PID来结束,可以使用根据进程名来杀掉
命令:
ps -ef|grep zabbix_server|grep -v grep|awk '{print $2}'|xargs kill -9
Zabbix4.X (f) compile and install Zabbix4.2

15.编写zabbix_server自启动文件
命令:
vi /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target
Zabbix4.X (f) compile and install Zabbix4.2

16.使用systemctl来启动zabbix-server,开启自启动
命令:
systemctl daemon-reload
systemctl start zabbix-server
systemctl enable zabbix-server
Zabbix4.X (f) compile and install Zabbix4.2

17.在nginx目录中的html目录下创建个zabbix,并把/usr/local/src/zabbix-4.2.5/frontends/php/复制至zabbix
命令:
mkdir /usr/local/nginx/html/zabbix
cp -a /usr/local/src/zabbix-4.2.5/frontends/php/
/usr/local/nginx/html/zabbix/
Zabbix4.X (f) compile and install Zabbix4.2

18.zabbix web需要php做配置优化,编辑文件/usr/local/php/etc/php.ini查找到如下对应的并修改
优化如下:
post_max_size = 32M
max_execution_time = 350
max_input_time = 350
date.timezone = Asia/Shanghai

19.重新启动php-fpm
命令:
systemctl restart php-fpm
Zabbix4.X (f) compile and install Zabbix4.2

19.访问zabbix web页面,并对zabbix进行初始化设置
Zabbix4.X (f) compile and install Zabbix4.2

20.设置zabbix连接数据库的信息
Zabbix4.X (f) compile and install Zabbix4.2

21.一直next,会出现如下图所示
Zabbix4.X (f) compile and install Zabbix4.2

22.单击Next step,会出现如下图所示,让把1.Download the configuration file下载并保存至/usr/local/nginx/html/zabbix/conf/zabbix.conf.php
Zabbix4.X (f) compile and install Zabbix4.2

23.把下载好的zabbix_conf.php文件上传到/usr/local/nginx/html/zabbix/conf目录下
Zabbix4.X (f) compile and install Zabbix4.2

24. Access http://192.168.80.200/zabbix browser which can display the login screen
with default user: Admin
password: zabbix
Zabbix4.X (f) compile and install Zabbix4.2

25. Disable monitoring Zabbix server host
Zabbix4.X (f) compile and install Zabbix4.2

26. Disable guest user
Zabbix4.X (f) compile and install Zabbix4.2

27. Modify Admin user's password
Zabbix4.X (f) compile and install Zabbix4.2

Guess you like

Origin blog.51cto.com/7309656/2425340