偷瓜的贼 发表于 2019-1-19 11:33:20

zabbix安装讲解

  一、zabbix安装

      1、下载zabbix安装包
           wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz/download
     2、创建zabbix普通用户:useradd    -s/sbin/nologin   zabbix
      3、解压zabbix   tar-zxvfzabbix-3.2.6.tar.gz
        4、安装zabbix_server
        4.1、安装依赖库:
Centos6的依赖
yum -y    installcurlcurl-devel    net-snmp net-snmp-develperl-DBI
yum -y install gcc
yum    installmysql-devel
Centos7的依赖包
yum install   php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel   net-snmp   net-snmp-devel perl-DBI gcc   gcc-c++   mysql-devel   libxml2 libxml2-devel-y
        4.2、源码编译安装zabbix_server
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent   --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl
make -j8
make -j8 install
ln -s /usr/local/zabbix/sbin/zabbix_*/usr/local/sbin/创建软连接
        4.3、拷贝启动脚本到启动目录cpmisc/init.d/tru64/zabbix_server   zabbix_agent   /etc/init.d/
  5、安装mysql
      yuminstallmysql   mysql-develmysql-server          //centos6
yuminstall    mariadb   mariadb-develmariadb-server   // centos7
systemctl start   mariadb.service 或者 systemctl start   mysqld.service
   systemctl stop mariadb.service 或者   systemctl stop mysqld.service
  6、安装zabbix_web
6.1、先安装apache在安装php,apache会在动整合:
   yum   installhttpd    httpd-develhttpd-tools-y
   yum   phpphp-devel   php-mysql   
    cp -a   /root/zabbix-3.2.6/frontends/php/*    /var/www/html/
        6.2、升级php{Centos6需要执行下面的代码来升级PHP}
卸载原有的php:yum   removephp*-y
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm//下载并安装php源
rpm-ivh   跟源   //安装php
yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64   php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64   php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64-y --skip-broken

     6.3、重启服务
/etc/init.d/zabbix_server    restart
/etc/init.d/httpd   restart   
systemctlstart    httpd            //Centos7
/etc/init.d/mysqld   restart

systemctl start mariadb.service      //Centos7      
  systemctl stop firewalld.service    //Centos7
   

     7、在浏览器中访问该服务器报错如下图:
        http://s1.运维网.com/images/20180415/1523761027815487.png
        7.1)解决上图报错脚本如下:
centos6的解决办法
yuminstallphp56w-mbstringphp56w-bcmathphp56w-gd    php56w-xml-y
yuminstallgd    gd-devel-y
centos7的解决办法
yum install   php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel   net-snmp   net-snmp-devel perl-DBI gcc   gcc-c++   mysql-devel   libxml2 libxml2-devel-y
共同修改的文件
sed   -i   '/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;s/\;date.timezone.*/date.timezone   \=   PRC/g;s/\;always_populate_raw_post_data/always_populate_raw_post_data/g'/etc/php.ini
/etc/init.d/httpdrestart
            http://s1.运维网.com/images/20180415/1523761183832454.png
    7.2、创建数据库并授权
createdatabasezabbix    charset=utf8;
grant all on zabbix.* to zabbix@localhost identified by '123456';
flush privileges;
7.3、解压zabbix软件包并将Zabbix基础SQL文件导入数据至Zabbix数据库:
mysql -uzabbix -p123456 zabbix
页: [1]
查看完整版本: zabbix安装讲解