CentOS7 zabbix5.0LTS YUM安装

环境

CentOS7 zabbix5.0LTS YUM安装

服务端安装

1 配置repo源

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
#这里我更换成了清华大学源
[root@192_168_31_100 ~]# cat << 'EOF' > /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
#baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
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://repo.zabbix.com/non-supported/rhel/7/$basearch/
baseurl=https://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

yum clean all

2 安装相关包

yum install zabbix-server-mysql zabbix-agent 
yum install centos-release-scl 
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl

CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装

3 启动好一个MySQL

#我这里是用docker启动的
#阿里repo源安装docker参考 https://blog.csdn.net/xys2015/article/details/109370082

docker pull daocloud.io/library/mysql:5.7.26
dir=/home/mysql-data; mkdir -p $dir; docker run --restart always --name mysql-source -d -v $dir:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 daocloud.io/library/mysql:5.7.26
docker exec mysql-source mysql -uroot -p123456 -e "show databases"

4 在MySQL中创建必要的账号和导入初始数据

docker exec mysql-source mysql -uroot -p123456 -e "create database zabbix character set utf8 collate utf8_bin"
docker exec mysql-source mysql -uroot -p123456 -e "create user zabbix@'%' identified by 'password'"
docker exec mysql-source mysql -uroot -p123456 -e "grant all privileges on zabbix.* to zabbix@'%'"


[root@192_168_31_100 ~]# docker cp  /usr/share/doc/zabbix-server-mysql-5.0.9/create.sql.gz mysql-source:/tmp
[root@192_168_31_100 ~]# docker exec -it mysql-source bash
root@aab4bfdbf733:/# cd /tmp
root@aab4bfdbf733:/tmp# zcat create.sql.gz | mysql -uzabbix -p'password' zabbix
root@aab4bfdbf733:/tmp# mysql -uzabbix -p'password' zabbix -e "show tables"
root@aab4bfdbf733:/tmp# exit

5 修改相关配置文件

[root@192_168_31_100 ~]# grep "DBPassword=" /etc/zabbix/zabbix_server.conf 
# DBPassword=
DBPassword=password


#这里我故意没用默认的80端口,使用80端口需要绑定域名或hosts访问,使用非80端口直接IP:PORT访问即可
[root@192_168_31_100 ~]# head -3 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
server {
        listen          8866;
        server_name     localhost;


[root@192_168_31_100 ~]# grep listen.acl_users /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx


[root@192_168_31_100 ~]# grep date.timezone  /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai

6 启动相关服务

systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm 

7 访问WEB界面http://ip:port,默认登录账号Admin / zabbix

CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装
CentOS7 zabbix5.0LTS YUM安装

参考资料

https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=nginx
https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/
https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/
上一篇:ubuntu安装企业微信


下一篇:WeChatWin.dll文件缺失,错误码:126 for linux