Description
Operating system: CentOS
IP Address: 192.168.21.127
Web environment: nginx+mysql+php
Zabbix version: Zabbix 2.2 LTS
Note: Linux installation Zabbix need to have lamp or LNMP operating environment
Prepare the article:
One, Web environment: nginx+mysql+php
CentOS 7.0 compile and install nginx1.6.0+mysql5.6.19+php5.5.14
Second, Zabbix package download
zabbix-2.2.6
Http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.6/zabbix-2.2.6.tar.gz
Upload zabbix-2.2.6.tar.gz to server/usr/local/src directory
Installation article
First, create, import Zabbix database
CD/USR/LOCAL/SRC #进入软件包下载目录
Tar zxvf zabbix-2.2.6.tar.gz #解压
Cd/usr/local/src/zabbix-2.2.6/database/mysql #进入mysql数据库创建脚本目录
LS #列出文件, you can see that there are schema.sql, Images.sql, Data.sql these three files
Mysql-u root-p #输入密码, enter MySQL console
Create database Zabbix character set UTF8; #创建数据库zabbix, and database encoding uses UTF8
Insert into Mysql.user (Host,user,password) VALUES (' localhost ', ' Zabbix ', Password (' 123456 ')); #新建账户zabbix, password 123456
Flush privileges; #刷新系统授权表
Grant all in zabbix.* to ' Zabbix ' @ ' 127.0.0.1 ' identified by ' 123456 ' with GRANT option; #允许账户zabbix能从本机连接到数据库zabbix
Flush privileges; #再次刷新系统授权表
Use Zabbix #进入数据库
Source/usr/local/src/zabbix-2.2.6/database/mysql/schema.sql #导入脚本文件到zabbix数据库
Source/usr/local/src/zabbix-2.2.6/database/mysql/images.sql #导入脚本文件到zabbix数据库
Source/usr/local/src/zabbix-2.2.6/database/mysql/data.sql #导入脚本文件到zabbix数据库
Note: Please import in the order above, otherwise there will be an error.
Exit #退出
or import this way
Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-2.2.6/database/mysql/schema.sql
Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-2.2.6/database/mysql/images.sql
Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-2.2.6/database/mysql/data.sql
Cd/usr/lib64/mysql #32位系统为/usr/lib/mysql, note that the system version is the same, the file version may be different, this is 16.0.0
Ln-s libmysqlclient.so.16.0.0 libmysqlclient.so #添加软连接
Ln-s libmysqlclient_r.so.16.0.0 libmysqlclient_r.so #添加软连接
Second, install Zabbix
1, add Users:
Groupadd Zabbix #创建用户组zabbix
Useradd zabbix-g zabbix-s/bin/false #创建用户zabbix and adds user Zabbix to the user group Zabbix
2, install the dependent package #CentOS使用yum命令安装
Yum Install Net-snmp-devel Curl Curl-devel mysql-devel
Note: If the above package is installed when you install the Web environment lamp or LNMP, this step can be ignored
3. Installation Zabbix
ln-s/usr/local/lib/libiconv.so.2/usr/lib/libiconv.so.2 #添加软连接
/sbin/ldconfig #使配置立即生效
cd/usr/local/src/zabbix-2.2.6 #进入安装目录
./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-net-snmp--with-libcurl--enable-proxy- -with-mysql=/usr/bin/mysql_config #配置
Make #编译
Make install #安装
Ln-s/usr/local/zabbix/sbin/*/usr/local/sbin/ #添加系统软连接
Ln-s/usr/local/zabbix/bin/*/usr/local/bin/ #添加系统软连接
Description: Find/-name mysql_config search location, if there is no mysql_config, you need to install Yum install Mysql-devel
4, add the Zabbix service corresponding port
Vi/etc/services #编辑, add the following code at the end
# Zabbix
Zabbix-agent 10050/tcp # Zabbix Agent
Zabbix-agent 10050/UDP # Zabbix Agent
Zabbix-trapper 10051/tcp # Zabbix Trapper
Zabbix-trapper 10051/UDP # Zabbix Trapper
: wq! #保存退出
5, modify the Zabbix configuration file
Cd/usr/local/zabbix/etc
Vi/usr/local/zabbix/etc/zabbix_server.conf
Dbname=zabbix #数据库名称
Dbuser=zabbix #数据库用户名
dbpassword=123456 #数据库密码
listenip=127.0.0.1 #数据库ip地址
Alertscriptspath=/usr/local/zabbix/share/zabbix/alertscripts #zabbix运行脚本存放目录
: wq! #保存退出
Vi/usr/local/zabbix/etc/zabbix_agentd.conf
include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
Unsafeuserparameters=1 #启用自定义key
: wq! #保存退出
6. Add Boot Script
Cp/usr/local/src/zabbix-2.2.6/misc/init.d/fedora/core/zabbix_server/etc/rc.d/init.d/zabbix_server #服务端
Cp/usr/local/src/zabbix-2.2.6/misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd #客户端
chmod +x/etc/rc.d/init.d/zabbix_server #添加脚本执行权限
chmod +x/etc/rc.d/init.d/zabbix_agentd #添加脚本执行权限
Chkconfig zabbix_server on #添加开机启动
Chkconfig zabbix_agentd on #添加开机启动
7, modify Zabbix boot boot script in the Zabbix installation directory
Vi/etc/rc.d/init.d/zabbix_server #编辑服务端配置文件
basedir=/usr/local/zabbix/ #zabbix安装目录
: wq! #保存退出
Vi/etc/rc.d/init.d/zabbix_agentd #编辑客户端配置文件
basedir=/usr/local/zabbix/ #zabbix安装目录
: wq! #保存退出
Iv. Configuring the Web site
cd/usr/local/src/zabbix-2.2.6
Cp-r/usr/local/src/zabbix-2.2.6/frontends/php/usr/local/nginx/html/zabbix
Chown Www.www-R/usr/local/nginx/html/zabbix
Note:/usr/local/nginx/html for nginx default site Directory www for nginx run account
Service zabbix_server start #启动zabbix服务端
Service Zabbix_agentd start #启动zabbix客户端
Vi. modifying PHP configuration file parameters
1, Vi/etc/php.ini #编辑修改
Post_max_size =16m
Max_execution_time =300
Max_input_time =300
: wq! #保存退出
2, vi/usr/local/php/etc/php-fpm.conf #编辑修改
Request_terminate_timeout = 300
: wq! #保存退出
Service php-fpm Reload #重启php-fpm
Seven, install the Web
Open in Browser:
http://192.168.21.127/zabbix/setup.php
Next
Check system environment settings, all must be OK to continue
Next
Configuring MySQL Database Information
Database:mysql
Database host:127.0.0.1
Database port:use Default Port
Database Name:zabbix
User:zabbix
password:123456
Test connection #测试数据库连接是否正常, show ok by
Next
Next Default
Next
Finish installation Complete
Viii. change Zabbix The default language is Simplified Chinese, replacing the system default Chinese font on the monitor image
1, modify the system configuration file, so that the Web page support Simplified Chinese display
vi/usr/local/nginx/html/zabbix/include/locales.inc.php #编辑修改
' ZH_CN ' => Array (' name ' => _ (' Chinese (zh_cn) '), ' Display ' => false),
Amended to
' ZH_CN ' => Array (' name ' => _ (' Chinese (zh_cn) '), ' Display ' => true),
: wq! #保存退出
2, replace the monitor image on the system default font #默认字体不支持中文, if not replaced, the image will display garbled
Copy a Chinese font file in the C:\Windows\Fonts directory in the Windows system, such as Msyh.ttf
Upload the font file Msyh.ttf to the Zabbix site root directory Fonts folder
For example:/usr/local/nginx/html/zabbix/fonts
Backing up the default font file: Dejavussans.ttf-bak
Modify Msyh.ttf name called Dejavussans.ttf
3. Open in Browser:
Http://192.168.21.127/zabbix
Account: admin
Password: Zabbix
Sign in Login
As shown in the following figure
Click Profile
As shown in the following figure
Language:chinese (ZH_CN) #简体中文
Point Save Save
Exit the site, and then log back on, as shown in the following figure
The default interface is already displayed in Chinese
At this point, the Zabbix installation illustrated tutorial is complete.