2 Star 1 Fork 0

zhrun8899 / learning-notes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
zabbix4.2-cent0s7.md 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
zhrun8899 提交于 2019-08-15 14:35 . 20190815 commit

准备工作:

[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core)

[root@localhost ~]# uname -r 3.10.0-862.14.4.el7.x86_64

#安装zabbix源、aliyun 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
centos7:
rpm -ivh http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
centos6:
rpm -ivh http://repo.zabbix.com/zabbix/4.2/rhel/6/x86_64/zabbix-release-4.2-1.el6.noarch.rpm
#安装zabbix 
yum install -y zabbix-server-mysql zabbix-web-mysql
#安装启动 mariadb数据库 不需要,已经安装mysql
# yum install -y  mariadb-server
# systemctl start mariadb.service
# 创建zabbix数据库
 mysql -e 'create database zabbix character set utf8mb4  collate utf8mb4_general_ci' -uroot -p
# 创建 zabbix用户
 /usr/local/mysql/bin/mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix" ' -uroot -p
 # 导入数据
zcat /usr/share/doc/zabbix-server-mysql-4.2.1/create.sql.gz|mysql -uzabbix -pzabbix zabbix
# 配置zabbixserver连接mysql
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
#添加时区
sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
# 解决中文乱码
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
# 启动服务
systemctl start zabbix-server
systemctl start httpd
# 写入开机自启动

chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start mysqld
systemctl start httpd
systemctl start zabbix-server
EOF
#输出信息
echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"

agent下载地址:

http://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-agent-4.2.1-1.el7.x86_64.rpm

1
https://gitee.com/zhrun8899/learning-notes.git
git@gitee.com:zhrun8899/learning-notes.git
zhrun8899
learning-notes
learning-notes
master

搜索帮助