반응형

1. 구매 이유

ip Time, Netgear 등의 여러 공유기를 쓰다가 ASUS 공유기의 평이 좋아서 구매하게 되었습니다.

 

사람마다 다르겠지만 제가 공유기를 구매할 때의 가장 중요하게 여기는 조건은 아래와 같습니다.

WOL(Wake On Lan), 포트포워딩(Port Fowarding), VPN(Virtual Private Lan), IoT 연결(가전)

 

WOL은 나스 및 서버 전원 On을 위하여 사용하고 포트포워딩은 나스나 쿠버네티스로 구성된 서비스 접속, VPN은 회사나 외부에서 접근을 위해 사용합니다.

 

ipTime 공유기는 WOL 등의 여러 기능이 있으나 내구성의 아쉬운 부분이 있으며, Netgear 공유기는 포트포워딩 설정이 보이지 않는 문제 및 Wi-Fi 연결, WOL 미지원 등의 아쉬운 부분이 있었습니다. ASUS 공유기는 처음 구매하게 되었으며, 사용은 더 해봐야 알겠지만 현재 기대감을 가지고 사용 중입니다.

 

2. 개봉기

생각보다 엄청나게 큰 박스가 와서 놀랐습니다. 하이엔드급 공유기(Wi-Fi 6e 지원)라 그런지 성능도 박스도 엄청 크더군요 3년 무상 보증이라 3년간은 걱정이 크게 없을 것 같습니다.

 

박스를 열자 웅장한 모습으로 드러냈습니다. 안테나 마다 비닐로 포장이 되어 세밀함이 느껴졌으며, 전면에는 REPUBLlC OF GAMES라는 문구가 보입니다.

 

전원을 연결하면 위와 같이 전면에 AURA RGB LED가 들어오며, 색상 선택 및 표시 방식을 설정을 통해 변경할 수 있습니다.

 

Synology 나스와 함께 배치를 하였는데 크기가 커서 많은 공간을 차지하지만 멋있는 자태를 뽐내고 있습니다.

 

3. 관리 페이지

초기 페이지에 접속하면 위와 같이 아이디와 패스워드를 입력하는 로그인창이 보이게 됩니다.

 

로그인을 하게 되면 위와 같이 대시보드로 접근하게 됩니다. AiMesh, AiProtection 등 여러 메뉴가 보이가 됩니다.

 

메뉴 중에 저의 눈에 띄었던 것은 AiProtection이었습니다. 보안 회사인 Trend Micro의 네트워크 보호 기능을 제공하며, 악의적인 사이트 차단 및 양방향 IPS를 통해 홈 및 소규모 기업 네트워크에서 손쉽게 보안을 강화할 수 있는 장점이 있습니다. 하지만 사용 시에 부하가 발생될 수 있으니 판단이 필요합니다. 저는 현재 테스트를 위해 활성화 중입니다.

 

4. 사용 후기

장점

 - 6GHz 주파수 추가로 인한 채널과 대역폭 향상

 - IPSec - 테스트 예정

 - Let's Encryption을 통한 DDNS 도메인 인증서 등록

 - 방화벽 기능

 - 트래픽 분석기

 

단점

 - 아무래도 가격이....

 - 로그 및 공유기 관련 별도 알림이 없음(AI Protection 감지시 알림은 있음)

반응형
반응형

1. profile 설정

1) /etc/profile 수정

[root@localhost ~]# vi /etc/profile

# Command Log
function history_to_syslog {
declare command
remoteaddr="`who am i`"
pwd="`pwd`"
command=$(fc -ln -0)
if [ "$command" != "$old_command" ]; then
logger -p local2.notice -t bash -i ? "$USER : $remoteaddr" "Command : $command  Directory : $pwd"
fi
old_command=$command
}
trap history_to_syslog DEBUG

 

2) /etc/profile 적용

[root@localhost ~]# source /etc/profile

 

2. rsyslog 설정

1) rsyslog.conf 수정

[root@localhost ~]# vi /etc/rsyslog.conf

# Command Log
local2.notice                                           /var/log/cmd.log

 

2) rsyslog 재시작
[root@localhost ~]# systemctl restart rsyslog

 

3) 로그 기록 확인
[root@localhost ~]# tail -f /var/log/cmd.log

Jul  2 14:56:08 localhost bash[5932]: ? root : root     pts/0        2021-07-02 14:55 (192.168.0.10) Command : #011 ps ax  Directory : /root
Jul  2 14:56:13 localhost bash[5941]: ? root : root     pts/0        2021-07-02 14:55 (192.168.0.10) Command : #011 netstat -natp  Directory : /root
Jul  2 14:56:46 localhost bash[5975]: ? root : root     pts/0        2021-07-02 14:55 (192.168.0.10) Command : #011 vi /var/log/cmd.log   Directory : /root
Jul  2 14:57:09 localhost bash[6037]: ? root : root     pts/1        2021-07-02 14:57 (192.168.0.10) Command : #011 exit  Directory : /root
Jul  2 14:57:22 localhost bash[6061]: ? root : root     pts/1        2021-07-02 14:57 (192.168.0.10) Command : #011 vim toast  Directory : /root
Jul  2 14:57:35 localhost bash[6082]: ? root : root     pts/1        2021-07-02 14:57 (192.168.0.10) Command : #011 vi toast  Directory : /root
Jul  2 14:57:58 localhost bash[6110]: ? root : root     pts/0        2021-07-02 14:55 (192.168.0.10) Command : #011 tail -f /var/log/cmd.log   Directory : /root

 

반응형

'Server > CentOS' 카테고리의 다른 글

[CentOS] SFTP Log 설정  (0) 2021.03.26
[CentOS] Core 파일  (0) 2021.02.03
[CentOS] Google OTP를 활용한 SSH 추가 인증  (1) 2021.01.13
[CentOS] is not in the sudoers file  (0) 2021.01.11
[CentOS] 로그인 실패시 계정 잠금  (0) 2021.01.07
반응형

1. /etc/ssh/sshd_config 수정

[root@localhost ~]# vi /etc/ssh/sshd_config

# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server -f local2 -l INFO

 

2. sshd 재시작

[root@localhost ~]# systemctl restart sshd

 

3. /etc/rsyslog.conf 수정

[root@localhost ~]# vi /etc/rsyslog.conf

#sftp log
local2
.*                                                /var/log/sftp.log

 

4. rsyslog 재시작

[root@localhost ~]# systemctl restart rsyslog

 

5. sftp.log 파일 생성 및 로그 확인

[root@localhost ~]#touch /var/log/sftp.log

[root@localhost ~]#tail -f /var/log/sftp.log

Mar 26 11:47:28 is sftp-server[18171]: session opened for local user root from [192.168.0.100]
Mar 26 11:47:28 is sftp-server[18171]: opendir "/root"
Mar 26 11:47:29 is sftp-server[18171]: closedir "/root"

 

반응형

'Server > CentOS' 카테고리의 다른 글

[CentOS] 명령어 기록하기  (0) 2021.07.02
[CentOS] Core 파일  (0) 2021.02.03
[CentOS] Google OTP를 활용한 SSH 추가 인증  (1) 2021.01.13
[CentOS] is not in the sudoers file  (0) 2021.01.11
[CentOS] 로그인 실패시 계정 잠금  (0) 2021.01.07
반응형
Warning: Using a password on the command line interface can be insecure.

 

1. login-path 설정

[root@localhost ~]# mysql_config_editor set --login-path=myroot --host=localhost --user=root --password

Enter password:

 

2. 등록 내역 확인

[root@localhost ~]# mysql_config_editor print --all

 

3. login-path 사용

[root@localhost ~]# mysql --login-path=myroot

 

4. login-path 삭제

[root@localhost ~]# mysql_config_editor remove --login-path=myroot

 

5. ERROR 1045 (28000): Access denied for user 에러가 발생할 경우

패스워드를 입력할 때 "를 앞, 뒤로 붙여서 입력합니다. 특수 문자(#, $, !)가 들어갈 경우 이러한 증상이 발생할 수 있습니다.

반응형
반응형

1. Core 파일

프로그램의 비정상적인 종료가 발생하여 커널에서 메모리를 덤프시킨 파일입니다.

 

2. Core 파일 확인

core.[PID값] 으로 파일이 생성됩니다.

 

[root@localhost ~]# ls -al

total 46274300
-rw-------  1 root root  498569216 Oct 19 16:49 core.10035
-rw-------  1 root root 1589530624 Oct 21 03:52 core.10403
-rw-------  1 root root 1689006080 Aug 20 04:41 core.11611
-rw-------  1 root root 1806168064 Jan 12 01:46 core.12294
-rw-------  1 root root 1666433024 Sep 24 20:47 core.12620

 

3. Core 파일 size 확인 (기본값 : 0)

core file size가 0일 경우 core file을 생성하지 않습니다.

 

[root@localhost ~]# ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 32765
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 32765
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

 

4. Core 파일의 바이너리 확인

[root@localhost ~]# gdb -c core.29019

GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5_5.2)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
BFD: Warning: /var/domain/core.29019 is truncated: expected core file size >= 1898045440, found: 10928128.
[New Thread 29025]
[New Thread 29024]
[New Thread 29022]
[New Thread 29021]
[New Thread 29020]
[New Thread 29019]
Core was generated by `/usr/local/sbin/named'.
Program terminated with signal 6, Aborted.
#0  0x00554402 in __kernel_vsyscall ()

 

5. Core 파일로 gdb 디버깅

[root@localhost ~]# gdb -c core.29019 /usr/local/sbin/named

반응형
반응형

Google OTP(Google Authenticator)를 이용하여 CentOS에 2-Factor 인증을 구성할 수 있습니다. 기존 패스워드로만 로그인 되던 방식에 OTP를 추가 함으로써 보안을 강화할 수 있습니다.

 

1. 시간 동기화

[root@localhost ~]# rdate time.bora.net

[root@localhost ~]# date
Wed Jan 13 09:42:46 KST 2021

 

2. EPEL Repository 설치

구글 OTP 패키지(google-authenticator)를 위해 EPEL Repository를 설치해야 됩니다.

 

[root@localhost ~]# yum install epel-release -y

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================
 Package                                         Arch                                      Version                                 Repository                                 Size
===================================================================================================================================================================================
Installing:
 epel-release                                    noarch                                    7-11                                    extras                                     15 k

Transaction Summary
===================================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                                |  15 kB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                                                        1/1 
  Verifying  : epel-release-7-11.noarch                                                                                                                                        1/1 

Installed:
  epel-release.noarch 0:7-11                                                                                                                                                       

Complete!

 

3. Google-Authenticator 설치

[root@localhost ~]# yum install google-authenticator

Dependencies Resolved

===================================================================================================================================================================================
 Package                                              Arch                                   Version                                    Repository                            Size
===================================================================================================================================================================================
Installing:
 google-authenticator                                 x86_64                                 1.04-1.el7                                 epel                                  48 k

Transaction Summary
===================================================================================================================================================================================
Install  1 Package

Total download size: 48 k
Installed size: 97 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/google-authenticator-1.04-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY]  16 kB/s |  32 kB  00:00:01 ETA 
Public key for google-authenticator-1.04-1.el7.x86_64.rpm is not installed
google-authenticator-1.04-1.el7.x86_64.rpm                                                                                                                  |  48 kB  00:00:02     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : google-authenticator-1.04-1.el7.x86_64                                                                                                                          1/1 
  Verifying  : google-authenticator-1.04-1.el7.x86_64                                                                                                                          1/1 

Installed:
  google-authenticator.x86_64 0:1.04-1.el7                                                                                                                                         

Complete!

 

4. PAM 모듈 설정

[root@localhost ~]# vi /etc/pam.d/sshd

#%PAM-1.0
auth       required     pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin

### Google Authenticator(Google OTP) ###  ← 추가
auth       required     pam_google_authenticator.so    nullok  ← 추가

# Used with polkit to reauthorize users in remote sessions
-auth      optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
-session   optional     pam_reauthorize.so prepare

nullok : 리눅스 내 모든 사용자 각각의 "Secret Key"를 생성합니다. 동일한 Secret Key를 사용이 필요한 경우 때 해당 옵션을 삭제하면 됩니다.

 

5. ssh config 파일 수정

[root@localhost ~]# vi /etc/ssh/sshd_config

옵션 설명
PermitEmptyPasswords no 비어 있는 사용자 암호 허용 여부
PasswordAuthentication no 패스워드 인증 사용 여부(OTP 인증시에는 사용X)
ChallengeResponseAuthentication yes 시도-응답 인증 방식을 사용 여부(2-Factor 인증을 위해 필요)
UsePAM yes 인증 PAM 모듈 사용 여부

위 표와 같이 수정을 합니다.

 

6. sshd 재시작

[root@localhost ~]# systemctl restart sshd


7. Google Authenticator 인증 파일 생성

[root@localhost ~]# google-authenticator

 

1) 인증 토근을 시간 기반(Time-Based)으로 선택

Do you want authentication tokens to be time-based (y/n) y

 

QR 코드가 생성되고 QR 코드 밑에 아래와 같이 Secret Key와 백업 코드가 출력됩니다.

Your new secret key is: IPUUHIOMJ4YVDZEKN7D62HSPO4
Your verification code is 092264
Your emergency scratch codes are:
  66905078
  21438147
  22384034
  77127198
  68711227

 

2) Secret Key 및 백업 코드 저장 file 위치 확인

Do you want me to update your "/root/.google_authenticator" file? (y/n) y

[root@localhost ~]# cat /root/.google_authenticator

IPUUHIOMJ4YVDZEKN7D62HSPO4 
" RATE_LIMIT 3 30 
" WINDOW_SIZE 17 
" DISALLOW_REUSE 
" TOTP_AUTH 
66905078 
21438147 
22384034 
77127198 
68711227 

해당 경로에 Secret Key 및 백업 코드가 저장된 것을 확인할 수 있습니다.

 

3) Man-in-the-middel Attack 사용 여부

Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y

 

4) 시간 오차 또는 왜곡 방지 사용 여부

By default, a new token is generated every 30 seconds by the mobile app.
In order to compensate for possible time-skew between the client and the server,
we allow an extra token before and after the current time. This allows for a
time skew of up to 30 seconds between authentication server and client. If you
experience problems with poor time synchronization, you can increase the window
from its default size of 3 permitted codes (one previous code, the current
code, the next code) to 17 permitted codes (the 8 previous codes, the current
code, and the 8 next codes). This will permit for a time skew of up to 4 minutes
between client and server.
Do you want to do so? (y/n) y

 

5) 무차별 대입 공격 방지 사용 여부

If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting? (y/n) y

 

공격자가 30 초마다 3번 이상 로그인을 시도하지 못하도록 제한 옵션이며, 3회 이상 인증 실패시 일시적으로 로그인을 차단합니다.

 

8. 구글 OTP 앱에서 설정

1) Google Authentication 시작하기

시작하기 버튼을 클릭합니다.

 

2) QR 코드 확인

QR 코드 스캔 버튼을 클릭합니다. 위에서 생성된 QR 코드를 스캔합니다.(설정 키를 입력해도 됩니다.)

 

3) Verification code 입력 창

Google-Authentication이 설정되면 Secure CRT에서 패스워드를 입력 후에 위와 같이 Verfication code를 입력하는 창이 보여지게 됩니다.

 

4) 스마트폰 Google Authentication App에서 코드 확인

랜덤한 숫자가 발생되며, 오른쪽에 남은 시간이 표시됩니다.

 

5) Verification code 입력

Google Authentication 앱에서 생성된 코드를 입력하고 OK 버튼을 클릭합니다.

 

9. 일반 사용자 Google OTP 설정

1) 사용자 계정 생성 및 패스워드 지정

[root@localhost ~]# useradd latch
[root@localhost ~]# passwd latch
Changing password for user latch.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

 

2) 사용자 계정으로 로그인

[root@localhost ~]# su latch
[latch@localhost ~]# google-authenticator 

 

3) Goole Authenticator 설정(사용자 계정)

QR 코드가 생성되고 QR 코드 밑에 아래와 같이 Secret Key와 백업 코드가 출력됩니다. 

 

기타 설정은 root와 동일하기 때문에 여기에서는 생략합니다..

 

[latch@localhost ~]$ ls -al /home/latch/
total 24
drwx------  2 latch latch 4096 Jan 13 10:17 .
drwxr-xr-x. 3 root  root  4096 Jan 13 10:16 ..
-rw-r--r--  1 latch latch   18 Apr  1  2020 .bash_logout
-rw-r--r--  1 latch latch  193 Apr  1  2020 .bash_profile
-rw-r--r--  1 latch latch  231 Apr  1  2020 .bashrc
-r--------  1 latch latch  136 Jan 13 10:17 .google_authenticator

사용자 홈 디렉토리에 .google_authenticator가 존재하는 것을 확인할 수 있습니다.

 

[latch@localhost ~]$ cat .google_authenticator 
QPCIPAXXG56D5YNXPUE4BGNUHY
" RATE_LIMIT 3 30
" WINDOW_SIZE 17
" DISALLOW_REUSE
" TOTP_AUTH
39277376
47772753
74567860
94211848
21118315
위와 같이 각 계정 별로 .google_authenticator 파일이 생성됩니다.

 

일반 계정으로 로그인할 때 Verfication Code를 입력하라는 창이 보여지는 것을 확인할 수 있습니다.

반응형

'Server > CentOS' 카테고리의 다른 글

[CentOS] SFTP Log 설정  (0) 2021.03.26
[CentOS] Core 파일  (0) 2021.02.03
[CentOS] is not in the sudoers file  (0) 2021.01.11
[CentOS] 로그인 실패시 계정 잠금  (0) 2021.01.07
[CentOS] su 명령어 특정 사용자만 허용  (0) 2021.01.07
반응형

1. 이더넷 이름 확인

root@latch:~# ifconfig -a

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:d8ff:fe17:c88a  prefixlen 64  scopeid 0x20<link>
        ether 02:42:d8:17:c8:8a  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5  bytes 446 (446.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.100  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::250:56ff:feb8:8d2  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:b8:08:d2  txqueuelen 1000  (Ethernet)
        RX packets 3284  bytes 301412 (301.4 KB)
        RX errors 0  dropped 3  overruns 0  frame 0
        TX packets 1815  bytes 352978 (352.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ifconfig -a 명령어를 통해 이더넷 이름을 확인합니다.

 

root@latch:~# cd /etc/netplan

기존(/etc/network의 interfaces 파일 수정) 네트워크 설정이 /etc/netplan(17버전 이상)으로 변경되었습니다.

 

2. 00-installer-config.yaml 수정

root@latch:~# vi 00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
        ens160:
                dhcp6: no
                addresses: [192.168.0.100/24]
                gateway4: 192.168.0.1
                nameservers:
                        addresses: [168.126.63.1, 168.126.63.2]

  version: 2

3. netplan 적용 및 확인

root@latch:/etc/netplan# sudo netplan apply
root@latch:/etc/netplan# hostname -I
192.168.0.100

 

반응형
반응형

1. nginx 이미지 다운로드

root@latch:~# docker pull nginx

Using default tag: latest
latest: Pulling from library/nginx
6ec7b7d162b2: Pull complete 
cb420a90068e: Pull complete 
2766c0bf2b07: Pull complete 
e05167b6a99d: Pull complete 
70ac9d795e79: Pull complete 
Digest: sha256:1407c60d1d6c523a495c7b4e4a1206abce469f875d18f4207a3907f03891231b
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

nginx 이미지를 다운로드합니다.

 

2.  nginx 이미지 다운로드 확인

root@latch:~# docker image ls

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    ae2feff98a0c   3 weeks ago   133MB
ubuntu       latest    f643c72bc252   6 weeks ago   72.9MB

nginx 이미지가 다운로드 된 것을 확인할 수 있습니다.

 

3. 이미지를 이용하여 nginx 서버 실행

root@latch:~# docker container run --name webserver -d -p 80:80 nginx

22e28bdc7f4e761185906424f18fff9269601d319a889eda7147195ef37696be

nginx 서버가 정상적으로 실행되었습니다.

 

4. nginx 서버 상태 확인

root@latch:~# docker container ps

CONTAINER ID   IMAGE     COMMAND                  CREATED              STATUS              PORTS                NAMES
22e28bdc7f4e   nginx     "/docker-entrypoint.…"   About a minute ago   Up About a minute   0.0.0.0:80->80/tcp   webserver

nginx 서버가 작동 중인 것을 확인할 수 있습니다.

 

5. 컨테이너 작동 확인

root@latch:~# docker container stats webserver

CONTAINER ID   NAME        CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O     PIDS
22e28bdc7f4e   webserver   0.00%     2.551MiB / 3.853GiB   0.06%     1.05kB / 0B   0B / 8.19kB   2
CONTAINER ID   NAME        CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O     PIDS
22e28bdc7f4e   webserver   0.00%     2.551MiB / 3.853GiB   0.06%     1.05kB / 0B   0B / 8.19kB   2

 

6. 컨테이너 정지

root@latch:~# docker stop webserver
webserver

 

7. 컨테이너 실행

root@latch:~# docker start webserver
webserver

 

8. 웹 페이지 확인

nginx 웹 페이지가 열리는 것을 확인할 수 있습니다.

 

9. 컨테이너 접속

root@latch:~# docker exec -i -t webserver bash 
root@22e28bdc7f4e:/etc/nginx/conf.d# vi default.conf

server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

webserver 컨테이너 안에 nginx conf 파일에 접근이 되는 것을 확인 할 수 있습니다.

 

10. 컨테이너 저장 위치 확인

root@latch:~# docker exec -i -t webserver bash 

root@22e28bdc7f4e:/# touch a.txt

root@22e28bdc7f4e:/# ls

a.txt  bin  boot  dev  docker-entrypoint.d  docker-entrypoint.sh  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

root@22e28bdc7f4e:/# exit
exit

 

root@latch:~# cd /var/lib/docker/overlay2/1013953725dd5bcd0f153131609726fc2723fe2616dc8df31ab22bb85f3ddad3/diff

 

root@latch:/var/lib/docker/overlay2/1013953725dd5bcd0f153131609726fc2723fe2616dc8df31ab22bb85f3ddad3/diff# ls
a.txt  etc  root  run  tmp  usr  var

반응형

'Cloud > Docker' 카테고리의 다른 글

[Ubuntu] Docker 설치  (0) 2021.01.12
[CentOS] Docker 설치  (0) 2021.01.12
반응형

1. 구 버전 삭제

root@latch:~# sudo apt-get remove docker docker-engine docker.io containerd runc

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package docker
E: Unable to locate package docker-engine
E: Unable to locate package docker.io
E: Couldn't find any package by glob 'docker.io'
E: Couldn't find any package by regex 'docker.io'
E: Unable to locate package containerd
E: Unable to locate package runc

 

2. Repository 설치

1) Repository 구성

root@latch:~# sudo apt-get update

root@latch:~# sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

 

2) GPG Key 추가

root@latch:~# curl -fsSL https://download.docker.com/com/linux/ubuntu/gpg | sudo apt-key add - 

OK

 

3) GPG Key 확인

root@latch:~#  sudo apt-key fingerprint 0EBFCD88

pub   rsa4096 2017-02-22 [SCEA]
      9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid           [ unknown] Docker Release (CE deb) <docker@docker.com>
sub   rsa4096 2017-02-22 [S]

 

4) 리포지토리 등록

root@latch:~# root@latch:~# sudo add-apt-repository \

> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \

> $(lsb_release -cs) \

> stable"

Get:1 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]
Get:2 https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages [15.4 kB]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease                           
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-security InRelease
Fetched 79.8 kB in 2s (49.1 kB/s)
Reading package lists... Done

 

root@latch:~# sudo apt-get update

Hit:1 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease         
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 252 kB in 3s (94.5 kB/s)   
Reading package lists... Done

 

3. Docker 설치

root@latch:~# sudo apt-get install docker-ce docker-ce-cli containerd.io

Setting up docker-ce-rootless-extras (5:20.10.2~3-0~ubuntu-bionic) ...
Processing triggers for systemd (237-3ubuntu10.42) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1.2) ...

 

4. Docker Container 실행

root@latch:~# docker container run ubuntu:latest /bin/echo 'Hello World'

Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
da7391352a9b: Pull complete 
14428a6d4bcd: Pull complete 
2c2d948710f2: Pull complete 
Digest: sha256:c95a8e48bf88e9849f3e0f723d9f49fa12c5a00cfc6e60d2bc99d87555295e4c
Status: Downloaded newer image for ubuntu:latest
Hello World

 

5. Docker 버전 확인

root@latch:~# docker version

Client: Docker Engine - Community
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:17:32 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:15:09 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

 

6. Docker 실행 환경 확인

root@latch:~# docker system info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 1
 Server Version: 20.10.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-112-generic
 Operating System: Ubuntu 18.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.853GiB
 Name: latch
 ID: ZVEZ:CNJS:DMLG:CK3F:BZQ3:5C4E:JRRH:Q55W:UC7C:CZW2:4I5W:6XQU
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

 

7. Docker 디스크 이용 상황

root@latch:~# docker system df

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          1         1         72.9MB    0B (0%)
Containers      1         0         0B        0B
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B

 

8. Docker 이미지 확인

root@latch:~# docker image ls

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    f643c72bc252   6 weeks ago   72.9MB

 

반응형

'Cloud > Docker' 카테고리의 다른 글

[Docker] Nginx 실행  (0) 2021.01.12
[CentOS] Docker 설치  (0) 2021.01.12
반응형

1. 구 버전 Docker 삭제

[root@localhost ~]# sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
Loaded plugins: fastestmirror
No Match for argument: docker
No Match for argument: docker-client
No Match for argument: docker-client-latest
No Match for argument: docker-common
No Match for argument: docker-latest
No Match for argument: docker-latest-logrotate
No Match for argument: docker-logrotate
No Match for argument: docker-engine
No Packages marked for removal
구 버전이 존재할 경우 구 버전을 삭제합니다.

 

2. 저장소 설치

1) 저장소 구성

[root@localhost ~]# sudo yum install -y yum-utils

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8                                                                                                                                               

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7.5   python-chardet.noarch 0:2.2.1-3.el7   python-kitchen.noarch 0:1.1.1-5.el7
  
Dendency Updated:
  libxml2.x86_64 0:2.9.1-6.el7.5 
  
Complete!

yum-utils 패키지를 설치합니다.

 

[root@localhost ~]# sudo yum-config-manager --add-repo download.docker.com/linux/centos/docker-ce.repo

https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

저장소를 설정합니다.

 

3. Docker 엔진 설치

1) Docker 엔진 및 컨테이너 설치

[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io

Total                                                                                                                                               38 MB/s | 102 MB  00:00:02     
Retrieving key from https://download.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]:y

메시지에 표시되는 지문이 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35와 일치하는지 확인하고 일치하면 수락합니다.

 

2) Nightly, Test 저장소 사용(선택 사항)

(1) Nightly 활성화
[root@localhost ~]# sudo yum-config-manager --enable docker-ce-nightly

(2) Test 활성화
[root@localhost ~]# sudo yum-config-manager --enable docker-ce-test

(3) Nightly 비활성화
[root@localhost ~]# sudo yum-config-manager --disable docker-ce-nightly

 

3) 특정 버전 설치를 위한 저장소에서 버전 확인(선택 사항)

[root@localhost ~]# yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64            18.06.3.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.2.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.06.0.ce-3.el7                   docker-ce-stable 
docker-ce.x86_64            18.03.1.ce-1.el7.centos            docker-ce-stable 
docker-ce.x86_64            18.03.0.ce-1.el7.centos            docker-ce-stable 

 

4) 특정 버전의 Docker 설치(선택 사항)

[root@localhost ~]# sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

 

4. Docker 실행

[root@localhost ~]# sudo systemctl start docker

 

5. Docker Container 실행

[root@localhost ~]# sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

6. Docker 버전 확인

[root@localhost ~]# docker version

Client: Docker Engine - Community
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:17:48 2020
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:16:13 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

 

반응형

'Cloud > Docker' 카테고리의 다른 글

[Docker] Nginx 실행  (0) 2021.01.12
[Ubuntu] Docker 설치  (0) 2021.01.12

+ Recent posts