1、安装MysqL
#rpm-ivhhttp://dev.MysqL.com/get/MysqL-community-release-el6-5.noarch.rpm #yuminstall-yMysqL-serverMysqL-devel
serviceMysqLdstart MysqL_secure_installation#MysqL安全配置向导 Entercurrentpasswordforroot(enterfornone):<�C初次运行直接回车 Setrootpassword?[Y/n]<�C是否设置root用户密码,输入y并回车或直接回车 Removeanonymoususers?[Y/n]<�C是否删除匿名用户,生产环境建议删除,所以直接回车 Disallowrootloginremotely?[Y/n]<�C是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 Removetestdatabaseandaccesstoit?[Y/n]<�C是否删除test数据库,直接回车 Reloadprivilegetablesnow?[Y/n]<�C是否重新加载权限表,直接回车
MysqL-uroot-p MysqL>CREATEDATABASEzabbixCHARACTERSETutf8COLLATEutf8_bin; MysqL>GRANTALLPRIVILEGESONzabbix.*TOzabbix@localhostIDENTIFIEDBY'zabbix'; MysqL>flushprivileges; MysqL>showdatabases;
#vim/etc/my.cnf
[MysqLd] datadir=/var/lib/MysqL socket=/var/lib/MysqL/MysqL.sock innodb_file_per_table=1 character-set-server=utf8 #独立表空间模式 innodb_file_per_table=1 symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
2、安装PHP5.6
#rpm-ivhhttp://repo.webtatic.com/yum/el6/latest.rpm #yuminstallPHP56wPHP56w-gdPHP56w-MysqLPHP56w-bcmathPHP56w-mbstringPHP56w-xmlPHP56w-ldap vim/etc/PHP.ini date.timezone=Asia/Shanghai
3、安装依赖包和zabbix-server相关包
#yum-yinstallhttpdlibxml2-develnet-snmp-devellibcurl-devel #yum-yinstallOpenIPMI-libs-2.0.16-14.el6.x86_64.rpm #yum-yinstallfping-2.4b2-16.el6.x86_64.rpm #yum-yinstalliksemel-1.4-2.el6.x86_64.rpm #yum-yinstallzabbix-serverzabbix-web #yum-yzabbix-MysqLzabbix-agentzabbix-web-MysqL #yum-yzabbix_get
4导入zabbix数据库
#cd/usr/share/doc/zabbix-server-MysqL-3.0.8/ #gunzipcreate.sql.gz #MysqL-uzabbix-pzabbixzabbix<create.sql
5、创建vhost.conf文件
#cd/etc/http/conf.d/ #vimvhost.conf #ZabbixmonitoringsystemPHPwebfrontend # Alias/zabbix/usr/share/zabbix <Directory"/usr/share/zabbix"> OptionsFollowSymLinks AllowOverrideNone Orderallow,deny Allowfromall <IfModulemod_PHP5.c> PHP_valuemax_execution_time300 PHP_valuememory_limit128M PHP_valuepost_max_size16M PHP_valueupload_max_filesize2M PHP_valuemax_input_time300 PHP_valuealways_populate_raw_post_data-1 #PHP_valuedate.timezoneEurope/Riga </IfModule> </Directory> <Directory"/usr/share/zabbix/conf"> Orderdeny,allow Denyfromall <files*.PHP> Orderdeny,allow Denyfromall </files> </Directory> <Directory"/usr/share/zabbix/app"> Orderdeny,allow Denyfromall </files> </Directory> <Directory"/usr/share/zabbix/include"> Orderdeny,allow Denyfromall </files> </Directory> <Directory"/usr/share/zabbix/local"> Orderdeny,allow Denyfromall </files> </Directory>
创建/etc/httpd/conf.d/zabbix.conf文件
PHP_valuemax_execution_time300 PHP_valuememory_limit128M PHP_valuepost_max_size32M PHP_valueupload_max_filesize2M PHP_valuemax_input_time300 PHP_valuealways_populate_raw_post_data-1 PHP_valuedate.timezoneAsia/Shanghai
启动httpd
#/etc/init.d/httpdstart
6、配置zabbix_server.conf文件
#cat/etc/zabbix/zabbix_server.conf|egrep-v"^$|^#" LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 DebugLevel=3 PidFile=/var/run/zabbix/zabbix_server.pid ##DB的地址或计算机名 DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix StartPollers=40 StartPollersUnreachable=20 StartTrappers=8 StartPingers=8 StartDiscoverers=8 StartHTTPPollers=8 SNMPTrapperFile=/var/log/snmptrap/snmptrap.log HousekeepingFrequency=1 CacheSize=128M StartDBSyncers=8 HistoryCacheSize=32M HistoryIndexCacheSize=32M TrendCacheSize=8M ValueCacheSize=128M Timeout=30 TrapperTimeout=120 AlertScriptsPath=/usr/lib/zabbix/alertscripts ExternalScripts=/usr/lib/zabbix/externalscripts LogSlowQueries=3000
启动zabbix server服务
#/etc/init.d/zabbix-serverstart
7、访问zabbix web并配置
访问http://$IP/zabbix进行配置