Souce Install Zabbix 4.0 on CentOS 7 – Server

의존성 패키 설치

[root@172-16-11-5 /]# yum install libjpeg-devel libpng-devel freetype-devel libcurl-devel libxml2-devel net-snmp-devel gcc gcc-c++ autoconf make

zabbix 다운로드

[root@172-16-11-5 /]# cd /data/apps/dn
[root@172-16-11-5 dn]# wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz/download --content-disposition

압축해제

[root@172-16-11-5 dn]# tar xvzf zabbix-4.0.3.tar.gz

configure

[root@172-16-11-5 dn]# cd zabbix-4.0.3
[root@172-16-11-5 zabbix-4.0.3]# ./configure --prefix=/data/apps/src/zabbix-4.0.3 --enable-server --enable-agent --with-net-snmp --with-mysql=/data/apps/ln/mariadb/bin/mysql_config --with-libcurl --with-libxml2

컴파일 및 설치

make && make install

링크생성

[root@172-16-11-5 zabbix-4.0.3]# cd /data/apps/ln
[root@172-16-11-5 ln]# ln -s /data/apps/src/zabbix-4.0.3 zabbix
[root@172-16-11-5 ln]# mkdir /etc/zabbix
[root@172-16-11-5 ln]# cd /etc/zabbix
[root@172-16-11-5 zabbix]# ln -s /data/apps/src/zabbix-4.0.3/etc/zabbix_agentd.conf zabbix_agentd.conf
[root@172-16-11-5 zabbix]# ln -s /data/apps/src/zabbix-4.0.3/etc/zabbix_agentd.conf.d zabbix_agentd.conf.d
[root@172-16-11-5 zabbix]# ln -s /data/apps/src/zabbix-4.0.3/etc/zabbix_server.conf.conf zabbix_server.conf.conf
[root@172-16-11-5 zabbix]# ln -s /data/apps/src/zabbix-4.0.3/etc/zabbix_server.conf.d zabbix_server.conf.d

database 생성

[root@172-16-11-5 zabbix]# /data/apps/ln/mariadb/bin/mysql -uroot -p

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_general_ci;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix_user_password';
MariaDB [(none)]> exit;

schema, images, data 추가

[root@172-16-11-5 zabbix]# /data/apps/ln/mariadb/bin/mysql -uzabbix -p zabbix < /data/apps/dn/zabbix-4.0.3/database/mysql/schema.sql
[root@172-16-11-5 zabbix]# /data/apps/ln/mariadb/bin/mysql -uzabbix -p zabbix < /data/apps/dn/zabbix-4.0.3/database/mysql/images.sql
[root@172-16-11-5 zabbix]# /data/apps/ln/mariadb/bin/mysql -uzabbix -p zabbix < /data/apps/dn/zabbix-4.0.3/database/mysql/data.sql

zabbix_agentd.conf 파일 편집
: vi /etc/zabbix/zabbix_agentd.conf (필수 편집 옵션만 나열합니다.)

Server=your_server_ip                             # 서버 IP
#ServerActive=127.0.0.1                           # 주석처리
#Hostname=Zabbix server                           # 주석처리
Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf   # 커스텀 파라미터 설정파일 경로

zabbix_server.conf 파일 편집
: vi /etc/zabbix/zabbix_server.conf (필수 편집 옵션만 나열합니다.)

DBName=zabbix                                    # DB 이름
DBUser=zabbix                                    # DB 사용자
DBPassword=zabbix_user_password                  # DB 비밀번호
DBSocket=/data/apps/ln/mariadb/mysql.sock        # DB 소켓파일 경로
AlertScriptsPath=/etc/zabbix/bin                 # 커스텀 경고 스크립트 설정파일 경로
ExternalScripts=/etc/zabbix/bin                  # 외부 스크립트 설정파일 경로
Include=/etc/zabbix/zabbix_server.conf.d/*.conf  # 커스텀 파라미터 설정파일 경로

server systemd 파일생성
: vi /etc/systemd/system/zabbix_server.service

[Unit]
Description=Zabbix Server
After=syslog.target network.target

[Service]
Type=oneshot
ExecStart=/data/apps/ln/zabbix/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
ExecReload=/data/apps/ln/zabbix/sbin/zabbix_server -R config_cache_reload
RemainAfterExit=yes
PIDFile=/tmp/zabbix_server.pid

[Install]
WantedBy=multi-user.target

agent systemd 파일생성
: vi /etc/systemd/system/zabbix_agentd.service

[Unit]
Description=Zabbix Agent
After=syslog.target network.target network-online.target
Wants=network.target network-online.target

[Service]
Type=oneshot
ExecStart=/data/apps/ln/zabbix/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
RemainAfterExit=yes
PIDFile=/tmp/zabbix_agentd.pid

[Install]
WantedBy=multi-user.target

systemd 등록 및 실행

[root@172-16-11-5 zabbix]# systemctl enable zabbix_server
[root@172-16-11-5 zabbix]# systemctl enable zabbix_agentd
[root@172-16-11-5 zabbix]# systemctl start zabbix_server
[root@172-16-11-5 zabbix]# systemctl start zabbix_agentd

You may also like...