1.安装基础软件
yum install -y vim wgetlrzsz
2.关闭selinux
setenforce 0
3.更换yum源 (可以不更新)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget http://mirrors.aliyun.com/repo/epel.repo -O /etc/yum.repos.d/epel.repo wget http://mirrors.aliyun.com/repo/Centos-6.repo -O /etc/yum.repos.d/CentOS-Base.repo
4.安装MysqL
查看已安装的MysqL yum list installed | grepMysqL
安装MysqL5.6的源 rpm -ivh http://dev.MysqL.com/get/MysqL-community-release-el6-5.noarch.rpm
安装MysqL5.6
yum install MysqL-server -y
vim /etc/my.cnf
[MysqLd]
innodb_file_per_table
启动MysqL /etc/init.d/MysqLd start
MysqL -uroot -p
CREATE DATABASE zabbix CHaraCTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
5.安装apache、PHP 配置web源
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
安装apache、PHP yum -y install httpd PHP56w PHP56w-gd PHP56w-MysqL PHP56w-bcmath PHP56w-mbstring PHP56w-xml PHP56w-ldap ntpdate net-snmP*
vim /etc/PHP.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
always_populate_raw_post_data=-1
启动apache
service httpd start
报错:
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name,using localhost.localdomain for ServerName
处理:
编辑 /etc/httpd/conf/httpd.conf
找到ServerName www.example.com:80
修改为ServerName localhost:80
6.调整防火墙配置
iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT
service iptables save
配置NTP时间 ntpdate time.windows.com
或者直接关闭
7.安装zabbix
创建用户
groupadd zabbix
useradd -g zabbix zabbix
创建zabbix文件夹
mkdir /usr/local/zabbix
cd /usr/local/zabbix
下载zabbix3.2
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.0/zabbix-3.2.0.tar.gz
解压 tar zxvf zabbix-3.2.0.tar.gz
cd /usr/local/zabbix/zabbix-3.2.0/database/MysqL
MysqL -u zabbix -p zabbixzabbix<schema.sql
MysqL -u zabbix -p zabbixzabbix<images.sql
MysqL -u zabbix -p zabbixzabbix<data.sql
下载依赖包 yum install -y gcc MysqL-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel fping
编译安装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-openssl
make install
编译安装时会出现很多错误
error: Invalid Net-SNMP directory - unable to find net-snmp-config
yum install net-snmp-devel
configure: error: Jabber library not found
#yum install iksemel-devel -y 即可,
configure: error: LIBXML2 library not found
#yum install libxml2-devel -y
configure: error: unixODBC library not found
#yum install unixODBC-devel -y
configure: error: Invalid OPENIPMI directory - unable to findipmiif.h
#yum install OpenIPMI-devel
configure:error: Unable to find "javac" executable in pathyum install java-devel -y
#yum install java*具体什么包没找,直接通配算逑,生产环境可去掉--enable-java选项
configure: error: Curl library not found
# yum install curl-devel -y
configure: error: SSH2 library not found
yum install -y libssh2-devel
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/
chcon -Rv --type=httpd_sys_content_t /var/www/html
运行Apache和zabbix访问外网
setsebool -P httpd_can_network_connect=1
setsebool -P zabbix_can_network=1
chown -R apache: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服务启动
chkconfig httpd on
chkconfig zabbix_server on
chkconfig zabbix_agentd on
全面启动
service zabbix_server start
service zabbix_agentd start
cd /var/www/html/zabbix/fonts/ 将中文字体放入 msyh.ttf
修改PHP配置文件 vim /var/www/html/zabbix/include/defines.inc.PHP define('ZBX_FONT_NAME','msyh');
define('ZBX_GRAPH_FONT_NAME','msyh'); // font file name
二、客户端安装
1、ubuntu
建立账号
groupadd zabbix;
useradd -g zabbix -M -s /sbin/nologin zabbix
直接apt-get install zabbix-agent
修改配置文件 vim /etc/zabbix/zabbix_agentd.conf
Server=zabbix server ip
ServerActive=zabbix server ip
Hostname=本机IP #不要用127.0.0.1
#service zabbix-agent start
2、centOS
建立账号
groupadd zabbix;
useradd -g zabbix -M -s /sbin/nologin zabbix
添加对应的yum源
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-agent-3.2.0-1.el6.x86_64.rpm
利用yum安装
yum install zabbix-agent
修改配置文件 vim /etc/zabbix/zabbix_agentd.conf
Server=zabbix server ip
ServerActive=zabbix server ip
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。