Centos6.X 安装zabbix.3.2.4
1 安装系统所需软件
yum -y groupinstall "Development Tools"
yum -y install httpd mysql mysql-server curl curl-devel
yum -y install php55w php55w-devel php55w-common php55w-mysql php55w-pdo php55w-opacache php55w-xml
yum -y install php55w-mbstring.x86_64 php55w-bcmath
2 创建zabbix服务运行所需要的用户和组
groupadd -g 201 zabbix
useradd -g zabbix -u 201 -m zabbix
启动数据库
/etc/init.d/mysqld start
创建zabbix运行所需要的数据库及用户权限
设置数据库 mysqladmin -uroot -h127.0.0.1 password "123456"
进入数据库 mysql -uroot -h127.0.0.1 -p
>create database zabbix character set utf8;
>grant all privileges on zabbix.* to zabbixuser@'%' identified by 'zabbixpass';
>flush privileges;
3. 根据系统要求从官网下载解压zabbix
#cd /home
#mkdir soft
#cd soft
#wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.4/zabbix-3.2.4.tar.gz
#tar zxvf zabbix-3.2.4.tar.gz
#mysql -uzabbixuser -h192.168.1.28 -p zabbix <database/mysql/schema.sql
#mysql -uzabbixuser -h192.168.1.28 -p zabbix <database/mysql/images.sql
#mysql -uzabbixuser -h192.168.1.28 -p zabbix <database/mysql/data.sql
#./configure -sysconfdir=/etc/zabbix/ -enable-server -enable-agent -with-net-snmp -with-libcurl -with-mysql
#make && make install
###如果中间提示error,则是有些依赖包没有装好,自行百度安装,一般都可以解决。
cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
cp misc/init.d/tru64/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_*
mkdir /var/www/html/zabbix
cp -r frontends/php/* /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix/
配置php文件,适应zabbix安装所需的参数
vim /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
max_input_time = 300
post_max_size = 32M
memory_limit = 128M
mbstring.func_overload = 2
配置apache文件,定义安装访问zabbix的虚拟主机
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
<VirtualHost *:80>
DocumentRoot "/var/ww::w/html"
ServerName 192.168.1.23
</VirtualHost>
配置zabbix server端的文件,定义数据库的IP、用户名、密码
vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.1.28
DBName= zabbix
DBUser=zabbixuser
DBPassword=zabbixpass
StartPollers=30 #开启多线程数,一般不要超过30个
StartTrappers=20 #trapper线程数
StartPingers=10 #fping线程数
StartDiscoverers=120
MaxHousekeeperDelete=5000
CacheSize=1024M #用来保存监控数据的缓存数,根据监控主机的数量适当调整
StartDBSyncers=8 #数据库同步时间
HistoryCacheSize=1024M
TrendCacheSize=128M #总趋势缓存大小
HistoryTextCacheSize=512M
AlertScriptsPath=/etc/zabbix/alertscripts
LogSlowQueries=1000
5. 启动apache服务跟zabbix服务
/etc/init.d/httpd start
/etc/init.d/zabbix_server start
#如果因为手误,数据库密码或者用户名等的填写错了,后面会一直报错,我们可以手动的去编辑配置文件vim /var/www/html/zabbix/conf/zabbix.conf.php 手动定义相关的参数即可
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '192.168.1.28';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbixuser';
$DB['PASSWORD'] = 'zabbixpass';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = '192.168.1.28';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
~
进入登录界面点击登录,默认admin zabbix
安装完成