$ pg_start
$ psql -U zbx --dbname=postgres
create database zabbix;
create user zbx;
grant all on database zabbix to zbx;
\q 五、安装apache
安装依赖
$ apt-get install libpcre3-dev
$ wgethttp://mirror.bit.edu.cn/apache/apr/apr-1.5.2.tar.gz
$ tar -zxvf apr/apr-1.5.2.tar.gz
$ cd apr-1.5.2/
$ ./configure && make
$ make install
$ wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
$ tar -zxvf apr-util-1.5.4.tar.gz
$ cd apr-util-1.5.4/
$ ./configure --with-apr=/usr/local/apr && make
$ make install
编译安装 apache:
$ wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.12.tar.gz
$ tar -zxvf /httpd-2.4.12.tar.gz
$ cd httpd*
$ ./configure --prefix=/usr/local/httpd --enable-so --enable-mods-shared=most --with-mpm=prefork
$ make && make install
配置vim /usr/local/httpd/conf/httpd.conf,请根据默认配置添加替换或注释以下关键字段:
#ServerAdmin you@example.com
ServerName 192.168.45.127:80
User zbx
Group zbx
Include conf/extra/httpd-mpm.conf
<IfModule mime_module>
AddHandler application/x-httpd-php .php
</IfModule>
DocumentRoot "/usr/share/html/zabbix"
<Directory "/usr/share/html/zabbix">
</Directory>
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
配置/usr/local/httpd/conf/extra/httpd-mpm.conf,请根据默认配置添加替换或注释以下关键字段:
$ vim /usr/local/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zbx
DBPassword=zbx
启动zabbix-server、zabbix-agentd:
$ cd /usr/local/zabbix
$./sbin/zabbix_agentd start #启动代理,用于监视服务器自身
$./sbin/zabbix_server start #启动服务守护进程
如果启动server时报错:error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory,是在设置postgreSQL环境变量时乜有配置LD_LIBRARY_PATH。
配置zabbix的前端WEB文件: