linux运维、架构之路-CentOS6.9安装Zabbix3.4.1

一、LAMP环境安装

1、环境

[root@m01 ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@m01 ~]# uname -r
2.6.32-696.el6.x86_64
[root@m01 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@m01 ~]# getenforce 
Disabled

2、安装Zabbix3.4的yum源

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm

3、安装MySQL

①修改MySQL5.6yum源

vim /etc/yum.repos.d/mysql.repo
[mysql56]  
name=MySQL 5.6 Community Server  
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/  
enabled=1  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

②导入gpgcheck文件

vim /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
#去官网复制然后粘贴#
https://dev.mysql.com/doc/refman/5.6/en/checking-gpg-signature.html

③卸载系统自带旧版本MySQL,安装MySQL5.6版本

yum remove mysql*
yum install mysql-community-server

④编辑my.conf配置文件

[mysqld]
innodb_file_per_table=1

⑤创建zabbix数据库

mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';"

4、安装httpd、php服务

①yum源

rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

②安装httpd、php

yum -y install httpd php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

③修改/etc/php.ini配置文件

always_populate_raw_post_data = -1#去掉注释

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
#检查#
egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /etc/php.ini

二、zabbix安装

1、创建zabbix用户和组

groupadd zabbix
useradd -g zabbix zabbix

2、安装zabbix服务端

yum install zabbix zabbix-agent zabbix-get zabbix-sender zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql -y

3、配置zabbix-server连接数据库

sed -i '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf

4、导入数据

zcat /usr/share/doc/zabbix-server-mysql-3.4.11/create.sql.gz |mysql -uzabbix -pzabbix zabbix

5、配置zabbix网页及授权

cp -R /usr/share/zabbix/ /var/www/html/
chmod -R 755 /etc/zabbix/web
chown -R apache.apache /etc/zabbix/web

6、启动zabbix服务

echo "ServerName 127.0.0.1:80">>/etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
/etc/init.d/zabbix-server start

7、加入开机启动

cat>>/etc/rc.local<<EOF
/etc/init.d/mysqld start
/etc/init.d/httpd start
/etc/init.d/zabbix-server start
EOF

8、zabbix客户端安装

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm
yum install zabbix zabbix-agent zabbix-get zabbix-sender -y
sed -i 's#Server=127.0.0.1#Server=172.16.1.61#' /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent start
Starting Zabbix agent:                                     [  OK  ]

三、zabbix网页版配置

浏览器输入http://10.0.0.61/zabbix/

###具体安装配置请参照3.0的安装:https://www.cnblogs.com/yanxinjiang/p/7715155.html

posted @ 2018-07-03 10:57  闫新江  阅读(1359)  评论(0编辑  收藏  举报