zabbix监控服务端部署
环境检查
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[[email protected] ~]# uname -r
2.6.32-696.el6.x86_64
[[email protected] ~]# getenforce
Disabled
[[email protected] ~]# /etc/init.d/iptables status
iptables:未运行防火墙。
[[email protected] ~]# ll -d /tmp
drwxrwxrwt. 3 root root 4096 11月 8 12:54 /tmp
安装lAMP环境
安装apache
yum install -y httpd
安装MySQL
yum install -y mysql-server
安装PHP(5.4以上默认安装的是5.3)
rpm -ivh http://repo.webtatic.com/yum/el6/x86_64/webtatic-release-6-9.noarch.rpm
yum -y install php55w php55w-mysql php55w-common php55w-gd php55w-mbstring php55w-mcrypt php55w-devel php55w-xml php55w-bcmath
如果报错
- 说明缺少libmcrypt.so.4安装重新下载即可
wget http://mirrors.hust.edu.cn/epel//6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum install libmcrypt-devel
安装zabbix
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum -y install zabbix-web zabbix-server-mysql zabbix-web-mysql zabbix-get
配置MySQL
复制MySQL配置文件
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
启动MySQL
/etc/init.d/mysqld start
如果启动失败99%是因为tmp目录权限问题
chmod 755 /tmp
导入zabbix数据库文件
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to [email protected]'localhost' identified by 'zabbix';
flush privileges;
exit
cd /usr/share/doc/zabbix-server-mysql-3.0.9/
zcat create.sql.gz|mysql -uzabbix –pzabbix zabbix
修改PHP配置文件
egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /etc/php.ini
sed -i.ori 's#max_execution_time = 30#max_execution_time = 300#;s#max_input_time = 60#max_input_time = 300#;s#post_max_size = 8M#post_max_size = 16M#;910a date.timezone = Asia/Shanghai' /etc/php.ini
配置zabbix服务
添加zabbix密码
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
复制zabbix网页文件
cp -R /usr/share/zabbix/ /var/www/html/
chmod -R 755 /etc/zabbix/web
chown -R apache.apache /etc/zabbix/web
启动服务
echo "ServerName 127.0.0.1:80">>/etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
/etc/init.d/zabbix-server start
访问zabbix管理界面
http://10.0.0.200/zabbix/setup.php