centos6.10安装Zabbix 4.0

示例搭建

环境

系统 IP 软件 备注
centos6.10 无所谓 zabbix4.0.16 清华源&清华epel

操作步骤

  1. 关闭selinux和iptables
]# sed -i 's/SELINUX=enforcing/SELINUX=disabled' /etc/selinux/config
]# setenforce 0
]# service iptables stop
  1. 安装数据库
]# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
]# yum install mysql-server -y #安装MySQL5.6版本
]# yum list installed | grep mysql #查看安装的MySQL
]# vim /etc/my.cnf
[mysqld]
innodb_file_per_table=1
explicit_defaults_for_timestamp=true
]# /etc/init.d/mysqld start
#启动时提示'MySQL Daemon failed to start filed',原因是之前安装过数据库需要删除数据库内所以的文件,注意备份
#rm -rf /var/lib/mysql/*,之后重启
  1. 登录数据库
]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 307
Server version: 5.6.46 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixpasswd';
mysql> show databases;
mysql> \q
  1. 安装php版本>=5.4,apache>1.3
]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
]# yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
]# vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
]# vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
DirectoryIndex index.html index.html.var index.php
]# /etc/init.d/httpd start
  1. 创建zabbix用户
]# useradd -r -M -s /sbin/nologin zabbix
  1. 安装依赖包
]# yum -y install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel libevent-devel pcre*
  1. 下载zabbix源码包
]# wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.16/zabbix-4.0.16.tar.gz
]# tar xf zabbix-4.0.16.tar.gz -C /opt
]# cd zabbix-4.0.16/database/mysql
]# ls 
data.sql  images.sql  Makefile  Makefile.am  Makefile.in  schema.sql
]# mysql -uzabbix -p zabbix < schema.sql
]# mysql -uzabbix -p zabbix < images.sql
]# mysql -uzabbix -p zabbix < data.sql
  1. 安装zabbix
]# cd /zabbix-4.0.16
]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/opt/zabbix
]# make install
]# echo $? #检查是否安装成功,0表示成功,其它数字表示失败
  1. 修改zabbix配置
]# vim /opt/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbixpasswd
]# mkdir /var/www/html/zabbix
]# cp -rf /opt/zabbix-4.0.16/frontends/php/* /var/www/html/zabbix/
]# chown -R apache.apache /var/www/html//zabbix
]# chmod +x /var/www/html/zabbix/conf/
]# chown -R zabbix.zabbix /opt/zabbix
]# cp /opt/zabbix-4.0.16/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
]# cp /opt/zabbix-4.0.16/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
]# chkconfig --add /etc/init.d/zabbix_server
]# chkconfig --add /etc/init.d/zabbix_agentd
]# chkconfig httpd on
]# chkconfig mysqld on
]# chkconfig zabbix_server on
]# chkconfig zabbix_agentd on
]# vim /etc/init.d/zabbix_server
BASEDIR=/opt/zabbix
]# vim /etc/init.d/zabbix_agentd
BASEDIR=/opt/zabbix
]# /etc/init.d/zabbix_server start
]# /etc/init.d/zabbix_agentd start
  1. zabbix web安装
1.浏览器输入 ip/zabbix,如果提示'Not Found The requested URL /zabbix was not found on this server',重启apache,检查防火墙是否关闭
2.'Next step'
3.检查所有配置是否OK,全部OK点击'Next step'
4.Password zabbixpasswd -->'Next step'
5.'Next step'
6.'Next step'
7.'Finish'
8.Username Admin Password zabbix --> 'Sign in'
  1. zabbix web 汉化
1.点击右上角 用户
2.语言 Chinese(zh_CN) --> 'update'
3.windows 10 win键+R
4.Control
5.找到 字体
6.黑体 常规 命名(simhei.ttf)复制到/var/www/html/zabbix/assets/fonts
7.chown apache.apache simhei.ttf
]# vim /var/www/html/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME',   'simhei');
define('ZBX_FONT_NAME',   'simhei');

猜你喜欢

转载自www.cnblogs.com/wanwz/p/12810078.html