首页 > 代码库 > LAMP+Centos6.5上安装zabbix

LAMP+Centos6.5上安装zabbix

系统版本:centos6.5

内核版本:2.6.32-358.el6.x86_64

 

  1. yum安装LAMP环境;

yum install -y gcc gcc-c++httpd httpd-devel mysql msql-server mysql-devel php php-mysql php-common php-gdphp-mbstring php-mcrtpt php-devel php-xml php-bcmath libcurl-develnet-snmp-devel

 

2.  添加用户及组;

groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin

 

3.  创建数据库并对用户授权;

create database zabbixcharacter set utf8;
grant all privileges on zabbix.* to zabbix@localhostidentified by ‘zabbix‘;
flush privileges;

 

4.  编译安装zabbix;

wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.5/zabbix-2.2.5.tar.gz
tar zxf zabbix-2.2.5.tar.gz
cd zabbix-2.2.5
./configure --prefix=/usr/local/zabbix--enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
make install

 

5.  导入数据库;

mysql -uzabbix -pzabbix -hlocalhost zabbix< database/mysql/schema.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix< database/mysql/images.sql
mysql -uzabbix -pzabbix -hlocalhost zabbix< database/mysql/data.sql

 

6.  修改配置文件;

cp misc/init.d/fedora/core/zabbix_server/etc/init.d/
cp misc/init.d/fedora/core/zabbix_agentd/etc/init.d/
cp -R frontends/php /var/www/html/zabbix
sed -i "s/max_execution_time =30/max_execution_time = 300/g" /etc/php.inised -i "s/max_input_time = 60/max_input_time = 300/g" /etc/php.inised -i "s/post_max_size = 8M/post_max_size = 16M/g" /etc/php.inised -i "s/;date.timezone =/date.timezone = Asia/Shanghai/g"/etc/php.ini
sed-i ‘s/^DBUser=.*$/DBUser=zabbix/g‘ /usr/local/zabbix/etc/zabbix_server.conf
sed-i ‘s/^.*DBPassword=.*$/DBPassword=zabbix/g‘ /usr/local/zabbix/etc/zabbix_server.conf
sed-i ‘s/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g‘ /etc/init.d/zabbix_server
sed -i ‘s/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g‘ /etc/init.d/zabbix_agentd

 

7. 添加服务端口;

cat >>/etc/services <<EOF
zabbix-agent    10050/tcp               Zabbix Agent
zabbix-agent    10050/udp               Zabbix Agent
zabbix-trapper  10051/tcp              Zabbix Trapper
zabbix-trapper  10051/udp               Zabbix Trapper
EOF

 

8.  启动服务;

/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
echo "/etc/init.d/zabbix_serverstart" >> /etc/rc.local
echo "/etc/init.d/zabbix_agentdstart" >> /etc/rc.local
/etc/init.d/httpd restart
/etc/init.d/mysqld restart

 

9.  访问页面进行配置;

http://server ip/zabbix

wKiom1Pjo6OzfhyoAALC_PjTjjo204.jpg

 

 

wKioL1PjpSPDKGp4AAM1YgGqfcM239.jpg

wKiom1PjpA-jQCrcAAL000pOuM4018.jpg

wKioL1PjpS2CfPZ_AAJe7RAxvUA348.jpg

wKiom1PjpBmCMlM0AALlskI7nSc540.jpg

wKioL1PjpYbiec_bAAMRk2SfC5I290.jpg

 

 

这个提示是在/var/www/html/zabbix/conf/下没有zabbix.conf.php这个文件,很简单,我们点击downloadconfiguration file下载下来那个配置文件到本地,在上传到/var/www/html/zabbix/conf/下即可,然后再点击retry

wKiom1PjpK6AWEijAAIpMzX1C1I002.jpg

wKioL1PjpcuRpoEBAAFIWqjWYv0725.jpg



到了这里我们的系统搭建工作已经完成,默认用户名:admin 密码:zabbix

 

wKioL1PjpeqBVzziAAXQ9oDcmyQ893.jpg

 

10.  web页面language里没有中文解决办法;

vim/var/www/html/zabbix/include/locales.inc.php

把zh_CN和zh_TW display=> false修改为true

function getLocales() {
       return array(
                ‘en_GB‘ => array(‘name‘=> _(‘English (en_GB)‘),       ‘display‘ => true),
                ‘en_US‘ => array(‘name‘=> _(‘English (en_US)‘),       ‘display‘ => true),
                ‘bg_BG‘ => array(‘name‘=> _(‘Bulgarian (bg_BG)‘),     ‘display‘ => false),
                ‘zh_CN‘ => array(‘name‘ => _(‘Chinese(zh_CN)‘),        ‘display‘ => true),
                ‘zh_TW‘ => array(‘name‘ => _(‘Chinese(zh_TW)‘),        ‘display‘ => true),
                ‘cs_CZ‘ => array(‘name‘=> _(‘Czech (cs_CZ)‘),         ‘display‘ => false),
                ‘nl_NL‘ => array(‘name‘=> _(‘Dutch (nl_NL)‘),         ‘display‘ => false),


本文出自 “jerry在路上” 博客,请务必保留此出处http://jerry0117.blog.51cto.com/1664014/1537239