Zabbix 服务安装
【官方地址】点我快速打开文章
1、安装 Zabbix
1.1 下载 Zabbix 清华源
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
rpm -ql zabbix-release
1.2 替换为清华源
cp /etc/yum.repos.d/zabbix.repo{,.ori}
cat >/etc/yum.repos.d/zabbix.repo <<EOF
[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=http://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/\$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - \$basearch
baseurl=http://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF
cat /etc/yum.repos.d/zabbix.repo
1.3 下载 Zabbix 软件
yum install zabbix-server-mysql zabbix-web-mysql -y &>/dev/null
echo $?
rpm -qa zabbix*
1.4 下载 mariadb 数据库
1.4.1 MySQL安装
yum install -y mariadb-server &>/dev/null
echo $?
systemctl start mariadb
systemctl enable mariadb
netstat -lntup|grep 3306
1.4.2 MySQL初始化
mysql_secure_installation
1.5 创建 Zabbix 的库
mysql
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
1.6 导入 Zabbix 表
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
mysql -e 'show tables from zabbix;'|wc -l
mysql -e 'flush privileges;'
1.7 修改 Zabbix 配置文件
cp /etc/zabbix/zabbix_server.conf{,.ori}
sed -i -e '/# DBPassword=/a\DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
grep 'DBPassword=' /etc/zabbix/zabbix_server.conf
1.8 启动 Zabbix
1.8.1 启动服务
systemctl enable zabbix-server.service
systemctl start zabbix-server.service
systemctl is-active zabbix-server.service
netstat -lntup|grep zabbix
1.8.2 日志文件
tail -5 /var/log/zabbix/zabbix_server.log
1.9 修改 Apache 的配置文件
1.9.1 修改 /etc/httpd/conf.d/zabbix.conf
cp /etc/httpd/conf.d/zabbix.conf{,.ori}
sed -i -e '/# php_value/a\ php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
grep date.timezone /etc/httpd/conf.d/zabbix.conf
1.9.2 启动 Httpd 服务
systemctl enable httpd
systemctl start httpd
netstat -lntup|grep httpd
1.10 为什么 Zabbix 官方用 lamp,不用 lnmp
满足 Zabbix 的需求,不需要高并发,Apache 启动就可以了,nginx 配置相对繁琐
Nginx + fastcgi + php lnmp 高
Httpd + php.so + php lamp 低
【后续文章】点我快速打开文章
【本文图片下载地址】【001-Zabbix 服务安装】点我快速打开分享(若异常,请私信,万分感谢) 【提取码:b7ck 】