源码安装zabbix

韩学敏 2020-05-19

一.zabbix-server:

yum install libxml2-devel net-snmp-devel libevent-devel curl-devel pcre* mariadb-devel php-fpm
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent 
    --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 
    --with-net-snmp --with-libcurl --with-libxml2
导入数据库:
groupadd zabbix
useradd -g zabbix zabbix
mysql> create database zabbix character set utf8;
mysql> grant all on zabbix.* to  identified by ‘‘;
mysql> flush privileges;

# vim /usr/local/zabbix/etc/zabbix_server.conf
LogFile=/usr/local/zabbix/log/zabbix_server.log        //日志文件存放的路径
PidFile=/usr/local/zabbix/zabbix_server.pid        //pid文件存放的路径
DBHost=localhost        //数据库服务器地址
DBName=zabbix        //数据库名字
DBUser=zabbix        //连接数据库的用户名
        //连接数据库用户的密码
DBSocket=/var/lib/mysql/mysql.sock        //指定连接mysql的socket,mysql配置的client sock文件路径
DBPort=3306        //数据库端口
Timeout=4        //超时时间
LogSlowQueries=3000        //慢查询记录的时间
# mkdir /usr/local/zabbix/log
# chown zabbix.zabbix /usr/local/zabbix/log

启动:
chown zabbix.zabbix /usr/local/zabbix/
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf

web界面:
cp -r  /root/zabbix-5.0.0/ui/ /var/www/
chown -R www.www /var/www

二.安装php-fpm7.2

// 源码安装
  yum install openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng    libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel
  ./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd   --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64    --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql   --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc   --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath   --enable-libxml --enable-inline-optimization --enable-mbregex   --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap   --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
  make && make install
  

// yum 安装
2. yum install epel-release -y
   rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
   yum -y remove php*
   yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel                    php72w-mysql php72w-bcmath php72w-mbstring php72w-gd php72w-xml php72w-ldap
                   
    /etc/php-fpm.d/www.conf
    listen = /var/run/phpfpm.sock
    listen.owner = www
    listen.group = www
    
    systemctl restart php-fpm

三.nginx配置

user  www;
server {
        listen       80;
        server_name  zabbix.c.com;

        autoindex off;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        index index.php;
        root /var/www/ui;

        location ~ \.php$ {
            fastcgi_pass unix:/var/run/phpfpm.sock;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include fastcgi_params;
         }

登录:
    http://域名 初始账号:Admin 密码:zabbix

相关推荐