Elastic Search + Kibana  설치 및 구동

 

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.1-amd64.deb

wget https://artifacts.elastic.co/downloads/kibana/kibana-7.7.1-amd64.deb

 

sudo dpkg -i elasticsearch-7.7.1-amd64.deb

sudo dpkg -i kibana-7.7.1-amd64.deb

 

 

sudo service elasticsearch start

 

sudo service kibana start

 

 

 

yfkwon@DESKTOP-A0P47SN$ sudo service kibana stop

kibana stopped.

yfkwon@DESKTOP-A0P47SN$ sudo service elasticsearch stop

* Stopping Elasticsearch Server

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

wget https://dl.influxdata.com/telegraf/releases/telegraf_1.14.3-1_amd64.deb

 

sudo dpkg -i telegraf_1.14.3-1_amd64.deb

 

cd /etc/telegraf

 

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo mv telegraf.conf telegraf.conf_20200607

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° vi telegraf.conf

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo vi telegraf.conf

yfkwon@DESKTOP-A0P47SN î‚° /etc/telegraf î‚° sudo service telegraf start

 

 

yfkwon@DESKTOP-A0P47SN î‚° ~ î‚° sudo service telegraf stop

telegraf process was stopped [ OK ]

 

 

Telegraf에서 system metric 수집하여 elasticsearch에 적재하기

 

Telegraf는 influxdata(사)에서 opensource로 제공하는 plugin 기반의 metric수집 server agent이다.

github url : https://github.com/influxdata/telegraf 

 

telegraf의 역할이 이해하기 어렵게 느껴질 수 있는데, 간단히 말하자면 아래와 같이 input, process, output이 가능하다.

 

Telegraf로 할 수 있는 일

System의 ram, cpu수치를 elasticsearch에 적재

Redis의 data를 elasticsearch에 적재

File log를 influxdb에 적재

 

즉, input plugin으로 뽑아낸 데이터를 output plugin이 지원하는 곳으로 보낼 수 있다.

 

System metric을 elasticsearch로 보내기

 

엘라스틱서치에 시스템 메트릭을 적재하면 kibana, grafana등의 시각화 도구로 쉽게 조회가 가능

 

 

System metric을 elasticsearch에 보내기 위해서는 아래와 같이 telegraf의 설정이 필요하다.

 

# telegraf agent 셋팅# telegraf가 설치된 폴더의 etc/telegraf.conf 설정[agent]

interval = "10s"

round_interval = true

metric_batch_size = 1000

metric_buffer_limit = 10000

collection_jitter = "0s"

flush_interval = "10s"

flush_jitter = "0s"

precision = ""

debug = false

quiet = false

hostname = ""

omit_hostname = false

 

 

### OUTPUT

[[outputs.elasticsearch]]

## 엘라스틱 서치의 full url을 적는다.(http/https 필수)

urls = [ "http://1.123.123.123:9200" ] # required.

## 엘라스틱 서치 타임아웃 시간

## 반드시 agent interval보다 시간으로 설정한다.

## > 그렇지 않으면 context deadline exceeded 에러가 발생한다.

timeout = "60s"

enable_sniffer = false

health_check_interval = "10s"

## elasticsearch에 사용할 index name 설정

index_name = "my-computer-metric-%Y.%m.%d" # required.

 

## 만약 telegraf가 template를 자동으로 만들게 하고싶다면 true 변경

manage_template = false

template_name = "telegraf"

overwrite_template = false

 

 

### INPUT

## 아래 값들은 system metric을 수집하기 위한 plugin이다.# Read metrics about cpu usage

[[inputs.cpu]]

## Whether to report per-cpu stats or not

percpu = true

## Whether to report total system cpu stats or not

totalcpu = true

## Comment this line if you want the raw CPU time metrics

fielddrop = ["time_*"]

 

 

# Read metrics about disk usage by mount point

[[inputs.disk]]

## By default, telegraf gather stats for all mountpoints.

## Setting mountpoints will restrict the stats to the specified mountpoints.

# mount_points = ["/"]

 

## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually

## present on /run, /var/run, /dev/shm or /dev).

ignore_fs = ["tmpfs", "devtmpfs"]

 

 

# Read metrics about disk IO by device

[[inputs.diskio]]

## By default, telegraf will gather stats for all devices including

## disk partitions.

## Setting devices will restrict the stats to the specified devices.

# devices = ["sda", "sdb"]

## Uncomment the following line if you need disk serial numbers.

# skip_serial_number = false

 

 

# Get kernel statistics from /proc/stat

[[inputs.kernel]]

# no configuration

 

 

# Read metrics about memory usage

[[inputs.mem]]

# no configuration

 

 

# Get the number of processes and group them by status

[[inputs.processes]]

# no configuration

 

 

# Read metrics about swap memory usage

[[inputs.swap]]

# no configuration

 

 

# Read metrics about system load & uptime

[[inputs.system]]

# no configuration

 

# Read metrics about network interface usage

[[inputs.net]]

# collect data only about specific interfaces

# interfaces = ["eth0"]

 

[[inputs.netstat]]

# no configuration

 

[[inputs.linux_sysctl_fs]]

# no configuration

상기와 같이 설정하고, telegraf를 실행하면 elasticsearch에 data를 전송을 시작한다.

 

Elastic search의 data 확인

elasticsearch에 telegraf가 수집한 데이터가 잘 들어왔는지 확인하기 위해서 kibana를 사용했다.

 

kibana를 사용해서 index template를 'my-computer-metric-*'로 설정하고 나면 조회가 가능하다.

 

cpu, ram 등의 metric이 확인 된다.

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

sudo apt-get install -y apt-transport-https

 

sudo apt-get install -y software-properties-common wget

 

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

 

sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

 

sudo apt-get update

 

sudo apt-get install grafana

 

sudo service grafana-server start

 

sudo service grafana-server status

 

 yfkwon@DESKTOP-A0P47SN î‚° ~ î‚° sudo service grafana-server stop

[sudo] password for yfkwon:

* Stopping Grafana Server                                                                                         [ OK ]

 

 

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

watch 명령을 이용한 linux 시스템 모니터링

 

watch 명령은 원하는 명령어의 결과를 원하는 시간(초) 주기로 리프레시 하여 결과를 보여주는 명령어 입니다.

시스템의 자원 사용량을 모니터링 하거나, 특정 명령어를 반복적으로 입력해서 결과를 확인해야 할 때, 유용하게 사용할 수 있는 명령어 입니다. 

 

[root@localhost ~]# watch --help

Usage: watch [-dhntv] [--differences[=cumulative]] [--help] [--interval=<n>] [--no-title] [--version] <command>

  -d, --differences[=cumulative]        highlight changes between updates

                (cumulative means highlighting is cumulative)

  -h, --help                            print a summary of the options

  -n, --interval=<seconds>              seconds to wait between updates

  -v, --version                         print the version number

  -t, --no-title                        turns off showing the header

[root@localhost ~]# 

 

 

기본 사용 방법)

[root@localhost]# watch [-d] [-n seconds] 'command'

종료는 [Ctrl + c]

 

-d 옵션은 이전 출력결과와 비교하여 변경된 부분을 표시해 주는 기능

-n 옵션은 입력한 명령어의 결과를 원하는 초단위 간격으로 출력해 주는 기능(default 값은 2초)

 

====================================================================

 

예제) 

 

- 시스템의 uptime 값을 화면에 계속 출력(2초간격)

 

  [root@localhost ~]# watch uptime

 

  Every 2.0s: uptime                                                                                       Thu Mar 29 01:49:12 2018

 

   01:49:12 up 83 days, 18:44,  1 user,  load average: 0.00, 0.00, 0.00

 

 

 

- command에 띄어쓰기가 들어갈 경우는 ' ' 으로 묶어 준다. uptime 값을 5초 간격으로 화면에 계속 출력

 

  [root@localhost ~]# watch -d -n 5 'cat /proc/uptime'

 

  Every 5.0s: cat /proc/uptime                                                                           Thu Mar 29 01:51:19 2018

 

  7238809.82 14469889.75

 

 

 

- 10초 간격으로 iostat 모니터링

 

  [root@localhost local]# watch -n 10 iostat

 

  Every 2.0s: iostat                                                                                          Thu Mar 29 01:56:39 2018

 

  Linux 2.6.32-696.el6.x86_64 (localhost.localdomain)     03/29/2018      _x86_64_        (2 CPU)

 

  avg-cpu:  %user   %nice %system %iowait  %steal   %idle

             0.01    0.00    0.01    0.02    0.03   99.93

 

  Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn

  xvda              0.20         0.48         2.80    3503370   20247044

 

 

- 5초 간격으로 vmstat 모니터링

 

  [root@localhost local]# watch -n 5 vmstat

 

  Every 2.0s: vmstat                                                                                          Thu Mar 29 01:57:11 2018

 

  procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----

   r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

   0  0   9636 1224232 148464 483280    0    0     0     1    3    3  0  0 100  0  0

 

 

- 1초 간격으로 apache 프로세스 모니터링

 

  [root@localhost local]# watch -d -n 1 'ps -ef | grep httpd | grep -v grep'

 

  Every 1.0s: ps -ef | grep httpd | grep -v grep                                                        Thu Mar 29 01:55:20 2018

 

  root     10214     1  0 01:54 ?        00:00:00 /usr/local/apache/bin/httpd -k start

  daemon   10217 10214  0 01:54 ?        00:00:00 /usr/local/apache/bin/httpd -k start

  daemon   10218 10214  0 01:54 ?        00:00:00 /usr/local/apache/bin/httpd -k start

  daemon   10219 10214  0 01:54 ?        00:00:00 /usr/local/apache/bin/httpd -k start

 

 

- 여러가지 명령어를 조합해서도 사용 가능(2초 간격)

   w 명령어를 통한 현재 접속자, loadaverage, uptime 확인

   df 명령을 통한 디스크 사용량

   free 명령을 통한 memory 사용량 

 

[root@localhost local]# watch -d 'w; echo; df -h; echo; free -m'

 

  Every 2.0s: w; echo; df -h; echo; free -m                                                             Thu Mar 29 02:02:44 2018

 

   02:02:44 up 83 days, 18:58,  1 user,  load average: 0.00, 0.00, 0.00

  USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT

  root     pts/0    10.10.0.1        01:38   12.00s  0.20s  0.02s watch -d w; ech

 

  Filesystem      Size  Used Avail Use% Mounted on

  /dev/xvda3      7.6G  6.0G  1.2G  84% /

  tmpfs           936M     0  936M   0% /dev/shm

  /dev/xvda1      240M   35M  193M  16% /boot

 

               total       used       free     shared    buffers     cached

  Mem:          2000        805       1194          0        144        471

  -/+ buffers/cache:        188       1811

  Swap:         2047          9       2038

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

Check how many CPUs are there in Linux system

last updated October 15, 2018 in CategoriesCentOS, Debian / Ubuntu, Hardware, Linux, RedHat and Friends, Suse

How do you check how many CPUs are there in Linux system using the command line option?

 

Introduction: One can obtain the number of CPUs or cores in Linux from the command line. The /proc/cpuinfo file stores CPU and system architecture dependent items, for each supported architecture. You can view /proc/cpuinfo with the help of cat command or grep command/egrep command. This page shows how to use /proc/cpuinfo file and lscpu command to display number of processors on Linux.

How do you check how many CPUs are there in Linux system?

You can use one of the following command to find the number of physical CPU cores including all cores on Linux:

  1. lscpu command

  2. cat /proc/cpuinfo

  3. top or htop command

  4. nproc command

  5. hwinfo command

  6. dmidecode -t processor command

  7. getconf _NPROCESSORS_ONLN command

Let us see all commands and examples in details.

How to display information about the CPU on Linux

Just run the lscpu command:

$ lscpu

$ lscpu | egrep 'Model name|Socket|Thread|NUMA|CPU\(s\)'

$ lscpu -p

 

The output clearly indicate that I have:

  1. CPU model/make: AMD Ryzen 7 1700 Eight-Core Processor

  2. Socket: Single (1)

  3. CPU Core: 8

  4. Thread per core: 2

  5. Total threads: 16 ( CPU core[8] * Thread per core [2])

Use /proc/cpuinfo to find out how many CPUs are there in Linux

The lscpu command gathers CPU architecture information from sysfs, /proc/cpuinfo and other sources. To view use the cat command and more command as follows:

$ cat /proc/cpuinfo

 

OR

$ more /proc/cpuinfo

 

Let us print cpu thread count:

$ echo "CPU threads: $(grep -c processor /proc/cpuinfo)"

$ grep 'cpu cores' /proc/cpuinfo | uniq

Run top or htop command to obtain the number of CPUs/cores in Linux

Simply run the following command and hit ‘1’:

$ top

 

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

CentOS 7에 Tomcat8을 설치 및 설정하는 예제를 진행하겠습니다. 테스트의 편의성을 위해 root 계정에서 진행하겠습니다.

 

1. open-jdk 1.8 설치 

 

jdk를 설치하기 바랍니다.

설치 방법은 아래 링크를 참조하기 바랍니다.

yfkwon.tistory.com/47?category=664685

 

 

2. tomcat 설치

 

tomcat은 설치하는 방법이 다양합니다. 이번 예제는 wget을 이용해 설치하겠습니다.

 

# wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.27/bin/apache-tomcat-8.5.27.tar.gz

 

// 압축 해체

# tar zxvf apache-tomcat-8.5.27.tar.gz

 

// 톰캣을 /usr/local/로 이동시키고 디렉토리 이름을 tomcat8로 변경

# mv apache-tomcat-8.5.27 /usr/local/tomcat8


3. tomcat 설정 및 환경 변수 등록

 

vi /usr/local/tomcat8/conf/server.xml

// vi /usr/local/tomcat8/conf/server.xml// 아래 설정을 찾아서 URIEncoding="UTF-8"을 추가한다.

 

...

<Connector port="8080" protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443"

URIEncoding="UTF-8" />

...

vi /etc/profile

...

 

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64

CATALINA_HOME=/usr/local/tomcat8

CLASSPATH=$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib-jsp-api.jar:$CATALINA_HOME/lib/servlet-api.jar

PATH=$PATH:$JAVA_HOME/bin:/bin:/sbin

export JAVA_HOME PATH CLASSPATH CATALINA_HOME

설정 후 아래 명령어 입력 

# source /etc/profile


3. tomcat 실행

 

startup.sh파일은 tomcat을 실행시키는 shell script입니다. 해당 파일을 실행시켜 tomcat을 작동시켜줍니다.

 

# /usr/local/tomcat8/bin/startup.sh

tomcat이 실행되고 있는지 확인합니다.

 

//톰캣 프로세스 확인

# ps -ef|grep tomcat8

 

// 8080 포트가 열려있는지 확인

# netstat -tln

 테스트해보기 위해 다음 명령어를 실행시켜줍니다.

 

# wget http://localhost:8080/

 

index.html 파일이 다운로드 되었다면 정상적으로 tomcat이 실행되고 있다는 의미입니다. 

 

index.html 파일은 기본적으로 실행되는 /usr/local/tomcat8/webapps/ROOT WebService에서 다운받은 것이며, 

 

http://localhost:8080 호출 시,  /usr/local/tomcat8/webapps/ROOT/index.jsp 파일이 index.html로 변환되어 다운됩니다.

 


4. systemctl 등록

 

vi /etc/systemd/system/tomcat8.service

# Systemd unit file for tomcat

[Unit]

Description=Apache Tomcat Web Application Container

After=syslog.target network.target

 

[Service]

Type=forking

 

Environment="JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/"

Environment="CATALINA_HOME=/usr/local/tomcat8"

Environment="CATALINA_BASE=/usr/local/tomcat8"

Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"

Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"

 

ExecStart=/usr/local/tomcat8/bin/startup.sh

ExecStop=/usr/local/tomcat8/bin/shutdown.sh

 

User=root

Group=root

UMask=0007

RestartSec=10

Restart=always

 

[Install]

WantedBy=multi-user.target

 

 

# systemctl daemon-reload

# systemctl enable tomcat8

 

// tomcat8 실행

# systemctl start tomcat8


5. systemctl service 부팅 시 자동 실행

 

//부팅 시 자동 실행 서비스 등록

# systemctl enable tomcat8.service

//등록된 서비스 조회

# systemctl list-unit-files --type service |grep tomcat8

 

 

6. tomcat manager 설정 (해당 설정은 선택사항 입니다.)

 

tomcat manager란 tomcat 모니터링 및 어플리케이션 관리, WAR 배포 및 다양한 서비스를 제공해주는 관리 페이지입니다.

 

1) tomcat-users.xml 수정

 

vi /usr/local/tomcat8/conf/tomcat-users.xml

<tomcat-users xmlns="http://tomcat.apache.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd" version="1.0">

 

  <role rolename="manager"/>

  <role rolename="manager-gui" />

  <role rolename="manager-script" />

  <role rolename="manager-jmx" />

  <role rolename="manager-status" />

  <role rolename="admin"/>

  <user username="admin" password="패스워드" roles="admin,manager,manager-gui, manager-script, manager-jmx,  manager-status"/>

 

</tomcat-users>

 

 

2) 외부 접근 허용 설정

 

vi /usr/local/tomcat8/conf/Catalina/localhost/manager.xml

<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager">          <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />

</Context>

설정 후, 서버 재시작

 

3) 테스트

 

http://자신의IP:8080/manager

위 주소를 입력하고 ID와 password를 입력면 아래와 같은 웹페이지가 노출됩니다.  

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

리눅스에서 터미널이나 vi 한글이 깨질 때 해결책입니다.

 

 

1. 터미널 한글깨짐

 

vi ~/.bashrc 에서 아래 코드를 추가하고 재접속 합니다.

 

LANG="ko_KR.UTF-8"

export LANG="ko_KR.UTF-8"

 

 

 

2. vi 한글깨짐

 

vi ~/.vimrc 에서 아래 코드를 추가합니다.

 

set encoding=utf-8

set fileencodings=utf-8,euc-kr

 

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

기존 Centos 6 점대 버전까지는

 

/etc/sysconfig/i18n  에서 캐릭터셋을 설정했지만 Centos 7 부터는 변경되었다

 

 

 

locale

 

서버의 캐릭터셋 확인

 

[root@servblog ~]# locale

LANG=ko_KR.utf8

LC_CTYPE=”ko_KR.utf8″

LC_NUMERIC=”ko_KR.utf8″

LC_TIME=”ko_KR.utf8″

LC_COLLATE=”ko_KR.utf8″

LC_MONETARY=”ko_KR.utf8″

LC_MESSAGES=”ko_KR.utf8″

LC_PAPER=”ko_KR.utf8″

LC_NAME=”ko_KR.utf8″

LC_ADDRESS=”ko_KR.utf8″

LC_TELEPHONE=”ko_KR.utf8″

LC_MEASUREMENT=”ko_KR.utf8″

LC_IDENTIFICATION=”ko_KR.utf8″

LC_ALL=

[root@servblog ~]#

 

 

변경방법 1

 

vi /etc/locale.conf

 

#LANG=ko_KR.utf8

LANG=ko_KR.euckr

utf8 에서 euckr로 변경

 

변경방법 2

 

[root@servblog ~]# localectl set-locale LANG=ko_KR.euckr

euckr로 세팅

 

 

 

변경후 서버에 재접속시 변경확인가능

 

[root@servblog ~]# locale

LANG=ko_KR.euckr

LC_CTYPE=”ko_KR.euckr”

LC_NUMERIC=”ko_KR.euckr”

LC_TIME=”ko_KR.euckr”

LC_COLLATE=”ko_KR.euckr”

LC_MONETARY=”ko_KR.euckr”

LC_MESSAGES=”ko_KR.euckr”

LC_PAPER=”ko_KR.euckr”

LC_NAME=”ko_KR.euckr”

LC_ADDRESS=”ko_KR.euckr”

LC_TELEPHONE=”ko_KR.euckr”

LC_MEASUREMENT=”ko_KR.euckr”

LC_IDENTIFICATION=”ko_KR.euckr”

LC_ALL=[root@servblog ~]# cat /etc/locale.conf

LANG=ko_KR.euckr

 

 

시스템에서 변경가능한 캐릭터셋 확인명령어

 

localectl list-locales

 

[root@servblog ~]# localectl list-locales

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

[Linux] Ubuntu 18 LTS 고정 IP 설정(static ip config)

Ubuntu 18 LTS 부터는 Netplan 이 적용되어 설정 방식이 변경됨.

netplan 은 yaml 을 사용

 

설정

  1. 시스템의 interface 목록 확인

    $ ls /sys/class/net

     

     

    enp0s31f6 lo

    Copy

     

  2. 설정 파일 에디터로 오픈

    sudo vi /etc/netplan/50-cloud-init.yaml

    Copy

     

  3. yaml 의 ethernets  항목에 1번에서 확인한 인터페이스(enp0s31f6 ) 이름을 추가하고 하위에 네트워크 설정 추가

    /etc/netplan/50-cloud-init.yaml

    network:

    ethernets:

    enp0s31f6:

    addresses: [192.168.0.214/24]

    gateway4: 192.168.0.1

    nameservers:

    addresses: [168.126.63.1,8.8.8.8]

    # search: [lesstif.com]

    # dhcp4: yes

    dhcp4: no

    # optional: true

    version: 2

    Copy

     

    고정 IP 설정시 dhcp4: no 를 꼭 추가

  4. 저장하고 빠져 나옴

  5. 설정 반영

    sudo netplan apply

    Copy

     

  6. 설정 반영 확인

    $ ip addr

    $ ip route

    Copy

     

  7. network 을 사용하는 명령어(Ex: nslookup)를 사용해서 정상 동작 여부 확인

    $ nslookup google.com

    Copy

     

* Stock Advisor 서버 netplan 설정

root@twodigit-System-Product-Name:/etc/netplan# more 01-network-manager-all.yaml

# Let NetworkManager manage all devices on this system

network:

  version: 2

  renderer: NetworkManager

  ethernets:

   enp5s0:

     dhcp4: no

     dhcp6: no

     addresses: [192.168.11.36/24]

     gateway4: 192.168.11.1

     nameservers:

      addresses: [164.124.101.2,8.8.4.4]

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,

리눅스(Linux) 포트 열기, 방화벽 설정해제

------------------------------------------------------------------

  • 방화벽 오픈

 

sudo firewall-cmd --permanent --zone=public --add-port=20/tcp

sudo firewall-cmd --permanent --zone=public --add-port=21/tcp

sudo firewall-cmd --permanent --zone=public --add-port=22/tcp

 

  • 설정 로딩 적용

 

sudo firewall-cmd --reload

 

  • 상태 조회

 

sudo firewall-cmd --state

 

  • 방화벽 활성화

 

sudo systemctl enable firewalld

sudo systemctl start firewalld

반응형
블로그 이미지

조이풀 라이프

Lift is short, enjoy the life

,