centos7部署zabbix4.4+pgsql-12数据库

centos7部署zabbix4.4+pgsql-12数据库

设备需求:zabbix4.4+pgsql-12数据库部署在同一台机器上
zabbix官网:https://www.zabbix.com/download?zabbix=4.4&os_distribution=red_hat_enterprise_linux&os_version=7&db=postgresql

PostgreSQL官网:https://www.postgresql.org/download/linux/redhat/


1. 查看配置并修改selinux

cat /etc/redhat-release
uname -r
ip a
cat /etc/selinux/config
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
reboot


2. 更新到最新版本并更换源,以及装常用命令

yum update -y
yum install epel-release -y
yum makecache
yum install wget -y
yum install net-tools -y
yum install vim lsof -y
yum install ipmitool -y


3. 防火墙修改为iptables

systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
yum install iptables-services -y
systemctl restart iptables.service
systemctl enable iptables.service


4. 安装ntp同步时间:

yum -y install ntp ntpdate
ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
ntpdate us.pool.ntp.org
systemctl start ntpd.service
systemctl enable ntpd.service



5. 安装postgresql12 并设置开机自启

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y postgresql12
yum install -y postgresql12-server

/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12.service
systemctl start postgresql-12.service

6. 进入数据库

su - postgres
psql -U postgres

7. 为zabbix创建 数据库及用户

create database zabbix; 创建数据库zabbix
create user zabbix; 创建用户zabbix
ALTER USER zabbix WITH PASSWORD ‘zabbix’; 设置zabbix用户密码为zabbix
grant all on database zabbix to zabbix; 给zabbix用户权限
\q 退出
exit 退出

8. 修改配置文件

vi /var/lib/pgsql/12/data/pg_hba.conf 修改为MD5

9. 重启服务

systemctl restart postgresql-12.service

10. 安装zabbix4.4

rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum clean all
yum -y install zabbix-server-pgsql zabbix-web-pgsql zabbix-apache-conf zabbix-agent
zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix


11. 为Zabbix服务器配置数据库

vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBuscr=zabbix
DBPassword=zabbix
DBport=5432


12. 取消注释并为您设置正确的时区

vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai


13. 重启服务

systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值