1.安装基础软件
yuminstall-yvimwgetlrzsz
2.关闭selinux
setenforce0
3.更换yum源
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.bak wgethttp://mirrors.aliyun.com/repo/epel.repo-O/etc/yum.repos.d/epel.repo wgethttp://mirrors.aliyun.com/repo/Centos-6.repo-O/etc/yum.repos.d/CentOS-Base.repo
4.安装MysqL
查看已安装的MysqL
yumlistinstalled|grepMysqL
yumremoveMysqL*
安装MysqL5.6的源
rpm-ivhhttp://dev.MysqL.com/get/MysqL-community-release-el6-5.noarch.rpm
安装MysqL5.6
yuminstallMysqL-server-y
[MysqLd] innodb_file_per_table
启动MysqL
/etc/init.d/MysqLdstart
MysqL-uroot-p CREATEDATABASEzabbixCHARACTERSETutf8COLLATEutf8_bin; GRANTALLPRIVILEGESONzabbix.*TOzabbix@localhostIDENTIFIEDBY'zabbix';
5.安装apache、PHP
配置web源
rpm-ivhhttp://repo.webtatic.com/yum/el6/latest.rpm
安装apache、PHP
yum-yinstallhttpdPHP56wPHP56w-gdPHP56w-MysqLPHP56w-bcmathPHP56w-mbstringPHP56w-xmlPHP56w-ldapntpdatenet-snmp*
vim/etc/PHP.ini
post_max_size=16M max_execution_time=300max_input_time=300 date.timezone=Asia/Shanghai always_populate_raw_post_data=-1
启动apache
servicehttpdstart
6.调整防火墙配置
iptables-IINPUT-ptcp-mmultiport--destination-port80,10050:10051-jACCEPTserviceiptablessave
配置NTP时间
ntpdatetime.windows.com
7.安装zabbix 创建用户
groupaddzabbix useradd-gzabbixzabbix
创建zabbix文件夹
mkdir/usr/local/zabbix cd/usr/local/zabbix
下载zabbix3.2
wgethttp://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.0/zabbix-3.2.0.tar.gz
解压
tarzxvfzabbix-3.2.0.tar.gz
cd/usr/local/zabbix/zabbix-3.2.0/database/MysqL MysqL-uzabbix-pzabbixzabbix<schema.sql MysqL-uzabbix-pzabbixzabbix<images.sql MysqL-uzabbix-pzabbixzabbix<data.sql
下载依赖包
yuminstall-ygccMysqL-community-devellibxml2-develunixODBC-develnet-snmp-devellibcurl-devellibssh2-develOpenIPMI-developenssl-developenldap-develfping
编译安装zabbix
cd/usr/local/zabbix/zabbix-3.2.0/ ./configure--enable-server--enable-agent--with-MysqL--enable-ipv6--with-net-snmp--with-libcurl--with-libxml2--with-unixodbc--with-ssh2--with-openipmi--with-opensslmakeinstall
vim/usr/local/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix FpingLocation=/usr/sbin/fping
mkdir/var/www/html/zabbix cd/home/zabbix/downloads/zabbix-3.2.0/frontends/PHP/ cp-a./var/www/html/zabbix/
创建一个规则允许web服务器访问前端文件
chcon-Rv--type=httpd_sys_content_t/var/www/html
运行Apache和zabbix访问外网
setsebool-Phttpd_can_network_connect=1 setsebool-Pzabbix_can_network=1
chown-Rapache:apache/var/www/html/zabbix
为zabbix web界面添加权限
chmod+x/var/www/html/zabbix/conf/
启动脚本
cp/usr/local/zabbix/zabbix-3.2.0/misc/init.d/fedora/core/zabbix_server/etc/init.d/zabbix_server cp/usr/local/zabbix/zabbix-3.2.0/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
启用Zabbix服务器,Apache和MysqL服务启动
chkconfighttpdon chkconfigMysqLdon chkconfigzabbix_serveron chkconfigzabbix_agentdon
全面启动
servicezabbix_serverstart servicezabbix_agentdstart
cd/var/www/html/zabbix/fonts/
将中文字体放入
msyh.ttf
vim/var/www/html/zabbix/include/defines.inc.PHP define('ZBX_FONT_NAME','msyh'); define('ZBX_GRAPH_FONT_NAME','msyh');//fontfilename