서버 운영 관리

차동훈 에반젤리스트

CloudV 환경에 Docker 설치 (가상서버, 리얼서버)

1. docker 설치 환경

1-1 docker 설치 환경

설치는 간단하게 진행되나 일부 오래된 리눅스 배포판은 업데이트 등의 지원을 받지 못할 수 있습니다.

(ex. CentOS 6, 우분투 15)

64bit에 최적화되어 있어 32bit 버전에서 docker를 실행하는 방법이 없는 것은 아니지만 권장하지는 않습니다.

CentOS의 경우 CentOS 7 버전에서 설치할 것을 권장하고 있으며 CentOS 7의 커널이 최소 3.10버전 이여야 합니다.

CentOS 6에서 도커를 설치 할 경우 커널이 2.6.32-431이상이 필요하며, CentOS 6 버전은 커널때문에 docker 1.7버전까지만 설치가 가능합니다.

 

CentOS7 커널 확인

[root@localhost ~]# uname -r

3.10.0-123.el7.x86_64

 

CentOS6 커널 확인

[root@kinemadics ~]# uname -r

2.6.32-504.el6.x86_64

 

 

2. 가상서버 환경에 대한 설치

2-1 가상서버 스팩

 

 

 

 

 

 

 

 

 

 

 

 

 

=> LINUX MAX 64 SINGLE 1CORE 상품에 CentOS6 버전에서 설치 진행하였습니다.

 

[root@kinemadics ~]# ifconfig

eth0 Link encap:Ethernet HWaddr DE:AD:BE:E4:18:DF

inet addr:115.68.24.223 Bcast:115.68.24.255 Mask:255.255.255.0

inet6 addr: fe80::dcad:beff:fee4:18df/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:560470 errors:0 dropped:0 overruns:0 frame:0

TX packets:92161 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:603078754 (575.1 MiB) TX bytes:13838479 (13.1 MiB)

 

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

 

 

2-2 가상서버에 docker 설치

 

저장소 설정

[root@kinemadics ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm()를 복구합니다

경고: /var/tmp/rpm-tmp.6LrWef: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY

준비 중... ########################################### [100%]

1:epel-release ########################################### [100%]

 

[root@kinemadics ~]# yum update -y

Loaded plugins: fastestmirror, security

Setting up Update Process

Replaced:

openswan.x86_64 0:2.6.32-37.el6

 

Complete!

 

[root@kinemadics ~]# cat /etc/redhat-release

CentOS release 6.9 (Final)

 

Yum으로 docker 설치

[root@kinemadics ~]# yum install -y docker-io

Loaded plugins: fastestmirror, security

Setting up Install Process

Loading mirror speeds from cached hostfile

* base: centos.mirror.moack.net

* epel: mirror.premi.st

* extras: centos.mirror.moack.net

* updates: centos.mirror.moack.net

 

Installed:

docker-io.x86_64 0:1.7.1-2.el6

 

Dependency Installed:

lua-alt-getopt.noarch 0:0.7.0-1.el6 lua-filesystem.x86_64 0:1.4.2-1.el6 lua-lxc.x86_64 0:1.0.11-1.el6 lxc.x86_64 0:1.0.11-1.el6 lxc-libs.x86_64 0:1.0.11-1.el6

 

Complete!

 

서비스 등록

[root@kinemadics ~]# chkconfig docker on

 

Docker 실행

[root@kinemadics ~]# service docker start

Starting cgconfig service: [ OK ]

Starting docker: [ OK ]

 

Docker 설치가 정상적으로 되었는지 테스트

이미지 검색

 

[root@kinemadics ~]# docker search centos

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

centos The official build of CentOS. 4390 [OK]

ansible/centos7-ansible Ansible on Centos7 112 [OK]

jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x8... 96 [OK]

consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 55 [OK]

tutum/centos Simple CentOS docker image with SSH access 42

imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 41 [OK]

gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glu... 30 [OK]

centos/mysql-57-centos7 MySQL 5.7 SQL database server 28

openshift/base-centos7 A Centos7 derived base image for Source-To... 26

centos/python-35-centos7 Platform for building and running Python 3... 23

kinogmt/centos-ssh CentOS with SSH 20 [OK]

centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relationa... 19

centos/httpd-24-centos7 Platform for running Apache httpd 2.4 or b... 13

openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use... 13

openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 ima... 6

openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x i... 4

pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag nam... 4

darksheer/centos Base Centos Image -- Updated hourly 3 [OK]

openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for us... 3

pivotaldata/centos Base centos, freshened up a little with a ... 2

pivotaldata/centos-mingw Using the mingw toolchain to cross-compile... 1

blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]

jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK]

pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated ... 0

smartentry/centos centos with smartentry 0 [OK]

 

이미지 받아오기

 

[root@kinemadics ~]# docker pull centos:latest

latest: Pulling from centos

29466d114cd8: Pull complete

b298d692482d: Pull complete

88ec626ba223: Pull complete

Digest: sha256:3b37e941676e3a1f3752e9cdb1d37d1db37c9931fcbdd60339ea5f2134c85c0f

Status: Downloaded newer image for centos:latest

 

이미지 확인

 

[root@kinemadics ~]# docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

centos latest 88ec626ba223 11 days ago 199.7 MB

 

 

2-3 최신 OS버전에 최신 docker 설치

=> CentOS7 설치 후 yum update 진행하였습니다.

[root@localhost ~]# cat /etc/redhat-release

CentOS Linux release 7.5.1804 (Core)

 

저장소 설정

=> docker 공식 홈페이지의 방법으로 진행하였습니다.

 

Docker 저장소 추가 전 패키지 설치

[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2

 

Installed:

device-mapper-persistent-data.x86_64 0:0.7.3-3.el7 lvm2.x86_64 7:2.02.177-4.el7 yum-utils.noarch 0:1.1.31-45.el7

 

Dependency Installed:

device-mapper-event.x86_64 7:1.02.146-4.el7 device-mapper-event-libs.x86_64 7:1.02.146-4.el7 libxml2-python.x86_64 0:2.9.1-6.el7_2.3 lvm2-libs.x86_64 7:2.02.177-4.el7 python-chardet.noarch 0:2.2.1-1.el7_1

python-kitchen.noarch 0:1.1.1-5.el7

 

Complete!

 

 

Docker 저장소 추가

[root@localhost ~]# yum-config-manager –add-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

 

 

저장소의 docker 버전 확인

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

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

docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable

docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable

Loading mirror speeds from cached hostfile

Loaded plugins: fastestmirror

Available Packages

 

 

저장소 docker의 최신버전 설치

[root@localhost ~]# yum install docker-ce-18.03.1.ce-1.el7.centos

 

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

Resolving Dependencies

 

Installed:

docker-ce.x86_64 0:18.03.1.ce-1.el7.centos

 

Dependency Installed:

container-selinux.noarch 2:2.55-1.el7 pigz.x86_64 0:2.3.3-1.el7.centos

 

Complete!

 

 

Docker 설치확인

=> 18.03버전으로 설치가 완료된 것을 확인 할 수 있습니다.

[root@localhost ~]# systemctl start docker.service

[root@localhost ~]# docker version

Client:

Version: 18.03.1-ce

API version: 1.37

Go version: go1.9.5

Git commit: 9ee9f40

Built: Thu Apr 26 07:20:16 2018

OS/Arch: linux/amd64

Experimental: false

Orchestrator: swarm

 

Server:

Engine:

Version: 18.03.1-ce

API version: 1.37 (minimum version 1.12)

Go version: go1.9.5

Git commit: 9ee9f40

Built: Thu Apr 26 07:23:58 2018

OS/Arch: linux/amd64

Experimental: false

 

 

3. 리얼서버 환경에 대한 설치

 

=> 설치 방법은 위 가상서버와 동일합니다.

리얼서버 환경에 대한 설치는 대체서버에 CentOS6 설치하여 진행하였습니다.

리얼서버와 가상서버 모두 설치방법은 같기 때문에 CentOS6 버전에서만 설치하였습니다.

 

3-1 리얼서버에 docker 설치

[root@localhost ~]# ifconfig

eth0 Link encap:Ethernet HWaddr E8:40:F2:01:2A:22

inet addr:192.168.9.149 Bcast:192.168.9.159 Mask:255.255.255.224

inet6 addr: fe80::ea40:f2ff:fe01:2a22/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:408204 errors:0 dropped:0 overruns:0 frame:0

TX packets:197899 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:590914833 (563.5 MiB) TX bytes:21095791 (20.1 MiB)

Interrupt:20 Memory:fe500000-fe520000

 

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:17 errors:0 dropped:0 overruns:0 frame:0

TX packets:17 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:1580 (1.5 KiB) TX bytes:1580 (1.5 KiB)

 

 

저장소 설정

[root@localhost ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm()를 복구합니다

경고: /var/tmp/rpm-tmp.gj6OC5: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY

준비 중... ########################################### [100%]

1:epel-release ########################################### [100%]

 

[root@localhost ~]# yum update -y

Replaced:

compat-openmpi.x86_64 0:1.4.3-1.1.el6 compat-openmpi-psm.x86_64 0:1.4.3-1.1.el6 libipa_hbac-python.x86_64 0:1.9.2-129.el6 libsss_autofs.x86_64 0:1.9.2-129.el6 pytalloc.x86_64 0:2.0.7-2.el6

 

Complete!

 

yum으로 docker 설치

[root@localhost ~]# yum install -y docker-io

Loaded plugins: fastestmirror, security

Setting up Install Process

Determining fastest mirrors

 

Installed:

docker-io.x86_64 0:1.7.1-2.el6

 

Dependency Installed:

lua-alt-getopt.noarch 0:0.7.0-1.el6 lua-filesystem.x86_64 0:1.4.2-1.el6 lua-lxc.x86_64 0:1.0.11-1.el6 lxc.x86_64 0:1.0.11-1.el6 lxc-libs.x86_64 0:1.0.11-1.el6

 

Complete!

 

서비스 등록

[root@localhost ~]# chkconfig docker on

 

Docker 실행

[root@localhost ~]# service docker start

Starting cgconfig service: [ OK ]

Starting docker: [ OK ]

 

Docker 설치가 정상적으로 되었는지 테스트

이미지 검색

 

[root@localhost ~]# docker search centos

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

centos The official build of CentOS. 4390 [OK]

ansible/centos7-ansible Ansible on Centos7 112 [OK]

jdeathe/centos-ssh CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x8... 96 [OK]

consol/centos-xfce-vnc Centos container with "headless" VNC sessi... 55 [OK]

tutum/centos Simple CentOS docker image with SSH access 42

imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 41 [OK]

gluster/gluster-centos Official GlusterFS Image [ CentOS-7 + Glu... 30 [OK]

centos/mysql-57-centos7 MySQL 5.7 SQL database server 28

openshift/base-centos7 A Centos7 derived base image for Source-To... 26

centos/python-35-centos7 Platform for building and running Python 3... 23

kinogmt/centos-ssh CentOS with SSH 20 [OK]

centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relationa... 19

openshift/jenkins-2-centos7 A Centos7 based Jenkins v2.x image for use... 13

openshift/mysql-55-centos7 DEPRECATED: A Centos7 based MySQL v5.5 ima... 6

openshift/jenkins-1-centos7 DEPRECATED: A Centos7 based Jenkins v1.x i... 4

pivotaldata/centos-gpdb-dev CentOS image for GPDB development. Tag nam... 4

darksheer/centos Base Centos Image -- Updated hourly 3 [OK]

openshift/wildfly-101-centos7 A Centos7 based WildFly v10.1 image for us... 3

pivotaldata/centos Base centos, freshened up a little with a ... 2

openshift/wildfly-100-centos7 A Centos7 based WildFly v10.0 image for us... 1

pivotaldata/centos-mingw Using the mingw toolchain to cross-compile... 1

blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK]

jameseckersall/sonarr-centos Sonarr on CentOS 7 0 [OK]

smartentry/centos centos with smartentry 0 [OK]

pivotaldata/centos-gcc-toolchain CentOS with a toolchain, but unaffiliated ... 0

 

이미지 받아오기

 

[root@localhost ~]# docker pull centos:latest

latest: Pulling from centos

29466d114cd8: Pull complete

b298d692482d: Pull complete

88ec626ba223: Pull complete

Digest: sha256:3b37e941676e3a1f3752e9cdb1d37d1db37c9931fcbdd60339ea5f2134c85c0f

Status: Downloaded newer image for centos:latest

 

이미지 검색

 

[root@localhost ~]# docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

centos latest 88ec626ba223 11 days ago 199.7 MB

 

이상으로 메뉴얼 작성을 마치도록 하겠습니다.

감사합니다.