Server/모니터링 Zabbix 설치 환경구축
Server/모니터링 Zabbix 설치 환경구축
이번 포스팅에서는 Zabbix 설치에 필요한 환경구축에 대해서 알아보도록 하겠습니다.
Zabbix 가동에 필요한 소프트웨어 설치 |
1. MARIADB, NGINX, PHP, PHP-FPM 설치 및 가동에 필요한 패키지 설치
[root@zabbix ~]# yum -y install pcre-devel libxml2-devel zlib* openssl openssl-devel gcc g++ cpp gcc-c++ libxslt libxslt-devel php-gd libgd-dev gd gd-devel perl perl-ExtUtils-Embed geoip-devel unzip wget libtermcap-devel ncurses-devel patch curl-devel libjpeg* libevent-debel gnutls* cmake.x86_64 libaio gmp flex iconv libpng* freetype* libxml* gdbm-devel
2. MariaDB-설치
File : mariadb-10.4.12.tar.gz
1) MariaDB 유저, 그룹 생성
[root@zabbix zabbix]# adduser -M -s /bin/false mysql [root@zabbix zabbix]# useradd -g mysql maria
2) MariaDB 디렉토리 생성
[root@zabbix zabbix]# mkdir -p /usr/local/mariadb/socket [root@zabbix zabbix]# mkdir -p /usr/local/mariadb/data [root@zabbix zabbix]# mkdir -p /usr/local/mariadb/etc/my.cnf.d
3) MariaDB 압축해제 및 디렉토리 이동
[root@zabbix zabbix]# tar zxf mariadb-10.4.12.tar.gz [root@zabbix zabbix]# cd mariadb-10.4.12
4) MariaDB 설치 소스트리 구성
[root@zabbix mariadb-10.4.12]# cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb \ -DWITH_READLINE=ON \ -DWITH_READLINE=ON \ -DWITH_READLINE=ON \ -DWITH_SSL=bundled \ -DWITH_ZLIB=system \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_INNODB_MEMCACHED=ON \ -DWITH_EXTRA_CHARSETS=all \ -DWITH_ARIA_STORAGE_ENGINE=ON \ -DWITH_XTRADB_STORAGE_ENGINE=ON \ -DWITH_ARCHIVE_STORAGE_ENGINE=ON \ -DWITH_INNOBASE_STORAGE_ENGINE=ON \ -DWITH_PARTITION_STORAGE_ENGINE=ON \ -DWITH_BLACKHOLE_STORAGE_ENGINE=ON \ -DWITH_FEDERATEDX_STORAGE_ENGINE=ON \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=ON \ -DINSTALL_SYSCONFDIR=/usr/local/mariadb/etc \ -DINSTALL_SYSCONF2DIR=/usr/local/mariadb/etc/my.cnf.d \ -DMYSQL_TCP_PORT=3306 \ -DMYSQL_DATADIR=/usr/local/mariadb/data \ -DMYSQL_UNIX_ADDR=/usr/local/mariadb/socket/mysql.socket
4) MariaDB 설치
[root@zabbix mariadb-10.4.12]# make && make install
5) MariaDB 설치파일 권한 설정
[root@zabbix mariadb-10.4.12]# chown mysql:mysql /usr/local/mariadb -R
6) MariaDB DB 인스톨 스크립트 실행
[root@zabbix mariadb-10.4.12]# /usr/local/mariadb/scripts/mysql_install_db --user=mysql
7) MariaDB 구동 파일 복사
[root@zabbix mariadb-10.4.12]# cp -a /usr/local/mariadb/support-files/mysql.server /etc/rc.d/init.d/mariadb
8) MariaDB 심볼릭링크 생성
[root@zabbix mariadb-10.4.12]# ln -s /usr/local/mariadb/bin/mysql /usr/bin/mariadb [root@zabbix mariadb-10.4.12]# ln -s /usr/local/mariadb/bin/mysqldump /usr/bin/mariadbdump [root@zabbix mariadb-10.4.12]# cd ../
3. NGINX 설치
1) PCRE 압축해제
[root@zabbix zabbix]# tar zxf pcre-8.44.tar.gz
2) zlib 압축해제
[root@zabbix zabbix]# tar zxf zlib-1.2.11.tar.gz
3) openssl 압축해제
[root@zabbix zabbix]# tar zxf openssl-1.1.1g.tar.gz
4) NAXSI 압축해제
[root@zabbix zabbix]# unzip naxsi-master.zip
5) NGINX 압축해제 및 이동
[root@zabbix zabbix]# tar zxf nginx-1.18.0.tar.gz [root@zabbix zabbix]# cd nginx-1.18.0
6) NGINX 압축해제 및 이동
[root@zabbix nginx-1.18.0]# ./configure \ --prefix=/usr/local/nginx \ --user=nobody \ --group=nobody \ --with-openssl=../openssl-1.1.1g \ --with-zlib=../zlib-1.2.11 \ --with-pcre=../pcre-8.44 \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_xslt_module \ --with-http_image_filter_module \ --with-http_geoip_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_perl_module \ --with-http_degradation_module \ --with-http_gunzip_module \ --with-http_auth_request_module \ --with-http_v2_module \ --add-module=../naxsi-master/naxsi_src/
7) NGINX 설치
[root@zabbix nginx-1.18.0]# make & make install
8) NGINX 실행
[root@zabbix nginx-1.18.0]# /usr/local/nginx/sbin/nginx [root@zabbix nginx-1.18.0]# cd ../
4. PHP 7.1, PHP-FPM 설치
1) PHP 설치에 필요한 심볼릭링크 설정
[root@zabbix zabbix]# ln -s /usr/lib64/libjpeg.so /usr/lib/ [root@zabbix zabbix]# ln -s /usr/lib64/libpng.so /usr/lib/
2) mcrypt 압축해제 및 이동
[root@zabbix zabbix]# tar zxf libmcrypt-2.5.8.tar.gz [root@zabbix zabbix]# cd libmcrypt-2.5.8
3) libmcrypt 소스트리 구성
[root@zabbix libmcrypt-2.5.8]# ./configure --prefix=/usr/local/
4) libmcrypt 설치 시작
[root@zabbix libmcrypt-2.5.8]# make && make install [root@zabbix libmcrypt-2.5.8]# cd ../
5) php-7.1.7 압축해제 및 이동
[root@zabbix zabbix]# tar zxf php-7.1.7.tar.gz [root@zabbix zabbix]# cd php-7.1.7
6) php-7.1.7 소스트리 구성
[root@zabbix php-7.1.7]# ./configure --prefix=/usr/local/php71 \ --with-mysqli \ --with-mysql=/usr/local/mariadb \ --with-curl \ --disable-debug \ --enable-safe-mode \ --enable-sockets \ --enable-sysvsem=yes \ --enable-sysvshm=yes \ --enable-ftp \ --enable-magic-quotes \ --with-ttf \ --enable-gd-native-ttf \ --enable-inline-optimization \ --enable-bcmath \ --with-zlib \ --with-gd \ --with-gettext \ --with-jpeg-dir=/usr \ --with-png-dir=/usr/lib \ --with-freetype-dir=/usr \ --with-libxml-dir=/usr \ --enable-exif \ --enable-sigchild \ --enable-mbstring \ --enable-fastcgi \ --enable-fpm \ --with-openssl \ --enable-soap
6) php-7.1.7 설치
[root@zabbix php-7.1.7]# make && make install
7) php.ini 설정파일 복사
[root@zabbix php-7.1.7]# cp -a php.ini-production /usr/local/php71/lib/php.ini
8) PHP-FPM 구동 스크립트 복사
[root@zabbix php-7.1.7]# cp -arp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm71 [root@zabbix php-7.1.7]# chmod 755 /etc/init.d/php-fpm71
8) PHP-FPM 데몬 설정 파일 복사
[root@zabbix php-7.1.7]# cp -arp /usr/local/php71/etc/php-fpm.conf.default /usr/local/php71/etc/php-fpm.conf [root@zabbix php-7.1.7]# cp -arp /usr/local/php71/etc/php-fpm.d/www.conf.default /usr/local/php71/etc/php-fpm.d/www.conf
9) PHP-FPM IP,포트 설정
[root@zabbix php-7.1.7]# vi /usr/local/php71/etc/php-fpm.d/www.conf . . . . listen = 127.0.0.1:9000 . . . .
10) PHP-FPM 실행
[root@zabbix php-7.1.7]# service php-fpm71 start