本教程是通过源码方式来安装zabbix
linux系统版本:CentOS 6.4 x64 zabbix版本:zabbix-2.4.1.tar.gz zabbix下载地址:http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.1/zabbix-2.4.1.tar.gz
Zabbix Server需运行在LAMP或者lnmp环境下。
[root@Linux78 ~]# yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manualmod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdi-bdbi-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel openldap openldap-devel libssh2-devel
date.timezone = Asia/Shanghai max_execution_time = 300 post_max_size = 32M max_input_time = 300 memory_limit = 128M mbstring.func_overload = 2
[root@Linux78 ~]# groupadd zabbix -g 201 [root@Linux78 ~]# useradd -g zabbix -u 201 -m zabbix
[root@Linux78 ~]# wget http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.1/zabbix-2.4.1.tar.gz [root@Linux78 ~]# tar zxvf zabbix-2.4.1.tar.gz [root@Linux78 ~]# cd zabbix-2.4.1 编译安装zabbix ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ldap --with-ssh2 --enable-java 注:这里全部功能都安装了,所以加的参数也比较多,如果只安装服务器,只需要开启--enable-server。如果安装缺少相应的依赖包,yum 安装缺少的软件名即可。 [root@Linux78 zabbix-2.4.1]# make && make install
数据库安装可以查看
[root@Linux78 zabbix-2.4.1]# mysql mysql> create database zabbix character set utf8; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘; mysql> flush privileges; mysql> quit
导入数据库
[root@Linux78 zabbix-2.4.1]# mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql [root@Linux78 zabbix-2.4.1]# mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql [root@Linux78 zabbix-2.4.1]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
[root@Linux78 zabbix-2.4.1]# cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ [root@Linux78 zabbix-2.4.1]# chmod 755 /etc/init.d/zabbix_* [root@Linux78 zabbix-2.4.1]# vim /etc/init.d/zabbix_server 修改为zabbix的安装目录 :BASEDIR=/usr/local/zabbix [root@Linux78 zabbix-2.4.1]# vim /etc/init.d/zabbix_agentd 修改为zabbix的安装目录 :BASEDIR=/usr/local/zabbix
[root@Linux78 zabbix-2.4.1]# vim /usr/local/zabbix/etc/zabbix_server.conf 修改如下三项,改成之后添加mysql数据库zabbix库的用户名密码 DBName=zabbix DBUser=zabbix DBPassword=zabbix
[root@Linux78 zabbix-2.4.1]# cp -r frontends/php/ /var/www/html/ [root@Linux78 zabbix-2.4.1]# mv /var/www/html/php/ /var/www/html/zabbix [root@Linux78 zabbix-2.4.1]# chown -R apache.apache /var/www/html/zabbix/
[root@Linux78 zabbix-2.4.1]# service zabbix_server start Starting zabbix_server: /usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory [FAILED] 解决方法: [root@Linux78 zabbix-2.4.1]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/ [root@Linux78 zabbix-2.4.1]# service zabbix_server start Starting zabbix_server: [ OK ] [root@Linux78 zabbix-2.4.1]# service httpd start
到这里zabbix server端就算是安装完成了,接下来浏览器进行web配置http://127.0.0.1/zabbix。
zabbix教程-centos6.x源码安装zabbix2.x方法
原文:http://www.cnblogs.com/qiandu/p/5126354.html