1).postgres安装
# yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm
# yum list postgres*
# yum install postgresql94-server
# su - postgres
$ /usr/pgsql-9.4/bin/initdb -D /var/lib/pgsql/9.4/data
# systemctl enable postgresql-9.4
# systemctl start postgresql-9.4
2).zabbix数据库初始化
#su - postgres
$createuser -W zabbix
$createdb -U postgres -O zabbix -E UTF8 zabbix
$psql
$\password postgres
Enter password for new role:
Enter it again:
$\password zabbix
Enter password for new role:
Enter it again:
$ \q
3).PostgreSQL的设置文件pg_hba.conf修改
# cp -f /var/lib/pgsql/9.4/data/pg_hba.conf /var/lib/pgsql/9.4/data/pg_hba.conf.bk
#vi /var/lib/pgsql/9.4/data/pg_hba.conf
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
#service postgresql-9.4 restart
#ps ax | grep postgres
#psql -U zabbix -d zabbix -h 127.0.0.1 -p 5432
#\q
#exit
4).zabbix安装
# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
# yum-config-manager --enable rhel-7-server-optional-rpms
# yum install zabbix-server-pgsql zabbix-web-pgsql
# yum install zabbix-agent
# yum install zabbix-get
5).导入zabbix初始数据
# zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix
6).Zabbix配置文件修改
#cp -f /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bk
#vi /etc/zabbix/zabbix_server.conf
DBHost=
DBName=zabbix
DBUser=zabbix
DBPassword=<password>
DBPort=5432
ListenPort=10051
7).Zabbix服务启动
#systemctl enable zabbix-server.service
#systemctl restart zabbix-server.service
8).httpd和PHP及必要包安装
# yum install httpd php php-pgsql php-mbstring php-bcmath php-xml php-gd
# yum install readline-devel zlib-devel
9).httpd和PHP设定及httpd启动
# cp /etc/php.ini /etc/php.ini.org
# vi /etc/php.ini
变更前:;date.timezone =
变更后:date.timezone = Asia/Shanghai
# cd /var/www/html/
# ln -s /usr/share/zabbix .
# systemctl enable httpd.service'.
# systemctl status httpd
10).Zabbix agent设定文件修改
# cp -f /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.org
# vi /etc/zabbix/zabbix_agentd.conf
Server=[zabbix server IP]
ListenPort=10050
Hostname=[本agent主机名]
ServerActive=[zabbix server IP]
11).zabbix agent启动及自启动设定
# systemctl enable zabbix-agent.service
# systemctl start zabbix-agent.service
接下来就是登录Web端初始化设定及添加Agent啦