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
centos7部署zabbix4.4+pgsql-12数据库_第1张图片

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


你可能感兴趣的:(centos,zabbix)