Zabbix 3.0 installation and deployment
zabbix package download
zabbix-3.0.1.tar.gz
http://heanet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
Upload zabbix-3.0.1.tar.gz to the server/usr/local/src directory
Installation Deployment:
Please refer to Zabbix 2.x installation tutorial
1. Create and import zabbix database
cd /usr/local/src #Go to the package download directory
tar zabbix-3.0.1.tar.gz #unzip
cd /usr/local/src/zabbix-3.0.1/database/mysql #Enter mysql database to create script directory
ls #List files, you can see schema.sql, p_w_picpaths.sql, data.sql these three files
mysql -u root -p #Enter password to enter MySQL console
create database zabbix character set utf8; #Create database zabbix and use utf8 for database encoding
insert into mysql.user(Host,User,Password) values ('localhost ',' zabbix', password ('123456 ')); #Create new account zabbix, password 123456
flush privileges; #Refresh the system authorization table
grant all on zabbix.* to 'zabbix'@'localhost' identified by '123456' with grant option; #Allow account zabbix to connect to database zabbix from local machine
flush privileges; #Refresh the system authorization table again
use zabbix #Enter database
source/usr/local/src/zabbix-3.0.1/database/mysql/schema.sql #Import script files to zabbix database
source/usr/local/src/zabbix-3.0.1/database/mysql/p_w_picpaths.sql #Import script files to zabbix database
source/usr/local/src/zabbix-3.0.1/database/mysql/data.sql #Import script files to zabbix database
Note: Please import according to the above order, otherwise an error will occur.
exit #exit
Or import it like this.
mysql -uzabbix -p123456 -hlocalhost zabbix
< /usr/local/src/zabbix-3.0.1/database/mysql/schema.sql mysql -uzabbix -p123456 -hlocalhost zabbix < /usr/local/src/zabbix-3.0.1/database/mysql/p_w_picpaths.sql mysql -uzabbix -p123456 -hlocalhost zabbix < /usr/local/src/zabbix-3.0.1/database/mysql/data.sql cd /usr/lib64/mysql #32位系统为/usr/lib/mysql,注意系统版本同,文件版本可能不一样,这里是16.0.0 ln -s libmysqlclient.so.16.0.0 libmysqlclient.so #添加软连接 ln -s libmysqlclient_r.so.16.0.0 libmysqlclient_r.so #添加软连接 二、安装zabbix 1、添加用户: groupadd zabbix #创建用户组zabbix useradd zabbix -g zabbix -s /bin/false #创建用户zabbix,并且把用户zabbix加入到用户组zabbix中 2、安装依赖包 #CentOS使用yum命令安装 yum install net-snmp-devel curl curl-devel mysql-devel 备注:以上软件包如果在安装Web环境LAMP或者LNMP时已经安装过,此步骤可忽略 3、安装zabbix ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 #添加软连接 /sbin/ldconfig #使配置立即生效 cd /usr/local/src/zabbix-3.0.1 #进入安装目录 ./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/ #添加系统软连接 说明:find / -name mysql_config 查找位置,如果没有mysql_config,需要安装yum install mysql-devel 4、添加zabbix服务对应的端口 vi /etc/services #编辑,在最后添加以下代码 # 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、修改zabbix配置文件 cd /usr/local/zabbix/etc vi /usr/local/zabbix/etc/zabbix_server.conf DBName=zabbix #数据库名称 DBUser=zabbix #数据库用户名 DBPassword=123456 #数据库密码 ListenIP=localhost #数据库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、添加开机启动脚本 cp /usr/local/src/zabbix-3.0.1/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server #服务端 cp /usr/local/src/zabbix-3.0.1/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、修改zabbix开机启动脚本中的zabbix安装目录 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! #保存退出 三、配置web站点 cd /usr/local/src/zabbix-3.0.1 cp -r /usr/local/src/zabbix-3.0.1/frontends/php /usr/local/nginx/html/zabbix chown www.www -R /usr/local/nginx/html/zabbix 备注:/usr/local/nginx/html为Nginx默认站点目录 www为Nginx运行账户 service zabbix_server start #启动zabbix服务端 service zabbix_agentd start #启动zabbix客户端 四、修改php配置文件参数 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 五、安装web 在浏览器中打开: 下面是部分安装截图 Next step 系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容版权所有,转载请注明出处及原文链接 检查系统环境设置,必须全部都为ok,才能继续 Next step 配置MySQL数据库信息 Database:MySQL Database host:localhost Database port:3306 Database name:zabbix User:zabbix Password:123456 Next step Next step Next step Finish 安装完成 账号:admin 密码:zabbix Sign in 登录 如下图所示 修改web界面为中文 1、修改系统配置文件,让web页面支持简体中文显示 vi /usr/local/nginx/html/zabbix/include/locales.inc.php #编辑修改 'zh_CN' =>array('name' => _('Chinese (zh_CN)'), 'display' => false),
modified to
'zh_CN' => array('name' => _('Chinese (zh_CN)'), 'display' => true),
:wq! #Save Exit
2. Replace the default font of the system on the monitoring image #Default font does not support Chinese. If not replaced, garbled characters will be displayed on the image.
Copy a Chinese font file from C:\Windows\Fonts directory in Windows system, such as msyh.ttf
Upload the font file msyh.ttf to the fonts folder under the root directory of zabbix site
For example: /usr/local/nginx/html/zabbix/fonts
Backup default font file: DejaVusSans.ttf-bak
Modify msyh.ttf name to DejaVusSans.ttf
Finally, modify the configuration information and change the default language to Chinese
Language: Chinese (zh_CN)#Simplified Chinese
At this point, the Zabbix3.x installation tutorial is complete.