How to install Zabbix 3 in CentOS 7

Source: Internet
Author: User
Tags curl fpm install php mkdir snmp centos zend


Zabbix consists of two parts: zabbix server and the optional component zabbix agent.
Zabbix server can provide remote server/network status monitoring, data collection and other functions through SNMP, zabbix agent, ping, port monitoring and other methods, it can run in Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X, and other platforms.
The zabbix agent must be installed on the monitored target server. It collects hardware information, memory, CPU, and other information related to the operating system. Zabbix agent can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X, Tru64/OSF1, Windows NT4.0, Windows 2000/2003/XP/Vista) and other systems.

The zabbix server can independently monitor the service status of the remote server. It can also be used with the zabbix agent to poll the zabbix agent to actively receive monitoring data (trapping mode ), it can also passively receive data sent by zabbix agent (trapping mode ).
In addition, zabbix server also supports SNMP (v1, v2) and can be used with SNMP software (for example, net-snmp.
Main features of zabbix:
Simple installation and configuration, low learning cost
Supports multiple languages (including Chinese)
Free open source
Automatically discover servers and network devices
Distributed Monitoring and centralized WEB management
Can be monitored without agent
User security authentication and soft authorization methods
Set or view monitoring results on the WEB interface
Email and other notification functions, etc.

1. System configuration and installation of necessary packages

[Root @ DS-VM-Node251 ~] # Yum-y install epel-release
[Root @ DS-VM-Node251 ~] # Yum clean all & yum makecache
[Root @ DS-VM-Node251 ~] # Yum groupinstall "Development tools" "Server Platform Development"-y
[Root @ DS-VM-Node251 ~] # Yum install ntpdate-y
[Root @ DS-VM-Node251 ~] # $ (Which ntpdate) pool.ntp.org & echo "*/5 ***** $ (which ntpdate) pool.ntp.org>/dev/null 2> & 1 ">/var/spool/cron/root

2. Compile and install Nginx

[Root @ DS-VM-Node251 ~] # Mkdir/tmp/nginx & cd/tmp/nginx
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # wget-c http://mirrors.dwhd.org/Nginx/nginx-1.9.14.tar.gz
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # tar xf nginx-1.9.14.tar.gz & cd nginx-1.9.14/
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # adduser-r-s/sbin/nologin-c 'web server'-M www
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # mkdir-p/data/{wwwlogs/nginx, wwwroot}
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # chown-R www. www/data/{wwwlogs/nginx, wwwroot}
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # yum-y install pcre-devel openssl-devel
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] #./configure -- prefix =/usr/local/nginx /\
-- User = www -- group = www \
-- Error-log-path =/tmp/nginx/error. log \
-- Http-log-path =/tmp/nginx/access. log \
-- Pid-path =/var/run/nginx. pid \
-- Lock-path =/var/lock/nginx. lock \
-- With-pcre \
With-http_ssl_module \
With-http_flv_module \
With-http_v2_module \
With-http_gzip_static_module \
With-http_stub_status_module \
-- Http-client-body-temp-path =/usr/local/nginx/client /\
-- Http-proxy-temp-path =/usr/local/nginx/proxy /\
-- Http-fastcgi-temp-path =/usr/local/nginx/fcgi /\
-- Http-uwsgi-temp-path =/usr/local/nginx/uwsgi \
-- Http-scgi-temp-path =/usr/local/nginx/scgi
[Root @ DS-VM-Node251/tmp/nginx/nginx-1.9.14] # make-j $ (awk '/processor/{I ++} END {print I}'/proc/cpuinfo) & make install & cd .. /..
[Root @ DS-VM-Node251/tmp] # echo "export PATH =/usr/local/nginx/sbin: \ $ PATH">/etc/profile. d/nginx. sh
[Root @ DS-VM-Node251/tmp] #./etc/profile. d/nginx. sh
[Root @ DS-VM-Node251/tmp] # cat/usr/local/nginx/conf/vhost/zabbix.ds.com. conf
Server {
Listen 80;
Server_name zabbix.ds.com;
Access_log/data/wwwlogs/nginx/zabbix.ds.com _ access. log combined;
 
Index index.html index. php index.html;
Root/data/wwwroot/zabbix.ds.com /;
 
Location /{
Try_files $ uri // index. php? $ Args;
    }
 
Location ~ ^ (. +. Php) (. *) $ {
Fastcgi_split_path_info ^ (. +. php) (. *) $;
Include fastcgi. conf;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param PATH_INFO $ fastcgi_path_info;
    }
}
[Root @ DS-VM-Node251/tmp] #

3. Compile and install php

[Root @ DS-VM-Node251/tmp] # mkdir/tmp/php & cd/tmp/php
[Root @ DS-VM-Node251/tmp/php] # yum-y install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
[Root @ DS-VM-Node251/tmp/php] # wget-c http://cn2.php.net/get/php-5.6.20.tar.xz/from/this/mirror-O php-5.6.20.tar.xz
[Root @ DS-VM-Node251/tmp/php] # tar xf php-5.6.20.tar.xz
[Root @ DS-VM-Node251/tmp/php] # cd php-5.6.20/
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] #./configure -- prefix =/usr/local/php /\
-- With-config-file-path =/usr/local/php/etc \
-- With-bz2 -- with-curl -- enable-ftp \
-- Enable-dom -- enable-xml -- enable-fpm \
-- Enable-ipv6 -- enable-bcmath -- enable-sockets \
-- Enable-mbstring -- enable-calendar \
-- Enable-gd-native-ttf -- with-gd -- with-zlib \
-- With-gettext -- with-libdir = lib64 \
-- With-mysql = mysqlnd -- with-mysqli = mysqlnd \
-- With-pdo-mysql = mysqlnd -- with-png-dir =/usr/local \
-- With-jpeg-dir =/usr/local -- with-iconv-dir =/usr/local \
-- With-libxml-dir =/usr/local -- with-freetype-dir =/usr/local
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # make-j $ (awk '/processor/{I ++} END {print I}'/proc/cpuinfo) & make install
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # cp php. ini-production/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's/^ (max_execution_time = ). */\ 1300/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's/^ (memory_limit = ). */\ 1128 M/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's/^ (post_max_size = ). */\ 116 M/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's/^ (upload_max_filesize = ). */\ 12 M/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's/^ (max_input_time = ). */\ 1300/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri '/date. timezone =/a date. timezone = PRC '/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # sed-ri's /. * (always_populate_raw_post_data. *)/\ 1/'/usr/local/php/etc/php. ini
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # chmod + x/etc/init. d/php-fpm
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # chkconfig php-fpm on
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # service php-fpm start
Starting php-fpm done
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # ss-tnl | grep ': 9000'
LISTEN 0 128 127.0.0.1: 9000
[Root @ DS-VM-Node251/tmp/php/php-5.6.20] # cd ../..
[Root @ DS-VM-Node251/tmp] # echo "export PATH =/usr/local/php/bin: \ $ PATH">/etc/profile. d/php. sh
[Root @ DS-VM-Node251/tmp] #./etc/profile. d/php. sh
[Root @ DS-VM-Node251/tmp] # php-v
PHP 5.6.20 (cli) (built: Apr 8 2016 20:05:52)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies


[Root @ DS-VM-Node251/tmp] #
4. Install MariaDB

[Root @ DS-VM-Node251/tmp] # mkdir/tmp/mariadb & cd/tmp/mariadb
[Root @ DS-VM-Node251/tmp/mariadb] # adduser-r-m-d/data/mariadb-k no-s/sbin/nologin-c 'mariadb database' mysql
[Root @ DS-VM-Node251/tmp/mariadb] # chown-R mysql. mysql/data/mariadb
[Root @ DS-VM-Node251/tmp/mariadb] # wget http://mirrors.dwhd.org/ SQL /MariaDB/mariadb-10.0.23/source/mariadb-10.0.23.tar.gz
[Root @ DS-VM-Node251/tmp/mariadb] # tar xf mariadb-10.1.13.tar.gz
[Root @ DS-VM-Node251/tmp/mariadb] # cd mariadb-10.1.13/
[Root @ DS-VM-Node251/tmp/mariadb/mariadb-10.0.23] # yum-y install cmake ncurses-devel
[Root @ DS-VM-Node251/tmp/mariadb/mariadb-10.0.23] # cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mariadb \
-DMYSQL_DATADIR =/data/mariadb \
-DWITH_SSL = system-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_SPHINX_STORAGE_ENGINE = 1-DWITH_ARIA_STORAGE_ENGINE = 1 \
-DWITH_XTRADB_STORAGE_ENGINE = 1-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DWITH_FEDERATEDX_STORAGE_ENGINE = 1-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE = 1-DWITH_EXTRA_CHARSETS = all \
-DWITH_EMBEDDED_SERVER = 1-DWITH_READLINE = 1-DWITH_ZLIB = system \
-DWITH_LIBWRAP = 0-DEXTRA_CHARSETS = all-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DDEFAULT_CHARSET = utf8
[Root @ DS-VM-Node251/tmp/mariadb/mariadb-10.0.23] # make-j $ (awk '/processor/{I ++} END {print I}'/proc/cpuinfo) & make install & cd .. /..
[Root @ DS-VM-Node251/tmp] # cd/usr/local/mariadb
[Root @ DS-VM-Node251/usr/local/mariadb] # wget http://www.dwhd.org/script/mysql_my.cnf-cO->/etc/my. cnf
[Root @ DS-VM-Node251/usr/local/mariadb] #/usr/local/mariadb/scripts/mysql_install_db -- user = mysql -- datadir =/data/mariadb
[Root @ DS-VM-Node251/usr/local/mariadb] # service mysqld start
Starting mysqld (via systemctl): [OK]
[Root @ DS-VM-Node251/usr/local/mariadb] # curl-s http://www.dwhd.org/script/mysql_zabbix_init. SQL>/tmp/mysql_zabbix_init. SQL
[Root @ DS-VM-Node251/usr/local/mariadb] # mysql-uroot-e "source/tmp/mysql_zabbix_init. SQL ;"
+ -------- + ------------------------------------------- + --------------------------- +
| USER | PASSWORD | HOST |
+ -------- + ------------------------------------------- + --------------------------- +
| Root | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | localhost |
| Root | * 153ccfaeaa83407d8dbfaa3d17b1a95553e60c | ds-vm-node251.cluster.com |
| Root | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 127.0.0.1 |
| Root | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C |: 1 |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | localhost |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 127.0.0.1 |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C |: 1 |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 192.168. %. % |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 172.16. %. % |
| Zabbix | * 153CCFAEAA83407D8DBDBFAA3D17B1A95553E60C | 10. %. % |
+ -------- + ------------------------------------------- + --------------------------- +
[Root @ DS-VM-Node251/usr/local/mariadb] # cd ~


5. Install JDK

[Root @ DS-VM-Node251 ~] # Yum install http://mirrors.ds.com/tar_source/JDK/jdk-8u77-linux-x64.rpm-y
[Root @ DS-VM-Node251 ~] # Cat>/etc/profile. d/java. sh <EOF
JAVA_HOME =/usr/java/latest
PATH =\$ JAVA_HOME/bin: \ $ PATH
Export JAVA_HOME PATH
EOF
[Root @ DS-VM-Node251 ~] #./Etc/profile. d/java. sh
[Root @ DS-VM-Node251 ~] # Java-version
Java version "1.8.0 _ 77"
Java (TM) SE Runtime Environment (build 1.8.0 _ 77-b03)
Java HotSpot (TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
[Root @ DS-VM-Node251 ~] #


6. Install Zabbix3.0

[Root @ DS-VM-Node251 ~] # Useradd-r-s/sbin/nologin-M-d/data/wwwroor/zabbix.ds.com-c 'zabbix server' Zabbix
[Root @ DS-VM-Node251 ~] # Mkdir-p/tmp/zabbix & cd/tmp/zabbix
[Root @ DS-VM-Node251/tmp/zabbix] # wget-c http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
[Root @ DS-VM-Node251/tmp/zabbix] # tar xf zabbix-3.0.1.tar.gz
[Root @ DS-VM-Node251/tmp/zabbix] # cd zabbix-3.0.1/
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # yum install-y net-snmp-devel OpenIPMI-devel perl-ZMQ-LibZMQ3 curl-devel libxml2-devel
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] #./configure -- prefix =/usr/local/zabbix /\
-- Sysconfdir =/etc/zabbix \
-- Enable-server \
-- Enable-proxy \
-- Enable-agent \
Enable-ipv6 \
-- Enable-java \
-- With-mysql =/usr/local/mariadb/bin/mysql_config \
-- With-net-snmp \
-- With-libcurl \
-- With-openipmi \
With-libxml2
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # make-j $ (awk '/processor/{I ++} END {print I}'/proc/cpuinfo) & make install
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # echo "export PATH =/usr/local/zabbix/sbin: \ $ PATH">/etc/profile. d/zabbix. sh
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] #./etc/profile. d/zabbix. sh
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # for I in schema. SQL images. SQL data. SQL; do mysql-uroot-plookback zabbix <. /database/mysql/$ I; done
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri '/^ DBName =/D'/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri '/^ DBUser =/D'/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri '/^ DBPassword =/D'/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri "s/(DBName =)/& \ n \ 1 zabbix/"/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri "s/(DBUser =)/& \ n \ 1 zabbix/"/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-ri "s /. * (DBPassword = ). {0,}/& \ n \ 1 lookback/"/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I '/JavaGateway =/a JavaGateway = 127.0.0.1 \ Route = 10052 \ nstartjavapolers = 5'/etc/zabbix/zabbix_server.conf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I '/LISTEN_IP = "0.0.0.0"/a LISTEN_IP = "0.0.0.0"'/usr/local/zabbix/sbin/zabbix_java /settings. sh
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I '/LISTEN_PORT = 10052/a LISTEN_PORT = 10052'/usr/local/zabbix/sbin/zabbix_java/settings. sh
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I '/START_POLLERS = 5/a START_POLLERS = 5'/usr/local/zabbix/sbin/zabbix_java/settings. sh
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # ln-sv/usr/local/mariadb/lib/libmysqlclient. so.18/usr/lib/"/usr/lib/libmysqlclient. so.18 "->"/usr/local/mariadb/lib/libmysqlclient. so.18"
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # ln-sv/usr/local/mariadb/lib/libmysqlclient. so.18/usr/lib64/
"/Usr/lib64/libmysqlclient. so.18"-> "/usr/local/mariadb/lib/libmysqlclient. so.18"
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # ldconfig
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # cat>/etc/services <EOF
Zabbix-agent 10050/tcp # ZabbixAgent
Zabbix-agent 10050/udp # Zabbix Agent
Zabbix-trapper 10051/tcp # ZabbixTrapper
Zabbix-trapper 10051/udp # Zabbix Trapper
EOF
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # mkdir-p/data/wwwroot/zabbix.ds.com
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I '/zh_CN/{s/false/true /}'. /frontends/php/include/locales. inc. php
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I's/DejaVuSans/simkai/g'./frontends/php/include/defines. inc. php
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # cp-rp./frontends/php/*/data/wwwroot/zabbix.ds.com/
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # wget https://www.dwhd.org/wp-content/uploads/2015/05/simkai.ttf-O/data/wwwroot/zabbix.ds.com/fonts/simkai.ttf
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # chown-R www. www/data/wwwroot/zabbix.ds.com
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # cp-a./misc/init. d/fedora/core/zabbix_server/etc/init. d/
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # cp-a./misc/init. d/fedora/core/zabbix_agentd/etc/init. d/
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I's @ BASEDIR =/usr/local @ &/zabbix @ '/etc/rc. d/init. d/zabbix_server
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # sed-I's @ BASEDIR =/usr/local @ &/zabbix @ '/etc/rc. d/init. d/zabbix_agentd
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # chkconfig zabbix_server on
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # chkconfig zabbix_agentd on
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # service zabbix_server start
Starting zabbix_server (via systemctl): [OK]
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # service zabbix_agentd start
Starting zabbix_agentd (via systemctl): [OK]
[Root @ DS-VM-Node251/tmp/zabbix/zabbix-3.0.1] # iptables-A-p tcp-m tcp -- dport 80-j ACCEPT

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.