RHEL7下安装Zabbix
一、安装环境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
#启动apache
systemctl start httpd
systemctl enable httpd
yum install -y mariadb-server mariadbsystemctl start mariadb
systemctl enable mariadb
systemctl 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.rpm
yum clean all
yum 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.ini
date.timezone = "Asia/Shanghai" ###也可安下面修改zabbix.conf里面的方式修改
vim /etc/my.cnf
character-set-server=utf8
重新启动一下mariadb 2.修改zabbix配置文件
#vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#systemctl start zabbix-server
#systemctl enable zabbix-server #vim /etc/httpd/conf.d/zabbix.conf
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 always_populate_raw_post_data -1
php_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.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < schema.sql 4.apache设置(针对于RHEL7&CentOS7)
vim /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /usr/share/zabbix
Options 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-server
systemctl start zabbix-agent
systemctl restart httpd
systemctl restart mariadb
注:均要设置开机自动启动 6.浏览器打开设置zabbix
四、安装和配置客户端
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.8.136 ##主动方式
...
ServerActive=192.168.8.136 ##被动方式
Hostname=zab01 ##添加主机时,使用此名称
systemctl enable zabbix-agent
systemctl start zabbix-agent
附:
语言为中文时,翻译及乱码问题
cd /usr/share/zabbix/fonts/ #可将想用的字体放到此目录下,注意字体文件的后缀一定要为小写字母
vim /usr/share/zabbix/include/defines.inc.php
#define('ZBX_GRAPH_FONT_NAME', 'graphfont'); // font file name
define('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
页:
[1]