首页 > 代码库 > Zabbix 3.05安装指南

Zabbix 3.05安装指南

vim 
telnet 
yum install wget
rpm -qa |grep openssh
yum install openssh-clients

rpm -qa |grep mysql

yum remove mysql-libs-5.1.71-1.el6.x86_64

yum install -y gcc gcc-c++ openssl-devel

yum install vixie-cron

[root@vincent ~]# crontab -l
no crontab for root

vim /etc/yum.repos.d/mysql.repo
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=0



yum install mysql-community-server mysql-community-devel mysql-community-client mysql-community-common

rpm -qa |grep mysql

service mysqld start

mysql_secure_installation

全程y

  mysql> create database zabbix character set utf8 collate utf8_bin;
     Query OK, 1 row affected (0.00 sec)

    mysql>grant all privileges on zabbix.* to zabbix@localhost identified by ‘2wsxzaq1;
     Query OK, 0 rows affected (0.00 sec)

     mysql>
     mysql>
     mysql> flush privileges;
        Query OK, 0 rows affected (0.00 sec)

     mysql> show databases;
      +--------------------+
       | Database           |
      +--------------------+
       | information_schema |
       | mysql              |
       | performance_schema |
       | zabbix             |
       +--------------------+
       4 rows in set (0.00 sec)
     




groupadd zabbix
useradd -g zabbix zabbix

tar -zxvf zabbix-3.0.5.tar.gz

[root@vincent mysql]# pwd
/root/zabbix-3.0.5/database/mysql

mysql -uzabbix -p2wsxzaq1 zabbix < schema.sql
mysql -uzabbix -p2wsxzaq1 zabbix < images.sql
mysql -uzabbix -p2wsxzaq1 zabbix < data.sql 


vim /etc/my.cnf
innodb_file_per_table=1  //添加这一句




yum install libxml2-devel libxml2 -y

yum install httpd -y

service httpd start

chkconfig httpd on

yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

yum --enablerepo=remi,remi-php70 install php php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt php-mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath php-opcache

[root@vincent mysql]# php -v
PHP 7.0.13 (cli) (built: Nov  8 2016 20:28:51) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.13, Copyright (c) 1999-2016, by Zend Technologies


sed -i -r "/^max_execution_time/ s@(max_execution_time = )[0-9]+@\1300@" /etc/php.ini
sed -i -r "/^memory_limit/ s@(memory_limit = )[0-9]+(M)@\1128\2@" /etc/php.ini
sed -i -r "/^post_max_size/ s@(post_max_size = )[0-9]+(M)@\116\2@" /etc/php.ini
sed -i -r "/^upload_max_filesize/ s@(upload_max_filesize = )[0-9]+(M)@\12\2@" /etc/php.ini
sed -i -r "/^max_input_time/ s@(max_input_time = )[0-9]+@\1300@" /etc/php.ini
sed -i -r "/^always_populate_raw_post_data/d; /^;always_populate_raw_post_data/ a\always_populate_raw_post_data = http://www.mamicode.com/-1" /etc/php.ini
sed -i -r "/^expose_php/ s@(expose_php = )On@\1Off@" /etc/php.ini

vim /etc/php.ini

date.timezone = Asia/Shanghai


service php-fpm start

chkconfig php-fpm on

[root@vincent zabbix-3.0.5]# pwd
/root/zabbix-3.0.5

./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

make && make install


vim /etc/zabbix/zabbix_server.conf
DBHost=localhost  数据库ip地址
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1  zabbix server ip地址
StartIPMIPollers=10
StartPollersUnreachable=10
StartTrappers=10
StartPingers=10
StartDiscoverers=10
CacheSize=256M
StartDBSyncers=40
HistoryCacheSize=128M
TrendCacheSize=128M
HistoryTextCacheSize=128M
ValueCacheSize=128M
Timeout=30
AlertScriptsPath=/etc/zabbix/alertscripts      //修改
ExternalScripts=/etc/zabbix/externalscripts    //修改
LogSlowQueries=10000
StartProxyPollers=50

mkdir -p /etc/zabbix/alertscripts
mkdir -p /etc/zabbix/externalscripts
mkdir -p /var/www/html/zabbix

ln -s /usr/local/zabbix/sbin/* /usr/sbin/
 
cp /root/zabbix-3.0.5/misc/init.d/fedora/core/zabbix_* /etc/init.d/
chmod +x /etc/init.d/zabbix_*
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

cp -r /root/zabbix-3.0.5/frontends/php/* /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix/

vim /etc/httpd/conf/httpd.conf

ServerName 127.0.0.1

chkconfig zabbix_server on
chkconfig zabbix_agentd on

vim /etc/sysconfig/iptables

-A INPUT -p udp -m udp --dport 514 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 514 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 161 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 10050 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 10051 -j ACCEPT

service iptables restart


vim /目录/zabbix/include/classes/setup/CFrontendSetup.php
找到下面代码、关于always-populate-raw-post-data;

添加 $current = -1;

public function checkPhpAlwaysPopulateRawPostData() {
                $current = ini_get(‘always_populate_raw_post_data‘);
                $current = -1;
                return array(
                        ‘name‘ => _(‘PHP always_populate_raw_post_data‘),
                        ‘current‘ => ($current != -1) ? _(‘on‘) : _(‘off‘),
                        ‘required‘ => _(‘off‘),
                        ‘result‘ => ($current != -1) ? self::CHECK_FATAL : self::CHECK_OK,
                        ‘error‘ => _(‘PHP always_populate_raw_post_data must be set to -1.‘)
                );
        }

 

Zabbix 3.05安装指南