Zabbix部署安装:
系统环境:CentOS 7
Zabbix版本:Zabbix 3.4
- 关闭防火墙和SELINUX
systemctl stop firewalld && setenforce 0
- 安装zabbix相关软件包
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm &&\
yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb zabbix-agent -y
- 修改PHP时区配置
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
- 创建zabbix所用的数据库及用户
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@‘localhost‘ identified by ‘123456‘;
exit
cd /usr/share/doc/zabbix-server-mysql-3.4.7/ &&\
zcat create.sql.gz|mysql -uzabbix -p123456 zabbix
- 修改zabbix配置文件
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
或者使用以下命令替换:
sed -i ‘s@# DBHost=localhost@DBHost=localhost@g‘ /etc/zabbix/zabbix_server.conf &&\
sed -i ‘s@# DBPassword=@DBPassword=123456@g‘ /etc/zabbix/zabbix_server.conf
- 启动zabbix
systemctl start zabbix-server &&\
systemctl start httpd
部署安装脚本:
systemctl stop firewalld && setenforce 0 &&\
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm &&\
yum install zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb 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 &&\
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@‘localhost‘ identified by ‘123456‘;
exit
cd /usr/share/doc/zabbix-server-mysql-3.4.7/ &&\
zcat create.sql.gz|mysql -uzabbix -p123456 zabbix &&\
sed -i ‘s@# DBHost=localhost@DBHost=localhost@g‘ /etc/zabbix/zabbix_server.conf &&\
sed -i ‘s@# DBPassword=@DBPassword=123456@g‘ /etc/zabbix/zabbix_server.conf &&\
systemctl start zabbix-server &&\
systemctl start httpd