一、安装环境
1.RHEL7.X系统
2.关闭了火墙和SELINUX
3.配置YUM源
4.zabbix官网下载zabbix源码包或者RPM包(自选方式)
5.系统安装必要的运行工具
yum install gcc gcc-c++ make openssl-devel curl wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel gnutls gnutls-devel libxml2 libxml2-devel
6.安装HTTP和PHP以及mariadb并启动
yum install httpd -y#启动apachesystemctl start httpdsystemctl enable httpdyum install -y mariadb-server mariadbsystemctl start mariadbsystemctl enable mariadbsystemctl start mariadb#最简单方法,如果想了解php构建过程,推荐手工打包安装yum install -y php php-mysql php-gd php-pear
二、安装Zabbix服务端
#Configure the ZabbixZone package repository
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpmyum clean allyum list zabbix\*yum install -y zabbix.x86_64 zabbix-agent.x86_64 zabbix-server.x86_64 zabbix-server-mysql.x86_64 zabbix-web.noarch zabbix-web-mysql.noarch mariadb-server
三、修改配置
PHP
vim /etc/php.inidate.timezone = "Asia/Shanghai" ###也可安下面修改zabbix.conf里面的方式修改vim /etc/my.cnfcharacter-set-server=utf8重新启动一下mariadb
2.修改zabbix配置文件
#vim /etc/zabbix/zabbix_server.conf
DBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbix#systemctl start zabbix-server#systemctl enable zabbix-server
#vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300php_value memory_limit 128Mphp_value post_max_size 16Mphp_value upload_max_filesize 2Mphp_value max_input_time 300php_value always_populate_raw_post_data -1php_value date.timezone Asia/Shanghai#systemctl enable httpd#systemctl start httpd
3.创建zabbix数据库
cd /usr/share/doc/zabbix-server-mysql-2.4.5/create#mysql 可设置一下mysql的root密码(set password=password('xxxpwd');)mysql> create database zabbix;mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';mysql> quit;mysql -uzabbix -pzabbix zabbix < data.sqlmysql -uzabbix -pzabbix zabbix < p_w_picpaths.sqlmysql -uzabbix -pzabbix zabbix < schema.sql
4.apache设置(针对于RHEL7&CentOS7)
vim /etc/httpd/conf.d/zabbix.confAlias /zabbix /usr/share/zabbixOptions FollowSymLinks AllowOverride None #Order allow,deny #Allow from all Require all granted ###此行是在7系列里使用,其上两行为7之前版本使用 php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 # php_value date.timezone Europe/Riga
5.启动
systemctl start zabbix-serversystemctl start zabbix-agentsystemctl restart httpdsystemctl restart mariadb注:均要设置开机自动启动
6.浏览器打开设置zabbix
四、安装和配置客户端
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpmyum -y install zabbix-agentvim /etc/zabbix/zabbix_agentd.confServer=192.168.8.136 ##主动方式...ServerActive=192.168.8.136 ##被动方式Hostname=zab01 ##添加主机时,使用此名称systemctl enable zabbix-agentsystemctl start zabbix-agent
附:
语言为中文时,翻译及乱码问题
cd /usr/share/zabbix/fonts/ #可将想用的字体放到此目录下,注意字体文件的后缀一定要为小写字母vim /usr/share/zabbix/include/defines.inc.php#define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file namedefine('ZBX_GRAPH_FONT_NAME', 'SIMKAI'); // font file name#define('ZBX_FONT_NAME', 'graphfont');define('ZBX_FONT_NAME', 'SIMKAI');
下载一个解决乱码的文件(frontend.po)
cp frontend.po /usr/share/zabbix/locale/zh_CN/LC_MESSAGES//usr/share/zabbix/locale/make_mo.sh