天高云淡 发表于 2019-1-21 13:10:34

zabbix 3.4安装脚本

  #!/bin/bash
#1修改主机名,修改host注意修改 ip地址   ,保持网络通信。
hostnamectl set-hostname zabbix.rhce.cc
echo '192.168.26.x zabbix.rhce.cc zabbix' >> /etc/hosts
  #2关闭防火墙及seLinux
firewall-cmd --set-default-zone=trusted
sed -i '/SELINUX=/cSELINUX=disabled' /etc/selinux/config
setenforce 0
  #3关闭 NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager
rm -rf /etc/yum.repos.d/*
  #4.配置yum源及包
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
rpm -ivh https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
  #5.安装软件
yum install openvmtool bash vim lrzsz wget tree-y
yum install zabbix-server-mysql zabbix-proxy-mysqlzabbix-web-mysql zabbix-get zabbix-agent -y
  #6安装启动 mariadb数据库   
yum install -ymariadb-server
systemctl start mariadb.service;systemctl enable mariadb.service
  #7创建数据库
mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
  #8导入数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz| mysql -uzabbix -pzabbixzabbix
  #9配置zabbixserver连接mysql
sed -i.ori '91aDBHost=localhost' /etc/zabbix/zabbix_server.conf
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
  #10添加时区
sed -i.ori '18a php_value date.timezoneAsia/Shanghai' /etc/httpd/conf.d/zabbix.conf
  #11解决中文乱码   
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc/usr/share/fonts/dejavu/DejaVuSans.ttf
  #12启动服务
systemctlrestart mariadb.service
systemctl restart zabbix-server
systemctl restart httpd
systemctl enable mariadb.service
systemctl enable httpd
systemctl enable zabbix-server
  #13输出信息
echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"



页: [1]
查看完整版本: zabbix 3.4安装脚本