728x90
반응형

시그널(Signal) 이란? 

Signal 이란 프로세나 시스템에 이벤트를 전달하는 신호를 나타냅니다. 

일반적으로 흔시 하용하는 Ctrl +C 같은 경우도 Signal의 한 종류이다.

 

시그널(Signal) 종류

리눅스 콘솔 창 에서 kill -l 명령을 사용하면 시그널 리스트를 확인 할 수 있다. 

 

$ kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX

$  help kill
kill: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
    Send a signal to a job.
    
    Send the processes identified by PID or JOBSPEC the signal named by
    SIGSPEC or SIGNUM.  If neither SIGSPEC nor SIGNUM is present, then
    SIGTERM is assumed.
    
    Options:
      -s sig    SIG is a signal name
      -n sig    SIG is a signal number
      -l        list the signal names; if arguments follow `-l' they are
        assumed to be signal numbers for which names should be listed
    
    Kill is a shell builtin for two reasons: it allows job IDs to be used
    instead of process IDs, and allows processes to be killed if the limit
    on processes that you can create is reached.
    
    Exit Status:
    Returns success unless an invalid option is given or an error occurs.

 

시그널(Signal) 종류 및 설명 

리눅스 시그널 종류

 

trap을 이용한 Signal 처리 예제

 무한으로 수행되는 쉘 코드로 trap 을 이용한 시그널 처리 동작에 대해 알아보겠습니다. 

소개하는 코드는 1 초마다 현재 수행되고 있는 loop.sh 프로세스를 확인하고 

CTRL +C 시그널을 포착해서 프로그램을 종료하는 예제입니다. 

 

loop.sh 수행 순서

while loop 수행 : loop count : [1]

사용자 CTRL+C (​SIGINT:2  시그널 발생​) => _int() 함수 호출 => kill -15 (SIGTERM ) 시그널 발생 
=>_term() 함수 호출 => kill -9로 loop.sh 프로세스 종료

 

loop.sh

#!/bin/bash

loop_cnt=0
echo "=================================="
echo "======= LOOP SHELL PROCESS ======="
echo "=================================="

ps -ef|grep loop.sh
process=`ps -ef|grep loop.sh |awk '{print $2}'`
echo "PROCESS_ID:[ $process ]"

########### SIGTERM handler ############
function _term() {
 echo "SIGTERM Event call"
 kill -9 $process
}

########### SIGINT handler ############
function _int() {
 echo "SIGINT Event call"
 kill -15 $process

}


trap _term SIGTERM

trap _int SIGINT

while true
do
loop_cnt=`expr $loop_cnt + 1`

echo "loop count : [$loop_cnt]"

sleep 1

done

 

수행 결과

728x90
반응형

'06.OS > Linux' 카테고리의 다른 글

[CentOS]Host Name 변경  (0) 2022.03.26
[Ubuntu] Vmware Ubuntu20.04 LTS 설치  (0) 2022.03.26
Ubuntu SSH 접속 방법  (0) 2022.03.20
Ubuntu 명령어  (0) 2022.03.19
우분투 Chrom(크롬)설치  (0) 2022.03.09
728x90
반응형

Oralce 환경설정 방법

앞서 docker-compose 를 이용한 Oracle 19c 설치 글에서는 단순히  설치 방법에 대해서 알아보았습니다. 

이번에는 Docker 설치후 테스트를 좀더 효율적으로 진행하기 위한 방법에 대해 소개하겠습니다. 

 

_ORACLE_SCRIPT 파라미터 적용 

19c 에서는 테이블이나 유저를 생성하게 되면 ORA-65096 에러가 발생 합니다. 

_ORACLE_SCRIPT  파라미터를 변경함으로서 에러발생을 해결 할 수 있습니다. 

 

 

SQL> create user test1 identified by test;
create user test1 identified by test
            *
ERROR at line 1:
ORA-65096: invalid common user or role name


SQL> ALTER SESSION SET "_ORACLE_SCRIPT"=true;

Session altered.

SQL> 
SQL> create user test1 identified by test;        

User created.

외부 장비 접속 설정 (네트워크 설정)

 

tnsnames.ora 설정

ORCLCDB=localhost:1521/ORCLCDB

ora19c= 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORCLCDB)
  )
)
ORCLPDB1= 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = ORCLPDB1)
  )
)

listener.ora 설정

LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  )
)

SID_LIST_LISTENER =
(SID_LIST =
    (SID_DESC =
        (GLOBAL_DBNAME = ORCLCDB)
        (SID_NAME = ORCLCDB)
    )     
    (SID_DESC =
        (GLOBAL_DBNAME = ORCLPDB1)
        (SID_NAME =ORCLPDB1)                
    )
)

 

 

리스너 재시작 

[oracle@01a4f713764f ~]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-MAR-2022 13:34:19

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
[oracle@01a4f713764f ~]$ lsnrctl stop

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-MAR-2022 13:34:23

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@01a4f713764f ~]$ lsnrctl start 

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-MAR-2022 13:34:36

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/01a4f713764f/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                20-MAR-2022 13:34:37
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/01a4f713764f/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "ORCLCDB" has 1 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
Service "ORCLPDB1" has 1 instance(s).
  Instance "ORCLPDB1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

리스너 상태 확인 

[oracle@01a4f713764f ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 20-MAR-2022 13:35:44

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                20-MAR-2022 13:34:37
Uptime                    0 days 0 hr. 1 min. 7 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/01a4f713764f/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=01a4f713764f)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "ORCLCDB" has 2 instance(s).
  Instance "ORCLCDB", status UNKNOWN, has 1 handler(s) for this service...
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLCDBXDB" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
Service "ORCLPDB1" has 2 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
  Instance "ORCLPDB1", status UNKNOWN, has 1 handler(s) for this service...
Service "da8f3910a1110e42e053020012ac8b77" has 1 instance(s).
  Instance "ORCLCDB", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@01a4f713764f ~]$ 

sqlplus 접속 확인

 

[oracle@01a4f713764f ~]$ sqlplus sys/oracle@ora19c as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Mar 20 13:37:44 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select * from dual;

D
-
X

 

728x90
반응형
728x90
반응형

이전에  Docker 를 활용해 Oracle19c 를 설치 하는 방법에 알아 보았습니다. 

이번에는 docker-compose 를 활용해서 Oracle19c 를 설치 해보겠습니다. 

 

설치를 위한 파일 구조 생성 

이전에 소개했던 오라클19c 설치 글 (https://growupcoding.tistory.com/18 ) 내용과 거의 동일 하며 

Docker 오라클 실행 부분만 docker-compose를 활용해 설치해보겠습니다. 

compose 디렉토리 생성 및 공유 디렉토리 권한 변경

  • compose : 파일 및 Oracle19c 가 설치될 파일 디렉토리를 만듭니다. 
  • docker-compose.ora19c.yml : 이미지 빌드를 하기 위한 compose 파일 
  • or19env :  오라클 환경파일(ORACLE_HOME, ORACLE_SID)
  • oradata/ora19_data :오라클 데이터 파일이 생성될 공유 디렉토리

 

oracle-docker@ubuntu2004:~$ tree compose/
compose/
|-- docker-compose.ora19c.yml
|-- or19env
`-- oradata
    `-- ora19_data
        |-- ORCLCDB [error opening dir]
        `-- dbconfig
            `-- ORCLCDB
                |-- listener.ora
                |-- orapwORCLCDB
                |-- oratab
                |-- spfileORCLCDB.ora
                |-- sqlnet.ora
                `-- tnsnames.ora

 

compose 디렉토리 생성

mkdir -p compose/oradata/ora19_data

chmod -Rf 777 compose/oradata/ora19_data

사전 확인 및 준비 사항 (image,환경파일) 

oracle-docker@ubuntu2004:~/compose$ docker image ls
REPOSITORY        TAG         IMAGE ID       CREATED        SIZE
oracle/database   19.3.0-ee   c711d39c5597   2 hours ago    6.53GB
oraclelinux       7-slim      8dd98256c841   10 hours ago   133MB


oracle-docker@ubuntu2004:~/compose$ vi ora19env 
ORACLE_PWD=oracle
ORACLE_SID=orclcdb

docker-compose.yml 작성 

  • env_file : 오라클에서 container 사용하게될 환경 변수 입니다. 
  • image : 빌드를 하게될 오라클 19c 이미지입니다. 
  • ports : 오라클 컨테이너와 통신에 사용하게될 통신 포트 입니다. 설정은 host port: container port 로 작성 합니다. 
  • volumes : 컨테이너와 공유하게될 호스트 볼륨 정보입니다. 
version: '3.8'

 services:
     ora19c:
         container_name: ora19c
 
         env_file:
             - ora19env
 
         image: oracle/database:19.3.0-ee
 
         ports:
             - 1521:1521
             - 5500:5500
 
         volumes:
             - ./oradata/ora19_data:/opt/oracle/oradata
 
         privileged: true

Docker 명령어와 비교해 보겠습니다.

빌드시 항항 명령어를 기억해야 하지만 docker-compose 파일로 관리 하면 이미지별 컨테이너 관리도 쉽습니다. 

또 서비스에 여러개의 컨테이너를 등록 할수도 있습니다. 

  • 오라클 Docker 명령
docker run  \
--name oracle19c \
-p 1519:1521 \
-p 5519:5500 \
-e ORACLE_PWD=oracle \
-e ORACLE_SID=orclcdb \
-v ./data:/opt/oracle/oradata \
oracle/database:19.3.0-ee

 

docker-compose 빌드 

[oracle-docker@ubuntu2004:/home/oracle-docker/compose]$ docker-compose -f docker-compose.ora19c.yml up
Creating network "compose_default" with the default driver
Creating ora19c ... done
Attaching to ora19c
ora19c    | ORACLE EDITION: ENTERPRISE
ora19c    | 
ora19c    | LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 19-MAR-2022 08:09:28
ora19c    | 
ora19c    | Copyright (c) 1991, 2019, Oracle.  All rights reserved.
ora19c    | 
ora19c    | Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait...
ora19c    | 
ora19c    | TNSLSNR for Linux: Version 19.0.0.0.0 - Production
ora19c    | System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
ora19c    | Log messages written to /opt/oracle/diag/tnslsnr/bc698e003576/listener/alert/log.xml
ora19c    | Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
ora19c    | Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
ora19c    | 
ora19c    | Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
ora19c    | STATUS of the LISTENER
ora19c    | ------------------------
ora19c    | Alias                     LISTENER
ora19c    | Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
ora19c    | Start Date                19-MAR-2022 08:09:32
ora19c    | Uptime                    0 days 0 hr. 0 min. 3 sec
ora19c    | Trace Level               off
ora19c    | Security                  ON: Local OS Authentication
ora19c    | SNMP                      OFF
ora19c    | Listener Parameter File   /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
ora19c    | Listener Log File         /opt/oracle/diag/tnslsnr/bc698e003576/listener/alert/log.xml
ora19c    | Listening Endpoints Summary...
ora19c    |   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
ora19c    |   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
ora19c    | The listener supports no services
ora19c    | The command completed successfully
ora19c    | Prepare for db operation
ora19c    | 8% complete
ora19c    | Copying database files
ora19c    | 31% complete
ora19c    | Creating and starting Oracle instance
ora19c    | 32% complete
ora19c    | 36% complete
ora19c    | 40% complete
ora19c    | 43% complete
ora19c    | 46% complete
ora19c    | Completing Database Creation
ora19c    | 51% complete
ora19c    | 54% complete
ora19c    | Creating Pluggable Databases
ora19c    | 58% complete
ora19c    | 77% complete
ora19c    | Executing Post Configuration Actions
ora19c    | 100% complete
ora19c    | Database creation complete. For details check the logfiles at:
ora19c    |  /opt/oracle/cfgtoollogs/dbca/ORCLCDB.
ora19c    | Database Information:
ora19c    | Global Database Name:ORCLCDB
ora19c    | System Identifier(SID):ORCLCDB
ora19c    | Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.log" for further details.
ora19c    | 
ora19c    | SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 19 08:41:27 2022
ora19c    | Version 19.3.0.0.0
ora19c    | 
ora19c    | Copyright (c) 1982, 2019, Oracle.  All rights reserved.
ora19c    | 
ora19c    | 
ora19c    | Connected to:
ora19c    | Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
ora19c    | Version 19.3.0.0.0
ora19c    | 
ora19c    | SQL> 
ora19c    | System altered.
ora19c    | 
ora19c    | SQL> 
ora19c    | System altered.
ora19c    | 
ora19c    | SQL> 
ora19c    | Pluggable database altered.
ora19c    | 
ora19c    | SQL> 
ora19c    | PL/SQL procedure successfully completed.
ora19c    | 
ora19c    | SQL> SQL> 
ora19c    | Session altered.
ora19c    | 
ora19c    | SQL> 
ora19c    | User created.
ora19c    | 
ora19c    | SQL> 
ora19c    | Grant succeeded.
ora19c    | 
ora19c    | SQL> 
ora19c    | Grant succeeded.
ora19c    | 
ora19c    | SQL> 
ora19c    | Grant succeeded.
ora19c    | 
ora19c    | SQL> 
ora19c    | User altered.
ora19c    | 
ora19c    | SQL> SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
ora19c    | Version 19.3.0.0.0
ora19c    | The Oracle base remains unchanged with value /opt/oracle
ora19c    | The Oracle base remains unchanged with value /opt/oracle
ora19c    | #########################
ora19c    | DATABASE IS READY TO USE!
ora19c    | #########################
ora19c    | The following output is now a tail of the alert.log:
ora19c    | ORCLPDB1(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
ora19c    | ORCLPDB1(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
ora19c    | 2022-03-19T08:41:28.125385+00:00
ora19c    | ALTER SYSTEM SET control_files='/opt/oracle/oradata/ORCLCDB/control01.ctl' SCOPE=SPFILE;
ora19c    | 2022-03-19T08:41:28.318093+00:00
ora19c    | ALTER SYSTEM SET local_listener='' SCOPE=BOTH;
ora19c    |    ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
ora19c    | Completed:    ALTER PLUGGABLE DATABASE ORCLPDB1 SAVE STATE
ora19c    | 
ora19c    | XDB initialized.
ora19c    | 2022-03-19T08:50:54.083033+00:00
ora19c    | ORCLPDB1(3):Resize operation completed for file# 10, old size 327680K, new size 337920K
ora19c    | 2022-03-19T09:00:56.067953+00:00
ora19c    | Resize operation completed for file# 3, old size 522240K, new size 532480K

Docker 프로세스 확인

  • docker-compose -f docker-compose.ora19c.yml ps -a
  • docker ps -a 

oracle-docker@ubuntu2004:~/compose$ docker-compose -f docker-compose.ora19c.yml ps -a
 Name               Command                  State                                             Ports                                       
-------------------------------------------------------------------------------------------------------------------------------------------
ora19c   /bin/sh -c exec $ORACLE_BA ...   Up (healthy)   0.0.0.0:1521->1521/tcp,:::1521->1521/tcp, 0.0.0.0:5500->5500/tcp,:::5500->5500/tcp
oracle-docker@ubuntu2004:~/compose$ docker-compose -f docker-compose.ora19c.yml ps 
 Name               Command                  State                                             Ports                                       
-------------------------------------------------------------------------------------------------------------------------------------------
ora19c   /bin/sh -c exec $ORACLE_BA ...   Up (healthy)   0.0.0.0:1521->1521/tcp,:::1521->1521/tcp, 0.0.0.0:5500->5500/tcp,:::5500->5500/tcp
oracle-docker@ubuntu2004:~/compose$ docker ps -a
CONTAINER ID   IMAGE                       COMMAND                  CREATED             STATUS                   PORTS                                                                                  NAMES
bc698e003576   oracle/database:19.3.0-ee   "/bin/sh -c 'exec $O   About an hour ago   Up 5 minutes (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:5500->5500/tcp, :::5500->5500/tcp   ora19c

 

Docker Container 실행 및 컨테이너 접속

 

실행결과

oracle-docker@ubuntu2004:~/compose$ docker-compose -f docker-compose.ora19c.yml up -d
Starting ora19c ... done
oracle-docker@ubuntu2004:~/compose$ docker-compose -f docker-compose.ora19c.yml exec ora19c /bin/bash
[oracle@01a4f713764f ~]$ sqlplus sys/oracle as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 19 23:13:42 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select * from dual;

D
-
X

SQL> 

Docker-compose 기본 명령 

docker-compose -f [docker compose 파일] [명령어]
docker-compose -f docker-compose.ora19c.yml up
docker-compose -f docker-compose.ora19c.yml up -d // 백그라운드 모드 실행 

docker-compose -f docker-compose.ora19c.yml start // 정지한 컨테이너를 시작
docker-compose -f docker-compose.ora19c.yml start ora19c // 컨테이너가 여러개일경우 ora19c 

docker-compose -f docker-compose.ora19c.yml restart // 이미 실행 중인 컨테이너 다시 시작





docker-compose -f docker-compose.ora19c.yml stop // 컨테이너 중지

docker-compose -f docker-compose.ora19c.yml down // 컨테이너 중지및 삭제

docker-compose -f docker-compose.ora19c.yml  logs // 컨테이너로그 확인

docker-compose -f docker-compose.ora19c.yml ps // 컨테이너 목록 

//Docker 접속 
docker-compose exec [컨테이너] [명령어]
docker-compose -f docker-compose.ora19c.yml exec ora19c /bin/bash​
728x90
반응형
728x90
반응형

MyOra  툴은 무료로 오라클 sql 작업이나 DB 자원 모니터링을 할수 있는 툴입니다. 

해당 툴을 다운로드 해서 사용하는 방법에 대해 소개하겠습니다. 

MyOra 다운로드

아래 경로에서 해당 툴 다운로드 받습니다. 

https://www.myorasql.com/download.html

현재는 9.4 버전 까지 Release 되어있습니다. (2022.03.21) 

 

MyOra 다운로드

 

MyOra 실행

다운로드 받은 앞출 파일을 해제 후 프로그램을 실행합니다. 

설치된 java 버전에 따라 실행 파일이 다릅니다. 

제환경은 1.8 jdk 가 설치 되어 있어 MyOra-9.4\Java1_8andBelow 디렉토리에있는 MyOra 파일을 실행 하겠습니다. 

* 주의 : 접속하로자 하는 오라클 jdbc 라이브러리가 실행 파일 경로에 위치해야 합니다. 

 

https://growupcoding.tistory.com/27 글 에서 설치한 오라클 jdbc 파일을 MyOra-9.4\Java1_8andBelow 로 복사하겠습니다. 

 

 

 

라이센스 동의 후 실행
접속 연결 설정

 

 

오라클 자원 사용률 모니터링 

 

 

Top Query 조회 

 

 

Instance 정보

SQL Editor

기본 SQL Editor 도 지원 합니다. 쿼리 실행 단축키는 F9 번입니다. 

728x90
반응형
728x90
반응형

samba (삼바)란?

삼바(samba)는 Windows 운영체제를 사용하는 PC에서 Linux 또는 UNIX 서버에 접속하여 파일이나 프린터를 공유하여 사용할 수 있도록 해 주는 소프트웨어입니다. 

 

윈도우는 파일 시스템은 NTFS 이고 리눅스는 ext 입니다.

파일 시스템이 서로 다르다 보니 서로의 하드 디스크를 읽거나 쓰지 못합니다. 이러한 이유로 서로다른 파일 시스템의 자료를 공유 할수 있도록 하기 위한 소프트웨어로 삼바를 사용하게 됩니다.

 

설치를 진행하게될 리눅스 서버는 CentOS Linux release 7.9.2009 (Core) 입니다. 

samba 설치 

 yum install samba

samba 버전확인 

$ rpm -qa samba
samba-4.10.16-18.el7_9.x86_64

공유 데릭토리 생성

//삼바 접속 계정생성
adduser -d /data1/mydata mydata

//삼바 passwd 설정 
passwd mydata

//공유 디렉토리 생성
mkdir sharedisk

samba user 등록

 smbpasswd -a mydata

samba 환경설정

  • 변경 및 추가 부분은 색깔로 표시 했습니다.
vi /etc/samba/smb.conf

[global]
        workgroup = WORKGROUP // 작업그룹 설정
        security = user

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
        hosts allow = 192.168.17. // 접속 허용 IP 설정

[homes]
        comment = Home Directories
        valid users = %S, %D%w%S
        browseable = No
        read only = No
        inherit acls = Yes

[printers]
        comment = All Printers
        path = /var/tmp
        printable = Yes
        create mask = 0600
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/drivers
        write list = @printadmin root
        force group = @printadmin
        create mask = 0664
        directory mask = 0775

[mydata] // 윈도우 네트워크 드라이브상에  출력될 이름
        path = /data1/mydata/sharedisk // 리눅스 공유 디렉토리 생성 
        public = yes // 공유 
        writable = yes //쓰기가능 
        write list = smbuser // 접속 허용 유저 ,삼바 유저로 등록 한 계정 , 여러 계정일 경우 씌워쓰기로 설정 
        create mask = 0777 // 생성 권한
        directory mask = 0777 // 디렉토리 권한 설정 

 

방화벽 해제

// 방화벽 해제
firewall-cmd --permanent --add-port=139/tcp 

firewall-cmd --permanent --add-port=445/tcp

firewall-cmd --permanent --zone=public --add-service=samba

firewall-cmd --reload

//삼바 재시작
systemctl restart smb

Samba 상태 확인 

[root@minsvr:/root]$ smbstatus                

Samba version 4.10.16
PID     Username     Group        Machine                                   Protocol Version  Encryption           Signing              
----------------------------------------------------------------------------------------------------------------------------------------
11114   mydata       mydata       192.168.xx.xx (ipv4:192.168.xx.xx:62083)  SMB3_11           -                    partial(AES-128-CMAC)

Service      pid     Machine       Connected at                     Encryption   Signing     
---------------------------------------------------------------------------------------------
mydata       11114   192.168.xx.xx 월  3월 21 18시 48분 52초 2022 KST -            -           

Locked files:
Pid          User(ID)   DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
11114        1033       DENY_NONE  0x100081    RDONLY     NONE             /data1/mydata/sharedisk   .   Mon Mar 21 18:50:33 2022
11114        1033       DENY_NONE  0x100081    RDONLY     NONE             /data1/mydata/sharedisk   .   Mon Mar 21 18:50:33 2022
11114        1033       DENY_NONE  0x100081    RDONLY     NONE             /data1/mydata/sharedisk   .   Mon Mar 21 18:50:33 2022

 

윈도우 Samba 접속 

Window + R 키 입력후 삼바 서버 접속 

 

윈도우 삼바 접속

728x90
반응형
728x90
반응형

리눅스에서 OpenJdk 설치하는 방법에 대해 소개 하고 설치된 버전을 손쉽게 변경하는 방법에대해 알아보겠습니다. 

java 설치 (JDK: Java Development Kit: javac)

jdk 설치 리스트 확인 

yum list java*jdk-devel

yum install java-1.8.0-openjdk-devel.x86_64

 

JRE 설치( Java Runtime Environment:java)

 

yum list java*jdk 

yum install java-1.8.0-openjdk.x86_64

 

java version 변경

  • alternatives --config [java/javac] 명령어 수행 후  변경하고자 하는 번호를 선택 하면 됩니다.

 

$ alternatives --config java

2 개의 프로그램이 'java'를 제공합니다.

  선택    명령
-----------------------------------------------
   1           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64/jre/bin/java)
*+ 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/bin/java)


 

javac 버전 변경

 alternatives --config javac

2 개의 프로그램이 'javac'를 제공합니다.

  선택    명령
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/bin/javac)
   2           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64/bin/javac)
728x90
반응형

'03.Program > 02.java' 카테고리의 다른 글

[Java] JDBC 프로그래밍  (0) 2022.04.20
[Java basic-Utility] 파일 비교  (0) 2022.03.27
[Java basic-Utility] 디렉토리 파일 리스트 조회  (0) 2022.03.26
728x90
반응형

docker-compose install

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

 

docker-compose 권한 부여

sudo chmod +x /usr/local/bin/docker-compose

 

docker-compose 버전 확인

docker-compose --version

 

실행 

 

docker compose V1 , V2

  • docker-compose 는 2023 년 7월 이후 더이상 업데이트 되지 않습니다. 

  • 지금까지 사용했던 compose 버전은 V1 이 였습니다. 
  • 앞으로 더이상 지원 하지 않는 버전이라고 하니 V1 삭제후 V2 로 재설치 하는 방법에 대해 알아봅니다. 
  • 다시말하면 docker-compose 은 v1 이고  docker compose(하이픈 - 없는것) 은 V2 버전으로 알고 있으면 되겠네요.

https://docs.docker.com/compose/migrate/#what-are-the-differences-between-compose-v1-and-compose-v2

 

Migrate to Compose V2

How to migrate from Compose V1 to V2

docs.docker.com

 

 

docker compose  V2 Install 

  • 설치된 v1 을 삭제 하고 v2 를 설치 합니다. 

docker-compose  v1 uninstall 

sudo yum remove docker-compose-plugin

 

docker-compose  v2 install 

sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

설치 버전 확인 

[root@centos7:/root]$ docker --version
Docker version 26.1.4, build 5650f9b
[root@centos7:/root]$ docker compose version
Docker Compose version v2.27.1
728x90
반응형
728x90
반응형

Ubuntu Repository update

sudo apt-get update

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
    
    
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg    

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Docker Engine 설치

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
#  sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  docker-ce-rootless-extras docker-scan-plugin git git-man liberror-perl pigz slirp4netns
Suggested packages:
  aufs-tools cgroupfs-mount | cgroup-lite git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin git git-man liberror-perl pigz slirp4netns
0 upgraded, 10 newly installed, 0 to remove and 23 not upgraded.
Need to get 104 MB of archives.
After this operation, 448 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://download.docker.com/linux/ubuntu focal/stable amd64 containerd.io amd64 1.5.10-1 [24.9 MB]
..... 중략
Setting up git (1:2.25.1-1ubuntu3.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...

Docker Version 선택 설치 

도커는 버전별로 선택해서 설치를 진행 할수 있습니다. 

설치 가능 버전 확인후 선택해서 설치를 진행하면 됩니다. 

설치 버전 확인 

apt-cache madison docker-ce
 docker-ce | 5:20.10.13~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.12~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.11~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.10~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.9~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.8~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.7~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.6~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.5~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.4~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.3~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.2~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.1~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:20.10.0~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.15~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.14~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.13~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.12~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.11~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.10~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
 docker-ce | 5:19.03.9~3-0~ubuntu-focal | https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

Docker 버전 선택 설치 

#sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
sudo apt-get install docker-ce=5:19.03.15~3-0~ubuntu-focal docker-ce-cli=5:19.03.15~3-0~ubuntu-focal containerd.io

Docker 중지/시작 명령어 

#도커 재시작 
service docker restart

#도커 중지 
service docker stop


#도커 시작 
service docker start

Docker 상태 확인

docker ps -a
728x90
반응형
728x90
반응형

우분투 서버에 다른 PC에서 SSH로 접속하는 방법에 대해 알아보겠습니다. 

제가 설치한 우분투 버전은 Ubuntu 20.04.4 LTS 입니다. 

지금부터 설치와 접속 방법에 대해 소개하겠습니다. 

 

Open ssh Server Install 

sudo apt update

sudo apt install openssh-server

 

min@min-server:~/바탕화면$ su - root
암호: 
root@min-server:~# apt update
기존:1 https://dl.google.com/linux/chrome/deb stable InRelease
받기:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                  
기존:3 http://kr.archive.ubuntu.com/ubuntu focal InRelease                                            
받기:4 http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                           
받기:5 http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
받기:6 http://kr.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [616 kB]
받기:7 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,642 kB]
받기:8 http://kr.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [23.8 kB]
받기:9 http://kr.archive.ubuntu.com/ubuntu focal-updates/multiverse i386 Packages [8,460 B]
내려받기 2,627 k바이트, 소요시간 3초 (800 k바이트/초)           
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
패키지 23이(가) 업그레이드되었습니다. 'apt list --upgradable'를 실행하여 확인해 보십시오.
root@min-server:~# sudo apt install openssh-server
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다       
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  ncurses-term openssh-sftp-server ssh-import-id
제안하는 패키지:
  molly-guard monkeysphere ssh-askpass
다음 새 패키지를 설치할 것입니다:
  ncurses-term openssh-server openssh-sftp-server ssh-import-id
0개 업그레이드, 4개 새로 설치, 0개 제거 및 23개 업그레이드 안 함.
688 k바이트 아카이브를 받아야 합니다.
이 작업 후 6,010 k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu focal/main amd64 ncurses-term all 6.2-0ubuntu2 [249 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 openssh-sftp-server amd64 1:8.2p1-4ubuntu0.4 [51.5 kB]
받기:3 http://kr.archive.ubuntu.com/ubuntu focal-updates/main amd64 openssh-server amd64 1:8.2p1-4ubuntu0.4 [377 kB]
받기:4 http://kr.archive.ubuntu.com/ubuntu focal/main amd64 ssh-import-id all 5.10-0ubuntu1 [10.0 kB]
내려받기 688 k바이트, 소요시간 2초 (284 k바이트/초)
패키지를 미리 설정하는 중입니다...
Selecting previously unselected package ncurses-term.
(데이터베이스 읽는중 ...현재 194432개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../ncurses-term_6.2-0ubuntu2_all.deb ...
Unpacking ncurses-term (6.2-0ubuntu2) ...
Selecting previously unselected package openssh-sftp-server.
Preparing to unpack .../openssh-sftp-server_1%3a8.2p1-4ubuntu0.4_amd64.deb ...
Unpacking openssh-sftp-server (1:8.2p1-4ubuntu0.4) ...
Selecting previously unselected package openssh-server.
Preparing to unpack .../openssh-server_1%3a8.2p1-4ubuntu0.4_amd64.deb ...
Unpacking openssh-server (1:8.2p1-4ubuntu0.4) ...
Selecting previously unselected package ssh-import-id.
Preparing to unpack .../ssh-import-id_5.10-0ubuntu1_all.deb ...
Unpacking ssh-import-id (5.10-0ubuntu1) ...
openssh-sftp-server (1:8.2p1-4ubuntu0.4) 설정하는 중입니다 ...
openssh-server (1:8.2p1-4ubuntu0.4) 설정하는 중입니다 ...
Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
3072 SHA256:oN/4NemlZx06om65/xj6en+ZfJL1vnNLEUpS85tluh4 root@min-server (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:sIwnjEfSdu/Pqb0jQwVrigRwrJUtTizyGrqu3Fjgjqg root@min-server (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:LS1OyULLQ0ZywTGiap8KJOW2NzL61r0L4+C7+uWz888 root@min-server (ED25519)
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
rescue-ssh.target is a disabled or a static unit, not starting it.
ssh-import-id (5.10-0ubuntu1) 설정하는 중입니다 ...
Attempting to convert /etc/ssh/ssh_import_id
ncurses-term (6.2-0ubuntu2) 설정하는 중입니다 ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
내용 작성

 

SSH 실행 상태 확인 및  활성화 (sudo systemctl status ssh)

sudo systemctl status ssh

sudo systemctl enable ssh

sudo systemctl start ssh 

sudo systemctl restart ssh 

sudo systemctl stop ssh

 

$ sudo systemctl status ssh 
[sudo] min의 암호: 
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-03-19 11:26:10 KST; 22min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 4744 (sshd)
      Tasks: 1 (limit: 13936)
     Memory: 1.0M
     CGroup: /system.slice/ssh.service
             └─4744 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

 3월 19 11:26:10 min-server systemd[1]: Starting OpenBSD Secure Shell server...
 3월 19 11:26:10 min-server sshd[4744]: Server listening on 0.0.0.0 port 22.
 3월 19 11:26:10 min-server sshd[4744]: Server listening on :: port 22.
 3월 19 11:26:10 min-server systemd[1]: Started OpenBSD Secure Shell server.

SSH 서버가 중지 상태일때  모습니다. 

 

root@min-server:~# sudo systemctl stop ssh 
root@min-server:~# sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Sat 2022-03-19 11:53:01 KST; 3s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 6437 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
    Process: 6438 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=0/SUCCESS)
   Main PID: 6438 (code=exited, status=0/SUCCESS)

 3월 19 11:52:33 min-server systemd[1]: Starting OpenBSD Secure Shell server...
 3월 19 11:52:33 min-server sshd[6438]: Server listening on 0.0.0.0 port 22.
 3월 19 11:52:33 min-server sshd[6438]: Server listening on :: port 22.
 3월 19 11:52:33 min-server systemd[1]: Started OpenBSD Secure Shell server.
 3월 19 11:53:01 min-server systemd[1]: Stopping OpenBSD Secure Shell server...
 3월 19 11:53:01 min-server sshd[6438]: Received signal 15; terminating.
 3월 19 11:53:01 min-server systemd[1]: ssh.service: Succeeded.
 3월 19 11:53:01 min-server systemd[1]: Stopped OpenBSD Secure Shell server.

 

방화벽 상태 확인 및 비 활성화(Firewall)

sudo ufw allow ssh

sudo ufw status

 

root@min-server:~# sudo ufw allow ssh
규칙이 업데이트됐습니다
규칙이 업데이트됐습니다(v6)
root@min-server:~# sudo ufw status
상태: 비활성
root@min-server:~# 

 

SSH 클라이언트 접속 

접속해볼 클라이언트 테스트 계정을 생성해 보겠습니다. 

저는 앞으로 Docker 를 공부해 볼 계획이라 docker-test 계정을 생성하겠습니다. 

테스트 절차는 아래 내용으로 진행 하겠습니다. 

 

1. 테스트 계정 생성 

2. 우분투 서버 IP 정보 확인 

3.리눅스 테스트 계정 접속 

4. 리모트 서버(윈도우 노트북 -> 우분투 테스트 계정 접속)

 

테스트 계정 생성 

# adduser docker-test
'docker-test' 사용자를 추가 중...
새 그룹 'docker-test' (1001) 추가 ...
새 사용자 'docker-test' (1001) 을(를) 그룹 'docker-test' (으)로 추가 ...
'/home/docker-test' 홈 디렉터리를 생성하는 중...
'/etc/skel'에서 파일들을 복사하는 중...
새  암호: 
새  암호 재입력: 
passwd: 암호를 성공적으로 업데이트했습니다
docker-test의 사용자의 정보를 바꿉니다
새로운 값을 넣거나, 기본값을 원하시면 엔터를 치세요
이름 []: 
방 번호 []: 
직장 전화번호 []: 
집 전화번호 []: 
기타 []: 
정보가 올바릅니까? [Y/n] 

 

우분투 서버 IP 정보 확인 

# ifconfig
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 180.64.82.103  netmask 255.255.255.192  broadcast 180.64.82.127
        inet6 fe80::8129:3259:2d4c:d494  prefixlen 64  scopeid 0x20<link>
        ether bc:5f:f4:38:74:e5  txqueuelen 1000  (Ethernet)
        RX packets 27950  bytes 27074047 (27.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17481  bytes 3314029 (3.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 868  bytes 84762 (84.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 868  bytes 84762 (84.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

리눅스 테스트 계정 접속 

# ssh docker-test@180.64.82.103
The authenticity of host '180.64.82.103 (180.64.82.103)' can't be established.
ECDSA key fingerprint is SHA256:sIwnjEfSdu/Pqb0jQwVrigRwrJUtTizyGrqu3Fjgjqg.
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added '180.64.82.103' (ECDSA) to the list of known hosts.
docker-test@180.64.82.103's password: 
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.13.0-35-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

22 updates can be applied immediately.
추가 업데이트를 확인하려면 apt list --upgradable 을 실행하세요.

Your Hardware Enablement Stack (HWE) is supported until April 2025.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

 

리모트 서버(윈도우 노트북 -> 우분투 테스트 계정 접속)

윈도우 노트북 SecureCRT 에서 우분투 접속을 하려고 하니 아래와 같은 에러가 발생합니다. 

Key exchange failed.
No compatible key exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256

/etc/ssh/sshd_config 를 수정 해서 문제를 해결하겠습니다. 

 

vi /etc/ssh/sshd_config

KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc

systemctl restart sshd

위 작업을 수행하니 이제 정상 접속이 되고 있네요 

 

728x90
반응형
728x90
반응형

우분투 버전 확인 기본 명령어 

lsb_release -a 명령어를 사용하면 현재 설치된 우분투 버전 정보가 확인 가능 합니다. 

 

 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal

현재 데스크탑에 설치된 우분투 버전은 Ubuntu 20.04.4 LTS 입니다.

 

기타 명령어 

cat /etc/issue

cat /etc/os-release

hostnamectl

 

 

min@min-server:~/바탕화면$ cat /etc/issue
Ubuntu 20.04.4 LTS \n \l


min@min-server:~/바탕화면$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

min@min-server:~/바탕화면$ hostnamectl
   Static hostname: min-server
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: e10702539e504a0fa045f0529579781f
           Boot ID: 85fa0694820a45b9af1cfe85be3ae16f
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-35-generic
      Architecture: x86-64

728x90
반응형

+ Recent posts