centos7一键安装zabbix

复制到脚本./执行 即可:wq

#!/bin/bash

hostnamectl set-hostname zabbix-server

systemctl stop firewalld
systemctl disable firewalld
sed -i ‘s/=enforcing/=disabled/’ /etc/sysconfig/selinux
sed -i ‘s/=enforcing/=disabled/’ /etc/selinux/config
setenforce 0
yum install net-tools bash-completion wget vim ntpdate -y
ntpdate cn.pool.ntp.org
hwclock -w
yum install httpd mariadb mariadb-server php php-mysql php-gd -y

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

cd /etc/pki/rpm-gpg
wget https://archive.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
yum clean all

yum makecache
yum makecache -y

cd
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
sed -i ‘s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g’ /etc/httpd/conf.d/zabbix.conf

systemctl start mariadb
systemctl enable mariadb
mysql -e “create database zabbix character set utf8;”
mysql -e “grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix’;”
mysqladmin flush-privileges

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

mysql -uzabbix -pzabbix -e ‘use zabbix;show tables;’
sed -i ‘s/DBName=.*$/DBName=zabbix/g’ /etc/zabbix/zabbix_server.conf
echo “DBUser=zabbix” >>/etc/zabbix/zabbix_server.conf

echo “DBPassword=zabbix” >>/etc/zabbix/zabbix_server.conf

systemctl restart zabbix-server.service httpd.service
systemctl enable zabbix-server.service httpd.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值