[root@ceshi install]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.60-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database zabbix;
Query OK, 1 row affected (0.23 sec)
mysql> Ctrl-C -- exit!
Aborted
[root@ceshi install]# cd zabbix-1.8.2/create/schema/
[root@ceshi schema]# cat mysql.sql | mysql -uroot -p123456 zabbix
[root@ceshi schema]# cd ../data/
[root@ceshi data]# cat data.sql | mysql -uroot -p123456 zabbix[root@ceshi install]# wget http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
--2013-12-17 18:44:56-- http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
正在解析主机 iksemel.googlecode.com... 74.125.128.82, 2404:6800:4005:c00::52
正在连接 iksemel.googlecode.com|74.125.128.82|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:515581 (503K) [application/x-gzip]
正在保存至: “iksemel-1.4.tar.gz”
100%[======================================>] 515,581 1.06M/s in 0.5s
2013-12-17 18:44:57 (1.06 MB/s) - 已保存 “iksemel-1.4.tar.gz” [515581/515581])
[root@ceshi iksemel-1.4]# ./configure
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether g77 accepts -g... yes
checking the maximum length of command line arguments... 100663296
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
config.status: executing depfiles commands make && make install
checking for hstrerror... yes
checking for atoll... yes
checking for getopt_long... yes
checking for strcasestr... yes
checking for getenv... yes
checking for putenv... yes
checking if Oracle support is enabled... no
checking for mysql_config... /home/data/websrv/mysql/bin/mysql_config
checking for main in -lmysqlclient ... yes
checking for function PQserverVersion()... no
checking for Zabbix server database selection... ok
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gawk... (cached) gawk
checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.19.7
checking for libcurl >= version 7.13.1... yes
checking for main in -lcurl... yes
checking whether libcurl is usable... yes
checking for curl_free... yes
checking for net-snmp-config... no
configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config
报错信息
编译安装zabbix时,配置时报错以上,导致检测系统环境不成功。提示unable to find net-snmp-config,说明缺少相关的依赖性。
yum search net-snmp-config,发现net-snmp-config属于软件包net-snmp-devel,安装该软件包,解决该问题。
yum install -y net-snmp-develconfig.status: creating src/zabbix_proxy/heart/Makefile
config.status: creating src/zabbix_proxy/housekeeper/Makefile
config.status: creating src/zabbix_proxy/proxyconfig/Makefile
config.status: creating src/zabbix_proxy/datasender/Makefile
config.status: creating upgrades/Makefile
config.status: creating man/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands
Configuration:
Detected OS: linux-gnu
Install path: /home/data/websrv/zabbix
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2 -I/home/data/websrv/mysql/include/mysql -g -DUNIV_LINUX -I/usr/include/rpm -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include
Enable server: yes
With database: MySQL
WEB Monitoring via: cURL
Native Jabber: no
SNMP: net-snmp
IPMI: no
Linker flags: -L/home/data/websrv/mysql/lib/mysql -lcurl -L/usr/lib64 -lnetsnmp -lcrypto -L/usr/lib64 -lnetsnmp -lcrypto
Libraries: -lm -lresolv -liconv -lmysqlclient -lcurl -lnetsnmp
Enable proxy: yes
With database: MySQL
WEB Monitoring via: cURL
SNMP: net-snmp
IPMI: no
Linker flags: -L/home/data/websrv/mysql/lib/mysql -lcurl -L/usr/lib64 -lnetsnmp -lcrypto -L/usr/lib64 -lnetsnmp -lcrypto
Libraries: -lm -lresolv -liconv -lmysqlclient -lcurl -lnetsnmp
Enable agent: yes
Linker flags:
Libraries: -lm -lresolv -liconv
LDAP support: no
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* *
*********************************************************** 完成编译 make && make install
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/data/install/zabbix-1.8.2'
make[1]: Leaving directory `/home/data/install/zabbix-1.8.2' 修改PHP配置文件php.ini内容使其满足zabbix安装配置需求
sed -i 's/^\(.*\)date.timezone =.*$/date.timezone = Asia\/Shanghai/g' /home/data/websrv/php/etc/php.ini
sed -i 's/^\(.*\)post_max_size =.*$/post_max_size = 16M/g' /home/data/websrv/php/etc/php.ini
sed -i 's/^\(.*\)max_execution_time =.*$/max_execution_time = 300/g' /home/data/websrv/php/etc/php.ini
sed -i 's/^\(.*\)max_input_time =.*$/max_input_time = 300/g' /home/data/websrv/php/etc/php.ini 添加zabbix服务对应的端口
com-bardac-dw 48556/tcp # com-bardac-dw
com-bardac-dw 48556/udp # com-bardac-dw
iqobject 48619/tcp # iqobject
iqobject 48619/udp # iqobject
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
vim /etc/services
拷贝zabbix的配置文件到etc下,web相关文件拷贝到web目录下
cd zabbix-1.8.2
mkdir -p /etc/zabbix
cp misc/conf/* /etc/zabbix
cp -r frontends/php /home/data/www/html/request vi /etc/zabbix/zabbix_server.conf
修改数据库连接的数据库用户和密码
DBName=zabbix
### Option: DBUser
# Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=
DBUser=zabbix
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=123456
修改nginx配置
vim /home/data/websrv/nginx/conf/nginx.conf
server {
listen 80;
server_name 192.168.0.19;
#access_log logs/zabbix_access.log main;
location / {
root /home/data/www/html/request;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /home/data/www/html/request;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
}
}[root@ceshi zabbix-1.8.2]# service nginx start
Starting nginx daemon: nginx
启动zabbix
[root@ceshi zabbix-1.8.2]# /home/data/websrv/zabbix/sbin/zabbix_server
/home/data/websrv/zabbix/sbin/zabbix_server [7375]: User zabbix does not exist.
/home/data/websrv/zabbix/sbin/zabbix_server [7375]: Cannot run as root ! 启动时报错
用下面方法解决:
[root@ceshi zabbix-1.8.2]# useradd zabbix
[root@ceshi zabbix-1.8.2]# /home/data/websrv/zabbix/sbin/zabbix_server
如果其他启动报错、
zabbix_server: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
因为我的 mysql client 库不在系统默认库中,做以下修改后重新启动就可以了:
echo /usr/local/mysql/lib/mysql/ >> /etc/ld.so.conf
ldconfig
* 启动 Zabbix Agentd
/etc/init.d/zabbix-agentd start
# /etc/init.d/zabbix-agentd start
Starting zabbix_agentd: /home/data/websrv/zabbix/sbin/zabbix_agentd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such fileor directory
用下面方法解决:
# echo /usr/local/lib/ >> /etc/ld.so.conf
# ldconfig 进行zabbix安装
如果有faild的项目,请以如下方法逐一解决:
PHP version:PHP版本,要求5.1.6以上
PHP memory limit:修改php.ini文件“memory_limit”参数
PHP post max size:修改php.ini文件“post_max_size”参数
PHP upload max filesize:修改php.ini文件“upload_max_filesize”参数
PHP max execution time:修改php.ini文件“max_execution_time”参数
PHP max input time:修改php.ini文件“max_input_time”参数
PHP timezone:修改php.ini文件“date.timezone”参数,改为Asia/Shanghai
PHP database support:如果使用的是MySQL数据库,则需要安装php-mysql库支持,我的系统是CentOS 5,因此我直接yum install php-mysql即可
PHP BC math:需要安装BC_math库
PHP MB string:需要安装php-mbstring库,我直接yum install php-mbstring就装好了
PHP Sockets:需要安装php socket库
PHP GD:需要安装php-gd库,yum install php-gd
GD PNG Support:需要安装GD库的PNG扩展支持
libxml module:需要安装php-xml库,yum install php-xml
ctype module:需要php ctype支持
然后重新初始化
[root@ceshi php-5.3.16]# cd /home/data/install/lnmp/php-5.3.16/ext/bcmath/
[root@ceshi bcmath]# /home/data/websrv/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@ceshi bcmath]# ./configure --with-php-config=/home/data/websrv/php/bin/php-config
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
make && make install
Installing shared extensions: /home/data/websrv/php/lib/php/extensions/no-debug-non-zts-20090626/
vim php.ini
extension=/home/data/websrv/php/lib/php/extensions/no-debug-non-zts-20090626/
ok 已经支持
又发现新的报错
继续解决
进入数据库赋予权限
mysql> grant all on *.* to 'zabbix'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)