memostack
article thumbnail
Published 2021. 2. 22. 15:15
Ubuntu 20.04에 Zabbix 5.2 구축하기 ETC
블로그를 이전하였습니다. 2023년 11월부터 https://bluemiv.github.io/에서 블로그를 운영하려고 합니다. 앞으로 해당 블로그의 댓글은 읽지 못할 수 도 있으니 양해바랍니다.
반응형

1. MySQL 설치

Zabbix를 설치하기 전에 MySQL을 먼저 설치해야 함

<java />
# sudo apt update # sudo apt upgrade -y # sudo apt install -y mysql-server # sudo mysql_secure_installation

설치를 할때 보안 설정을 해줘야 하는데, 아래 참고

 

암호 검증 여부

<java />
VALIDATE PASSWORD COMPONENT can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD component? Press y|Y for Yes, any other key for No: y

 

암호 강도 설정

  • 본 글에서는 그냥 0으로 하여 했습니다.
<java />
LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0

 

비밀번호 설정

<java />
Please set the password for root here. New password: Re-enter new password:

 

비밀번호 설정 후 다시 한번 확인

<java />
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

 

익명 user 제거 여부

<java />
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y Success.

 

root 계정은 local에서만 접속하도록 할 것인지 확인

<java />
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success.

 

'test' DB 삭제 여부

<java />
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success.

 

테이블 권한 설정

<java />
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success.

 

2. Zabbix 저장소 설치

<java />
# wget https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.2-1+ubuntu20.04_all.deb # sudo dpkg -i zabbix-release_5.2-1+ubuntu20.04_all.deb # sudo apt-get update

 

Zabbix Server, 프론트엔드, Agent 설치

<java />
# sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent

 

2.1. MySQL에 DB와 user 생성

MySQL 접속

<java />
hong@ubuntu20:~$ sudo mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu) Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

 

Database 생성

  • zabbix 라는 Database를 생성한다.
<java />
mysql> create database zabbix character set utf8 collate utf8_bin; ser zabbix@localhost identified by 'password'; grant all privileges on zabbix.* to zabbix@localhost; quit;Query OK, 1 row affected, 2 warnings (0.04 sec)

Database 생성 확인

<java />
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | zabbix | +--------------------+ 2 rows in set (0.01 sec)

 

User 생성

  • zabbix@localhost로 생성하고 비밀번호를 설정한다.
<java />
mysql> create user zabbix@localhost identified by '1q2w3e4r'; Query OK, 0 rows affected (0.02 sec)

 

User 권한 설정

<java />
mysql> grant all privileges on zabbix.* to zabbix@localhost; Query OK, 0 rows affected (0.01 sec)
<java />
mysql> quit; Bye

 

Table 생성

  • Zabbix를 실행하기 위해 필요한 테이블을 생성한다.
<java />
# ls /usr/share/doc/zabbix-server-mysql # sudo gzip -d create.sql.gz # mysql -uzabbix -p zabbix < create.sql
<java />
# mysql -uzabbix -p zabbix -e "show tables;" Enter password: +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery | | application_prototype | | application_template | | applications | | auditlog | | auditlog_details | | autoreg_host | | conditions | | config | | config_autoreg_tls | | corr_condition | | corr_condition_group | | corr_condition_tag | | corr_condition_tagpair | | corr_condition_tagvalue | | corr_operation | | correlation | | dashboard | | dashboard_user | | dashboard_usrgrp | | dbversion | | dchecks | | dhosts | | drules | | dservices | | escalations | | event_recovery | | event_suppress | | event_tag | | events | | expressions | | functions | | globalmacro | | globalvars | | graph_discovery | | graph_theme | | graphs | | graphs_items | | group_discovery | | group_prototype | | history | | history_log | | history_str | | history_text | | history_uint | | host_discovery | | host_inventory | | host_tag | | hostmacro | | hosts | | hosts_groups | | hosts_templates | | housekeeper | | hstgrp | | httpstep | | httpstep_field | | httpstepitem | | httptest | | httptest_field | | httptestitem | | icon_map | | icon_mapping | | ids | | images | | interface | | interface_discovery | | interface_snmp | | item_application_prototype | | item_condition | | item_discovery | | item_parameter | | item_preproc | | item_rtdata | | items | | items_applications | | lld_macro_path | | lld_override | | lld_override_condition | | lld_override_opdiscover | | lld_override_operation | | lld_override_ophistory | | lld_override_opinventory | | lld_override_opperiod | | lld_override_opseverity | | lld_override_opstatus | | lld_override_optag | | lld_override_optemplate | | lld_override_optrends | | maintenance_tag | | maintenances | | maintenances_groups | | maintenances_hosts | | maintenances_windows | | mappings | | media | | media_type | | media_type_message | | media_type_param | | module | | opcommand | | opcommand_grp | | opcommand_hst | | opconditions | | operations | | opgroup | | opinventory | | opmessage | | opmessage_grp | | opmessage_usr | | optemplate | | problem | | problem_tag | | profiles | | proxy_autoreg_host | | proxy_dhistory | | proxy_history | | regexps | | rights | | role | | role_rule | | screen_user | | screen_usrgrp | | screens | | screens_items | | scripts | | service_alarms | | services | | services_links | | services_times | | sessions | | slides | | slideshow_user | | slideshow_usrgrp | | slideshows | | sysmap_element_trigger | | sysmap_element_url | | sysmap_shape | | sysmap_url | | sysmap_user | | sysmap_usrgrp | | sysmaps | | sysmaps_elements | | sysmaps_link_triggers | | sysmaps_links | | tag_filter | | task | | task_acknowledge | | task_check_now | | task_close_problem | | task_data | | task_remote_command | | task_remote_command_result | | task_result | | timeperiods | | trends | | trends_uint | | trigger_depends | | trigger_discovery | | trigger_queue | | trigger_tag | | triggers | | users | | users_groups | | usrgrp | | valuemaps | | widget | | widget_field | +----------------------------+

 

2.2. zabbix_server.conf 설정

위에서 설정한 DB 계정의 비밀번호를 입력한다.

<java />
# sudo vi /etc/zabbix/zabbix_server.conf
<java />
DBPassword=1q2w3e4r

 

2.3. 웹 서버 설정

/etc/zabbix/nginx.conf 에서 listen 80servername을 주석 해제 한다.

<java />
# vi /etc/zabbix/nginx.conf
<java />
listen 80; server_name IP 또는 domain;

 

2.4. Zabbix Server와 Frontend를 실행

<java />
# systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm # systemctl enable zabbix-server zabbix-agent nginx php7.4-fpm

 

3. Zabbix 접속

http://내서버ip_또는_domain 으로 접속한다.

Zabbix 설치 완료

 

4. Zabbix 설정

DB connect 설정
서버 host, port 설정
time zone & theme 설정
설정 다시 한번 확인
설정 완료

 

초기 계정정보는 아래와 같다.

  • username: Admin 
  • password: zabbix

Zabbix 로그인

 

 

5. Reference

www.zabbix.com/download?zabbix=5.2&os_distribution=ubuntu&os_version=20.04_focal&db=mysql&ws=nginx

 

Download Zabbix

 

www.zabbix.com

 

반응형
블로그를 이전하였습니다. 2023년 11월부터 https://bluemiv.github.io/에서 블로그를 운영하려고 합니다. 앞으로 해당 블로그의 댓글은 읽지 못할 수 도 있으니 양해바랍니다.
profile

memostack

@bluemiv_mm

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!