jenkins install

install을 위해서 jenkins repository를 추가한다.

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

rpm에 키 등록 후 jekins 인스톨

sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

sudo yum install jenkins

[root@localhost devops]# sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
--2019-06-24 16:07:47-- http://pkg.jenkins-ci.org/redhat/jenkins.repo
Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185
Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71
Saving to: ‘/etc/yum.repos.d/jenkins.repo’

100%[=====================================================================================================================================================================================================================================>] 71 --.-K/s in 0s

2019-06-24 16:07:48 (9.43 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [71/71]

[root@localhost devops]# sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
[root@localhost devops]# sudo yum install jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
jenkins | 2.9 kB 00:00:00
jenkins/primary_db | 129 kB 00:00:01
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.182-1.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
jenkins noarch 2.182-1.1 jenkins 74 M

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

Total download size: 74 M
Installed size: 74 M
Is this ok [y/d/N]: y
Downloading packages:
jenkins-2.182-1.1.noarch.rpm | 74 MB 00:05:37
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : jenkins-2.182-1.1.noarch 1/1
Verifying : jenkins-2.182-1.1.noarch 1/1

Installed:
jenkins.noarch 0:2.182-1.1

Complete!

web port & firewall

jenkins의 서비스 port를 설정 하고 열어준다.

[root@localhost devops]# cd /etc/sysconfig/
[root@localhost sysconfig]# vi jenkins
## Type:        integer(0:65535)
## Default: 8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="9090"
[root@localhost sysconfig]# sudo firewall-cmd --permanent --zone=public --add-port=9090/tcp
success
[root@localhost sysconfig]# sudo firewall-cmd --reload
success
[root@localhost sysconfig]# service jenkins start

service jenkins start 명령어로 jenkins를 실행한다.

http://url:port

를 브라우저에 넣으면 jenkins 화면이 뜨면 정상적으로 서비스가 실행 된 것이다.

Check Jenkins init key

jenkins 최초 실행키는

/var/lib/jenkins/secrets/에 위치 한다.

[root@localhost sysconfig]# cd /var/lib/jenkins/secrets/
[root@localhost secrets]# ls
filepath-filters.d initialAdminPassword jenkins.model.Jenkins.crumbSalt master.key org.jenkinsci.main.modules.instance_identity.InstanceIdentity.KEY slave-to-master-security-kill-switch whitelisted-callables.d
[root@localhost secrets]# vi initialAdminPassword

jenkins 실행 중 이상이 발생 한다면 다음 로그를 확인 해서 대응 해 줘야 한다.

/var/log/jenkins/

[root@localhost devops]# cd /var/log/jenkins/
[root@localhost jenkins]# ls
jenkins.log

jdk 설치

[root@localhost secrets]# yum list java*jdk-devel
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
Available Packages
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.8.0-openjdk-devel.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-11-openjdk-devel.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-devel.x86_64 1:11.0.3.7-0.el7_6 updates
[root@localhost secrets]# yum install java-1.8.0-openjdk-devel.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
java-1.8.0-openjdk-devel x86_64 1:1.8.0.212.b04-0.el7_6 updates 9.8 M

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

Total download size: 9.8 M
Installed size: 40 M
Is this ok [y/d/N]: y
Downloading packages:
java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64.rpm | 9.8 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64 1/1
Verifying : 1:java-1.8.0-openjdk-devel-1.8.0.212.b04-0.el7_6.x86_64 1/1

Installed:
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6

Complete!

[root@localhost secrets]# javac -version
javac 1.8.0_212

git install

[root@localhost secrets]# git
bash: git: 명령을 찾을 수 없습니다...
[root@localhost secrets]# yum install git
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-20.el7 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-20.el7 for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-20.el7.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-20.el7.x86_64
--> Running transaction check
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
git x86_64 1.8.3.1-20.el7 updates 4.4 M
Installing for dependencies:
perl-Error noarch 1:0.17020-2.el7 base 32 k
perl-Git noarch 1.8.3.1-20.el7 updates 55 k
perl-TermReadKey x86_64 2.30-20.el7 base 31 k

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install 1 Package (+3 Dependent packages)

Total download size: 4.5 M
Installed size: 22 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): perl-Error-0.17020-2.el7.noarch.rpm | 32 kB 00:00:00
(2/4): perl-Git-1.8.3.1-20.el7.noarch.rpm | 55 kB 00:00:00
(3/4): perl-TermReadKey-2.30-20.el7.x86_64.rpm | 31 kB 00:00:00
(4/4): git-1.8.3.1-20.el7.x86_64.rpm | 4.4 MB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 7.7 MB/s | 4.5 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-Error-0.17020-2.el7.noarch 1/4
Installing : perl-TermReadKey-2.30-20.el7.x86_64 2/4
Installing : git-1.8.3.1-20.el7.x86_64 3/4
Installing : perl-Git-1.8.3.1-20.el7.noarch 4/4
Verifying : perl-Git-1.8.3.1-20.el7.noarch 1/4
Verifying : 1:perl-Error-0.17020-2.el7.noarch 2/4
Verifying : git-1.8.3.1-20.el7.x86_64 3/4
Verifying : perl-TermReadKey-2.30-20.el7.x86_64 4/4

Installed:
git.x86_64 0:1.8.3.1-20.el7

Dependency Installed:
perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-20.el7 perl-TermReadKey.x86_64 0:2.30-20.el7

Complete!

최초 파이프라인 테스트

새로운 아이템 > Enter an item name "아무거나"> pipeline 선택 > ok

"아무거나" 파이프라인 설정 페이지 > pipeline tab 클릭

definition : pipeline script > github + maven > 저장

처음화면으로 이동

아무거나 파이프라인 > name > 아래화살표 > build now

파이프라인 스크립트 기초

node {
def mvnHome
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'M3'
}
stage('Build') {
// Run the maven build
withEnv(["MVN_HOME=$mvnHome"]) {
if (isUnix()) {
sh '"$MVN_HOME/bin/mvn" -Dmaven.test.failure.ignore clean package'
} else {
bat(/"%MVN_HOME%\bin\mvn" -Dmaven.test.failure.ignore clean package/)
}
}
}
stage('Results') {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts 'target/*.jar'
}
}
서술적 파이프 라인

Node 블록 + 스테이지 블록 + 디렉티브 스탭 = 서술적 파이프라인

node 블록 (필수)

node (<parameter>){<constituents>}

노드 블록(젠킨스 에이전트) = 스테이지 블록 + 디렉티브 + 스탭

node {
스테이지 블록 (필수)

stage (<parameter>){<constituents>}

스테이지 블록 = 스텝 + 디렉티브

stage('Preparation') { // for display purposes

}
stage('Build') {
// Run the maven build

}
stage('Results') {

}
디렉티브 (옵션)
def mvnHome

mvnHome = tool 'M3'

환경변수, 옵션, 파라미터, 트리거 등을 표현

github 연결하기

Credentials 설정

Jenkins 대쉬보드(최상위 화면)

Credentials > System > Global credentials > Add Credentials

  • Kind : Username with password

  • Scope : Global

  • Username : github id, name 또는 email
  • password : github password
  • ID : id
  • Description : 아무거나
Credentials 연결

Jenkins 대쉬보드(최상위 화면)

Jenkins관리 > 시스템설정

GitHub 영역으로 이동

  • Name : 아무거나
  • API URL : https://api.github.com
  • Manage hooks : 선택

2번째 고급 클릭

  • Additional actions : Convert login and password to token 선택
  • From credentionas > Credentilas > 상위 만든 Credentials 선택
  • Create token credentials 클릭

정상적으로 토큰이 생성 되었다면 "저장" 후 종료

  • github 사이트 > 우상단 내 아이콘 클릭 > Setting 클릭
  • Developer setting 클릭
  • Personal access tokens 선택

github 사이트에 기 등록된 token이 양쪽다 등록 되었다면 정상 처리 완료 된 것임

내 github repository 연동

연동할 내 github repository 로 이동

Create new file 생성 > Jenkinsfile (대소문자 완전히 같아야 함)

node ('master'){
checkout scm
stage('Build'){
withMaven(maven: 'M3'){
if(isUnix()){
sh 'mvn -Dmaven.test.failure.ignore clean package'
}
else {
bat 'mvn -Dmaven.test.failure.ignore clean package'
}

}
}
stage('Results'){
junit '**/target/surefire-reports/TEST-*.xml'
archive 'target/*.jar'
}

}

상위 reposibory는 "https://github.com/jglick/simple-maven-project-with-tests"를 Clone한 것임

master branch에 상위와 같이 Jenkinsfile 생성

Multi Branch

대쉬보드 > 새로운 Item > Multibranch Pipeline > Branch Sources

  • Credentials : 상위 Credentials 선택
  • Owner : id or name 작성 (이걸 해야 Repository 리스트 나옮)
  • Repository 선택
  • 저장
webhook 연결

webhook을 연결해야 github에서 수정사항이 있을 때 push를 수신 할 수 있다.

Jenkins관리 > 시스템설정 > Github > 2번째 고급 클릭 > Re-register hooks for all jobs 클릭

github 등록 확인

상위 등록한 github repository 이동(브라우저) > Settings 선택 > Webhooks 클릭

  • 우측에 내 jenkins와 연결된 내용이 보이면 됨

주의 해야할 점은 jenkins가 public ip 여야만 한다. private의 경우 github가 jenkins를 접근 할 수 없게된다.

new Branch 생성

github에서 master branch 화면에서 좌상단 Branch:master 버튼을 클릭하고, 아무 Branch 명이나 적게 되면 Create Branch가 가능하게 된다.

이때 Create Branch를 하게 되면 master와 똑같은 내용을 갖는 신규 Branch Repo가 만들어지는데 Webhook을 통해서 jenkins에 변화가 있음을 통지 해주게 된다.

Jenkins > multiBranch item화면 진입

하게 되면 앞서 만들었던 신규 브랜치가 빌드된 모습을 확인 할 수 있다.

Docker Remote api open

jenkins node를 docker 이용해서 처리 하기 위해서는 docker의 remote api가 open 되어 있어야 한다.

docker의 인스톨을 여기서 다루지 않는다.

systemctl status docker

를 입력했을 때 아래와 같이 나오면, 정상적으로 docker가 인스톨 되어 있다는 뜻이다.

[root@localhost system]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since 월 2019-06-24 13:17:30 KST; 2 days ago
Docs: http://docs.docker.com
Main PID: 25542 (dockerd-current)
Tasks: 52
Memory: 16.1M
CGroup: /system.slice/docker.service
├─19662 /usr/libexec/docker/docker-proxy-current -proto tcp -host-ip 0.0.0.0 -host-port 8081 -container-ip 172.17.0.2 -container-port 8081
├─19670 /usr/bin/docker-containerd-shim-current 67826ba9e0179b6009c9c7a177fe1815fd320cdac65ea91d479413f7c4e5e81a /var/run/docker/libcontainerd/67826ba9e0179b6009c9c7a177fe1815fd320cdac65ea91d479413f7c4e5e81a /usr/libexec/docker/docker-runc-current
├─25542 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/d...
└─25550 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runt...

6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: https://hub.docker.com/
6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:
6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: For more examples and ideas, visit:
6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: https://docs.docker.com/get-started/
6월 26 15:45:58 localhost.localdomain dockerd-current[25542]:
6월 26 15:45:58 localhost.localdomain dockerd-current[25542]: time="2019-06-26T15:45:58.670141563+09:00" level=warning msg="f4cca30a56eb3a20bbb7a9943103db28a15c3bd60ddc524adae438ea459c6b2c cleanup: failed to unmount secrets: invalid argument"
6월 26 15:50:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 06:50:00,005+0000 INFO [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...WAITING -> RUNNING
6월 26 15:50:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 06:50:00,010+0000 INFO [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...NG -> WAITING (OK)
6월 26 16:00:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 07:00:00,005+0000 INFO [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...WAITING -> RUNNING
6월 26 16:00:00 localhost.localdomain dockerd-current[25542]: 2019-06-26 07:00:00,010+0000 INFO [quartz-3-thread-20] *SYSTEM org.sonatype.nexus.quartz.internal.task.QuartzTaskInfo - Task 'Storage facet cleanup' [repository.storage-facet-cleanup] s...NG -> WAITING (OK)
Hint: Some lines were ellipsized, use -l to show in full.

이유는 알 수없지만 docker상에서 remote api를 open 하는 방법은 여러 가지가 있다.

실제로는 이중에 되는게 있으면 다행인데, 없다면... 다시 처음부터 docker를 install 해야한다.

docker.conf 파일 수정

vi /etc/.init/docker.conf

DOCKER_OPS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'

도커 서버를 유닉스 도커 엔진과 4243포트로 연결한다.

상위 내용 저는 실패

docker.service 파일 수정

위치가 다른 경우가 많은 것으로 보인다.

상위 status를 통해서 얻어오 데이타인

Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)

로 위치를 추측 하였다.

vi /lib/systemd/system/docker.service

인터넷이 말하는 path

vi /usr/lib/systemd/system/docker.service

내 path

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:4243

그러나 실제로 상위 파일을 수정 하려고 보면, 기존 내용을 지워야 할지 아니면 ExecStart를 하나더 추가 하라는 건지 모르겠다.

docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
Requires=docker-cleanup.timer

[Service]
Type=notify
NotifyAccess=main
EnvironmentFile=-/run/containers/registries.conf
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd-current \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
--init-path=/usr/libexec/docker/docker-init-current \
--seccomp-profile=/etc/docker/seccomp.json \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
$REGISTRIES
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
KillMode=process

[Install]
WantedBy=multi-user.target
docker 파일 수정

vi /etc/sysconfig/docker

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# instead. For more information reference the registries.conf(5) man page.

# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp

# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false

# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines
#DOCKERBINARY=/usr/bin/docker-latest
#DOCKERDBINARY=/usr/bin/dockerd-latest
#DOCKER_CONTAINERD_BINARY=/usr/bin/docker-containerd-latest
#DOCKER_CONTAINERD_SHIM_BINARY=/usr/bin/docker-containerd-shim-latest

OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'

상위 파일의 마지막 OPTIONS를 기존 파일에 추가 하였다.

저는 상위 파일 수정으로 성공 하였습니다. 주의 해야하는 것은 tcp 이후 0.0.0.0 이 아니 127.0.0.1로 쓰게 되면 local 접근만 되고 대외 접근은 불가 합니다.

서비스 재 실행 및 TEST
  • demon 재실행 : systemctl daemon-reload

  • 서비스 재실행 : service docker restart

  • Test : curl -X GET http://localhost:4243/images/json
[root@localhost system]# systemctl daemon-reload
[root@localhost system]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost system]# curl -X GET http://localhost:4243/images/json
[{"Containers":-1,"Created":1561408399,"Id":"sha256:36b0df681a47e5948f2088a446652766132141175dece2d6d47ef6e749385c05","Labels":{"com.sonatype.license":"Apache License, Version 2.0","com.sonatype.name":"Nexus Repository Manager base image","org.label-schema.build-date":"20190305","org.label-schema.license":"GPLv2","org.label-schema.name":"CentOS Base Image","org.label-schema.schema-version":"1.0","org.label-schema.vendor":"CentOS","vendor":"Sonatype"},"ParentId":"","RepoDigests":["docker.io/sonatype/nexus3@sha256:970b09779992bf88d041d074428c54dc153f7b9c8cafe4ff364dd26d69200f7a"],"RepoTags":["docker.io/sonatype/nexus3:latest"],"SharedSize":-1,"Size":581556647,"VirtualSize":581556647},{"Containers":-1,"Created":1546306167,"Id":"sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e","Labels":null,"ParentId":"","RepoDigests":["docker.io/hello-world@sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8"],"RepoTags":["docker.io/hello-world:latest"],"SharedSize":-1,"Size":1840,"VirtualSize":1840}]
포트 open
[root@localhost system]# firewall-cmd --permanent --zone=public --add-port=4243/tcp
success
[root@localhost system]# firewall-cmd --reload

목적

git에서 web소스를 수신 후, tomcat 하단 webapp으로 디플로이 자동화

참고

tomcat installation

Jenkins 설정

maven

jenkins관리 > global tool configuration>maven >

  • name : m3
  • install automatically : check
  • version : 3.6
새로운 아이템

Freestyle project

  • 소스코드관리 : git repository url

https://github.com/ValaxyTech/hello-world

를 개인 GitHub repository에 fork해서 사용하는 것을 추천 함

Build

  • Maven version : M3

  • Goals : clean install package

빌드 후 조치

  • WAR/EAR files :

http://218.145.218.31:8080/webapp/

yum install

Dependency Install

virtual box에 관련된 라이브러리를 우선 install 한다.

yum -y install gcc dkms make qt libgomp patch

yum -y install kernel-headers kernel-devel binutils glibc-headers glibc-devel font-forge

[devops@localhost ~]$ su
암호:
[root@localhost devops]# yum -y install gcc dkms make qt libgomp patch
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 3.4 kB 00:00:00
maradb | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
(1/2): epel/x86_64/primary_db | 6.1 MB 00:00:05
(2/2): epel/x86_64/updateinfo | 782 kB 00:00:11
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: data.aonenetworks.kr
* updates: mirror.kakao.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package dkms.noarch 0:2.4.0-1.20170926git959bd74.el6 will be installed
--> Processing Dependency: elfutils-libelf-devel for package: dkms-2.4.0-1.20170926git959bd74.el6.noarch
--> Processing Dependency: kernel-devel-uname-r for package: dkms-2.4.0-1.20170926git959bd74.el6.noarch
---> Package gcc.x86_64 0:4.8.5-11.el7 will be updated
--> Processing Dependency: gcc = 4.8.5-11.el7 for package: gcc-c++-4.8.5-11.el7.x86_64
---> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be an update
--> Processing Dependency: cpp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libgcc >= 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
---> Package libgomp.x86_64 0:4.8.5-11.el7 will be updated
---> Package libgomp.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package make.x86_64 1:3.82-21.el7 will be updated
---> Package make.x86_64 1:3.82-23.el7 will be an update
---> Package patch.x86_64 0:2.7.1-10.el7_5 will be installed
---> Package qt.x86_64 1:4.8.7-2.el7 will be installed
--> Processing Dependency: qt-settings for package: 1:qt-4.8.7-2.el7.x86_64
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: 1:qt-4.8.7-2.el7.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.5-11.el7 will be updated
---> Package cpp.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package elfutils-libelf-devel.x86_64 0:0.172-2.el7 will be installed
--> Processing Dependency: elfutils-libelf(x86-64) = 0.172-2.el7 for package: elfutils-libelf-devel-0.172-2.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-11.el7 will be updated
---> Package gcc-c++.x86_64 0:4.8.5-36.el7_6.2 will be an update
--> Processing Dependency: libstdc++-devel = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-36.el7_6.2 for package: gcc-c++-4.8.5-36.el7_6.2.x86_64
---> Package kernel-debug-devel.x86_64 0:3.10.0-957.21.3.el7 will be installed
---> Package libgcc.x86_64 0:4.8.5-11.el7 will be updated
---> Package libgcc.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package openssl-libs.x86_64 1:1.0.1e-60.el7_3.1 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1 for package: 1:openssl-1.0.1e-60.el7_3.1.x86_64
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-60.el7_3.1 for package: 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64
---> Package openssl-libs.x86_64 1:1.0.2k-16.el7_6.1 will be an update
---> Package qt-settings.noarch 0:19-23.8.el7.centos will be installed
--> Running transaction check
---> Package elfutils-libelf.x86_64 0:0.160-1.el7 will be updated
--> Processing Dependency: elfutils-libelf(x86-64) = 0.160-1.el7 for package: elfutils-libs-0.160-1.el7.x86_64
--> Processing Dependency: elfutils-libelf(x86-64) = 0.160-1.el7 for package: elfutils-0.160-1.el7.x86_64
---> Package elfutils-libelf.x86_64 0:0.172-2.el7 will be an update
---> Package libstdc++.x86_64 0:4.8.5-11.el7 will be updated
---> Package libstdc++.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package libstdc++-devel.x86_64 0:4.8.5-11.el7 will be updated
---> Package libstdc++-devel.x86_64 0:4.8.5-36.el7_6.2 will be an update
---> Package openssl.x86_64 1:1.0.1e-60.el7_3.1 will be updated
---> Package openssl.x86_64 1:1.0.2k-16.el7_6.1 will be an update
---> Package openssl-devel.x86_64 1:1.0.1e-60.el7_3.1 will be updated
---> Package openssl-devel.x86_64 1:1.0.2k-16.el7_6.1 will be an update
--> Running transaction check
---> Package elfutils.x86_64 0:0.160-1.el7 will be updated
---> Package elfutils.x86_64 0:0.172-2.el7 will be an update
---> Package elfutils-libs.x86_64 0:0.160-1.el7 will be updated
---> Package elfutils-libs.x86_64 0:0.172-2.el7 will be an update
--> Processing Dependency: default-yama-scope for package: elfutils-libs-0.172-2.el7.x86_64
--> Running transaction check
---> Package elfutils-default-yama-scope.noarch 0:0.172-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
dkms noarch 2.4.0-1.20170926git959bd74.el6 epel 78 k
patch x86_64 2.7.1-10.el7_5 base 110 k
qt x86_64 1:4.8.7-2.el7 base 4.6 M
Updating:
gcc x86_64 4.8.5-36.el7_6.2 updates 16 M
libgomp x86_64 4.8.5-36.el7_6.2 updates 158 k
make x86_64 1:3.82-23.el7 base 420 k
Installing for dependencies:
elfutils-default-yama-scope noarch 0.172-2.el7 base 32 k
elfutils-libelf-devel x86_64 0.172-2.el7 base 39 k
kernel-debug-devel x86_64 3.10.0-957.21.3.el7 updates 17 M
qt-settings noarch 19-23.8.el7.centos base 17 k
Updating for dependencies:
cpp x86_64 4.8.5-36.el7_6.2 updates 5.9 M
elfutils x86_64 0.172-2.el7 base 299 k
elfutils-libelf x86_64 0.172-2.el7 base 194 k
elfutils-libs x86_64 0.172-2.el7 base 285 k
gcc-c++ x86_64 4.8.5-36.el7_6.2 updates 7.2 M
libgcc x86_64 4.8.5-36.el7_6.2 updates 102 k
libstdc++ x86_64 4.8.5-36.el7_6.2 updates 305 k
libstdc++-devel x86_64 4.8.5-36.el7_6.2 updates 1.5 M
openssl x86_64 1:1.0.2k-16.el7_6.1 updates 493 k
openssl-devel x86_64 1:1.0.2k-16.el7_6.1 updates 1.5 M
openssl-libs x86_64 1:1.0.2k-16.el7_6.1 updates 1.2 M

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install 3 Packages (+ 4 Dependent packages)
Upgrade 3 Packages (+11 Dependent packages)

Total size: 57 M
Total download size: 57 M
Downloading packages:
No Presto metadata available for base
(1/20): elfutils-default-yama-scope-0.172-2.el7.noarch.rpm | 32 kB 00:00:00
(2/20): elfutils-libelf-0.172-2.el7.x86_64.rpm | 194 kB 00:00:00
(3/20): elfutils-0.172-2.el7.x86_64.rpm | 299 kB 00:00:00
(4/20): elfutils-libelf-devel-0.172-2.el7.x86_64.rpm | 39 kB 00:00:00
(5/20): elfutils-libs-0.172-2.el7.x86_64.rpm | 285 kB 00:00:00
(6/20): cpp-4.8.5-36.el7_6.2.x86_64.rpm | 5.9 MB 00:00:00
warning: /var/cache/yum/x86_64/7/epel/packages/dkms-2.4.0-1.20170926git959bd74.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY ] 4.7 MB/s | 11 MB 00:00:09 ETA
Public key for dkms-2.4.0-1.20170926git959bd74.el6.noarch.rpm is not installed
(7/20): dkms-2.4.0-1.20170926git959bd74.el6.noarch.rpm | 78 kB 00:00:01
(8/20): gcc-c++-4.8.5-36.el7_6.2.x86_64.rpm | 7.2 MB 00:00:00
(9/20): kernel-debug-devel-3.10.0-957.21.3.el7.x86_64.rpm | 17 MB 00:00:02
(10/20): libgomp-4.8.5-36.el7_6.2.x86_64.rpm | 158 kB 00:00:00
(11/20): libstdc++-4.8.5-36.el7_6.2.x86_64.rpm | 305 kB 00:00:00
(12/20): gcc-4.8.5-36.el7_6.2.x86_64.rpm | 16 MB 00:00:04
(13/20): libstdc++-devel-4.8.5-36.el7_6.2.x86_64.rpm | 1.5 MB 00:00:00
(14/20): make-3.82-23.el7.x86_64.rpm | 420 kB 00:00:00
(15/20): openssl-1.0.2k-16.el7_6.1.x86_64.rpm | 493 kB 00:00:00
(16/20): openssl-devel-1.0.2k-16.el7_6.1.x86_64.rpm | 1.5 MB 00:00:00
(17/20): patch-2.7.1-10.el7_5.x86_64.rpm | 110 kB 00:00:00
(18/20): openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm | 1.2 MB 00:00:00
(19/20): qt-settings-19-23.8.el7.centos.noarch.rpm | 17 kB 00:00:00
(20/20): qt-4.8.7-2.el7.x86_64.rpm | 4.6 MB 00:00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 57 MB 00:00:05
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : "EPEL (6) <epel@fedoraproject.org>"
Fingerprint: 8c3b e96a f230 9184 da5c 0dae 3b49 df2a 0608 b895
Package : epel-release-6-8.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : libgcc-4.8.5-36.el7_6.2.x86_64 1/35
Updating : libstdc++-4.8.5-36.el7_6.2.x86_64 2/35
Updating : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64 3/35
Updating : elfutils-libelf-0.172-2.el7.x86_64 4/35
Installing : elfutils-libelf-devel-0.172-2.el7.x86_64 5/35
Updating : libstdc++-devel-4.8.5-36.el7_6.2.x86_64 6/35
Updating : cpp-4.8.5-36.el7_6.2.x86_64 7/35
Updating : 1:make-3.82-23.el7.x86_64 8/35
Installing : elfutils-default-yama-scope-0.172-2.el7.noarch 9/35
Updating : elfutils-libs-0.172-2.el7.x86_64 10/35
Updating : libgomp-4.8.5-36.el7_6.2.x86_64 11/35
Updating : gcc-4.8.5-36.el7_6.2.x86_64 12/35
Installing : qt-settings-19-23.8.el7.centos.noarch 13/35
Installing : kernel-debug-devel-3.10.0-957.21.3.el7.x86_64 14/35
Installing : dkms-2.4.0-1.20170926git959bd74.el6.noarch 15/35
Installing : 1:qt-4.8.7-2.el7.x86_64 16/35
Updating : gcc-c++-4.8.5-36.el7_6.2.x86_64 17/35
Updating : elfutils-0.172-2.el7.x86_64 18/35
Updating : 1:openssl-1.0.2k-16.el7_6.1.x86_64 19/35
Updating : 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64 20/35
Installing : patch-2.7.1-10.el7_5.x86_64 21/35
Cleanup : 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64 22/35
Cleanup : elfutils-0.160-1.el7.x86_64 23/35
Cleanup : gcc-c++-4.8.5-11.el7.x86_64 24/35
Cleanup : gcc-4.8.5-11.el7.x86_64 25/35
Cleanup : 1:openssl-1.0.1e-60.el7_3.1.x86_64 26/35
Cleanup : elfutils-libs-0.160-1.el7.x86_64 27/35
Cleanup : libstdc++-devel-4.8.5-11.el7.x86_64 28/35
Cleanup : libstdc++-4.8.5-11.el7.x86_64 29/35
Cleanup : libgcc-4.8.5-11.el7.x86_64 30/35
Cleanup : elfutils-libelf-0.160-1.el7.x86_64 31/35
Cleanup : 1:openssl-libs-1.0.1e-60.el7_3.1.x86_64 32/35
Cleanup : 1:make-3.82-21.el7.x86_64 33/35
Cleanup : cpp-4.8.5-11.el7.x86_64 34/35
Cleanup : libgomp-4.8.5-11.el7.x86_64 35/35
Verifying : elfutils-libelf-devel-0.172-2.el7.x86_64 1/35
Verifying : kernel-debug-devel-3.10.0-957.21.3.el7.x86_64 2/35
Verifying : 1:qt-4.8.7-2.el7.x86_64 3/35
Verifying : qt-settings-19-23.8.el7.centos.noarch 4/35
Verifying : patch-2.7.1-10.el7_5.x86_64 5/35
Verifying : gcc-4.8.5-36.el7_6.2.x86_64 6/35
Verifying : libstdc++-4.8.5-36.el7_6.2.x86_64 7/35
Verifying : 1:openssl-devel-1.0.2k-16.el7_6.1.x86_64 8/35
Verifying : libgcc-4.8.5-36.el7_6.2.x86_64 9/35
Verifying : libgomp-4.8.5-36.el7_6.2.x86_64 10/35
Verifying : dkms-2.4.0-1.20170926git959bd74.el6.noarch 11/35
Verifying : libstdc++-devel-4.8.5-36.el7_6.2.x86_64 12/35
Verifying : 1:openssl-1.0.2k-16.el7_6.1.x86_64 13/35
Verifying : elfutils-libelf-0.172-2.el7.x86_64 14/35
Verifying : elfutils-default-yama-scope-0.172-2.el7.noarch 15/35
Verifying : gcc-c++-4.8.5-36.el7_6.2.x86_64 16/35
Verifying : 1:make-3.82-23.el7.x86_64 17/35
Verifying : elfutils-libs-0.172-2.el7.x86_64 18/35
Verifying : cpp-4.8.5-36.el7_6.2.x86_64 19/35
Verifying : 1:openssl-libs-1.0.2k-16.el7_6.1.x86_64 20/35
Verifying : elfutils-0.172-2.el7.x86_64 21/35
Verifying : 1:openssl-1.0.1e-60.el7_3.1.x86_64 22/35
Verifying : gcc-c++-4.8.5-11.el7.x86_64 23/35
Verifying : elfutils-libs-0.160-1.el7.x86_64 24/35
Verifying : cpp-4.8.5-11.el7.x86_64 25/35
Verifying : 1:openssl-libs-1.0.1e-60.el7_3.1.x86_64 26/35
Verifying : elfutils-libelf-0.160-1.el7.x86_64 27/35
Verifying : 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64 28/35
Verifying : libgcc-4.8.5-11.el7.x86_64 29/35
Verifying : libstdc++-4.8.5-11.el7.x86_64 30/35
Verifying : 1:make-3.82-21.el7.x86_64 31/35
Verifying : elfutils-0.160-1.el7.x86_64 32/35
Verifying : libgomp-4.8.5-11.el7.x86_64 33/35
Verifying : gcc-4.8.5-11.el7.x86_64 34/35
Verifying : libstdc++-devel-4.8.5-11.el7.x86_64 35/35

Installed:
dkms.noarch 0:2.4.0-1.20170926git959bd74.el6 patch.x86_64 0:2.7.1-10.el7_5 qt.x86_64 1:4.8.7-2.el7

Dependency Installed:
elfutils-default-yama-scope.noarch 0:0.172-2.el7 elfutils-libelf-devel.x86_64 0:0.172-2.el7 kernel-debug-devel.x86_64 0:3.10.0-957.21.3.el7 qt-settings.noarch 0:19-23.8.el7.centos

Updated:
gcc.x86_64 0:4.8.5-36.el7_6.2 libgomp.x86_64 0:4.8.5-36.el7_6.2 make.x86_64 1:3.82-23.el7

Dependency Updated:
cpp.x86_64 0:4.8.5-36.el7_6.2 elfutils.x86_64 0:0.172-2.el7 elfutils-libelf.x86_64 0:0.172-2.el7 elfutils-libs.x86_64 0:0.172-2.el7 gcc-c++.x86_64 0:4.8.5-36.el7_6.2 libgcc.x86_64 0:4.8.5-36.el7_6.2 libstdc++.x86_64 0:4.8.5-36.el7_6.2
libstdc++-devel.x86_64 0:4.8.5-36.el7_6.2 openssl.x86_64 1:1.0.2k-16.el7_6.1 openssl-devel.x86_64 1:1.0.2k-16.el7_6.1 openssl-libs.x86_64 1:1.0.2k-16.el7_6.1

Complete!
[root@localhost devops]# yum -y install kernel-headers kernel-devel binutils glibc-headers glibc-devel font-forge
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: data.aonenetworks.kr
* updates: mirror.kakao.com
* webtatic: us-east.repo.webtatic.com
No package font-forge available.
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.23.52.0.1-30.el7 will be updated
---> Package binutils.x86_64 0:2.27-34.base.el7 will be an update
---> Package glibc-devel.x86_64 0:2.17-157.el7_3.1 will be updated
---> Package glibc-devel.x86_64 0:2.17-260.el7_6.5 will be an update
--> Processing Dependency: glibc = 2.17-260.el7_6.5 for package: glibc-devel-2.17-260.el7_6.5.x86_64
---> Package glibc-headers.x86_64 0:2.17-157.el7_3.1 will be updated
---> Package glibc-headers.x86_64 0:2.17-260.el7_6.5 will be an update
---> Package kernel-devel.x86_64 0:3.10.0-957.21.3.el7 will be installed
---> Package kernel-headers.x86_64 0:3.10.0-514.10.2.el7 will be updated
---> Package kernel-headers.x86_64 0:3.10.0-957.21.3.el7 will be an update
--> Running transaction check
---> Package glibc.x86_64 0:2.17-157.el7_3.1 will be updated
--> Processing Dependency: glibc = 2.17-157.el7_3.1 for package: glibc-common-2.17-157.el7_3.1.x86_64
---> Package glibc.x86_64 0:2.17-260.el7_6.5 will be an update
--> Running transaction check
---> Package glibc-common.x86_64 0:2.17-157.el7_3.1 will be updated
---> Package glibc-common.x86_64 0:2.17-260.el7_6.5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
kernel-devel x86_64 3.10.0-957.21.3.el7 updates 17 M
Updating:
binutils x86_64 2.27-34.base.el7 base 5.9 M
glibc-devel x86_64 2.17-260.el7_6.5 updates 1.1 M
glibc-headers x86_64 2.17-260.el7_6.5 updates 683 k
kernel-headers x86_64 3.10.0-957.21.3.el7 updates 8.0 M
Updating for dependencies:
glibc x86_64 2.17-260.el7_6.5 updates 3.7 M
glibc-common x86_64 2.17-260.el7_6.5 updates 12 M

Transaction Summary
===============================================================================================================================================================================================================================================================================
Install 1 Package
Upgrade 4 Packages (+2 Dependent packages)

Total download size: 48 M
Downloading packages:
No Presto metadata available for base
(1/7): glibc-2.17-260.el7_6.5.x86_64.rpm | 3.7 MB 00:00:00
(2/7): glibc-devel-2.17-260.el7_6.5.x86_64.rpm | 1.1 MB 00:00:00
(3/7): binutils-2.27-34.base.el7.x86_64.rpm | 5.9 MB 00:00:01
(4/7): glibc-headers-2.17-260.el7_6.5.x86_64.rpm | 683 kB 00:00:00
(5/7): glibc-common-2.17-260.el7_6.5.x86_64.rpm | 12 MB 00:00:02
(6/7): kernel-headers-3.10.0-957.21.3.el7.x86_64.rpm | 8.0 MB 00:00:01
(7/7): kernel-devel-3.10.0-957.21.3.el7.x86_64.rpm | 17 MB 00:00:02
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 48 MB 00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : glibc-common-2.17-260.el7_6.5.x86_64 1/13
Updating : glibc-2.17-260.el7_6.5.x86_64 2/13
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
Updating : kernel-headers-3.10.0-957.21.3.el7.x86_64 3/13
Updating : glibc-headers-2.17-260.el7_6.5.x86_64 4/13
Updating : glibc-devel-2.17-260.el7_6.5.x86_64 5/13
Updating : binutils-2.27-34.base.el7.x86_64 6/13
Installing : kernel-devel-3.10.0-957.21.3.el7.x86_64 7/13
Cleanup : glibc-devel-2.17-157.el7_3.1.x86_64 8/13
Cleanup : glibc-headers-2.17-157.el7_3.1.x86_64 9/13
Cleanup : binutils-2.23.52.0.1-30.el7.x86_64 10/13
Cleanup : kernel-headers-3.10.0-514.10.2.el7.x86_64 11/13
Cleanup : glibc-common-2.17-157.el7_3.1.x86_64 12/13
Cleanup : glibc-2.17-157.el7_3.1.x86_64 13/13
Verifying : kernel-devel-3.10.0-957.21.3.el7.x86_64 1/13
Verifying : binutils-2.27-34.base.el7.x86_64 2/13
Verifying : glibc-headers-2.17-260.el7_6.5.x86_64 3/13
Verifying : glibc-2.17-260.el7_6.5.x86_64 4/13
Verifying : glibc-common-2.17-260.el7_6.5.x86_64 5/13
Verifying : glibc-devel-2.17-260.el7_6.5.x86_64 6/13
Verifying : kernel-headers-3.10.0-957.21.3.el7.x86_64 7/13
Verifying : glibc-headers-2.17-157.el7_3.1.x86_64 8/13
Verifying : glibc-common-2.17-157.el7_3.1.x86_64 9/13
Verifying : glibc-2.17-157.el7_3.1.x86_64 10/13
Verifying : kernel-headers-3.10.0-514.10.2.el7.x86_64 11/13
Verifying : binutils-2.23.52.0.1-30.el7.x86_64 12/13
Verifying : glibc-devel-2.17-157.el7_3.1.x86_64 13/13

Installed:
kernel-devel.x86_64 0:3.10.0-957.21.3.el7

Updated:
binutils.x86_64 0:2.27-34.base.el7 glibc-devel.x86_64 0:2.17-260.el7_6.5 glibc-headers.x86_64 0:2.17-260.el7_6.5 kernel-headers.x86_64 0:3.10.0-957.21.3.el7

Dependency Updated:
glibc.x86_64 0:2.17-260.el7_6.5 glibc-common.x86_64 0:2.17-260.el7_6.5

Complete!

Add Repository

virtual box를 인스톨하기 위한 yum repository를 등록 한다.

wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

[root@localhost devops]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-fasttrack.repo docker-ce.repo epel-testing.repo epel.repo mariadb.repo webtatic-archive.repo webtatic-testing.repo webtatic.repo
[root@localhost yum.repos.d]# ll
합계 52
-rw-r--r--. 1 root root 1664 4월 1 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 4월 1 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 4월 1 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1331 4월 1 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1002 4월 1 2015 CentOS-Vault.repo
-rw-r--r--. 1 root root 290 4월 1 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 2424 10월 25 2018 docker-ce.repo
-rw-r--r--. 1 root root 1056 11월 5 2012 epel-testing.repo
-rw-r--r--. 1 root root 960 6월 20 12:28 epel.repo
-rw-r--r--. 1 root root 139 2월 24 2017 mariadb.repo
-rw-r--r--. 1 root root 963 11월 13 2016 webtatic-archive.repo
-rw-r--r--. 1 root root 963 11월 13 2016 webtatic-testing.repo
-rw-r--r--. 1 root root 865 11월 13 2016 webtatic.repo
[root@localhost yum.repos.d]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
--2019-06-21 11:04:18-- http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
Resolving download.virtualbox.org (download.virtualbox.org)... 23.35.220.157
Connecting to download.virtualbox.org (download.virtualbox.org)|23.35.220.157|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 259 [text/plain]
Saving to: ‘virtualbox.repo’

100%[=====================================================================================================================================================================================================================================>] 259 --.-K/s in 0s

2019-06-21 11:04:19 (40.2 MB/s) - ‘virtualbox.repo’ saved [259/259]

install virtualbox

virtual box를 install 한다.

6.0이 현재 기준 최신이다.

yum install -y VirtualBox-6.0

[root@localhost yum.repos.d]# yum install -y VirtualBox-6.0
Loaded plugins: fastestmirror, langpacks
virtualbox/7/x86_64/signature | 181 B 00:00:00
Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc
Importing GPG key 0x98AB5139:
Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>"
Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139
From : https://www.virtualbox.org/download/oracle_vbox.asc
virtualbox/7/x86_64/signature | 2.9 kB 00:00:01 !!!
virtualbox/7/x86_64/primary_db | 130 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: data.aonenetworks.kr
* updates: mirror.kakao.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package VirtualBox-6.0.x86_64 0:6.0.8_130520_el7-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
VirtualBox-6.0 x86_64 6.0.8_130520_el7-1 virtualbox 116 M

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

Total download size: 116 M
Installed size: 238 M
Downloading packages:
경고: /var/cache/yum/x86_64/7/virtualbox/packages/VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 98ab5139: NOKEY========================================================================================-] 8.1 MB/s | 116 MB 00:00:00 ETA
Public key for VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm is not installed
VirtualBox-6.0-6.0.8_130520_el7-1.x86_64.rpm | 116 MB 00:00:14
Retrieving key from https://www.virtualbox.org/download/oracle_vbox.asc
Importing GPG key 0x98AB5139:
Userid : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>"
Fingerprint: 7b0f ab3a 13b9 0743 5925 d9c9 5442 2a4b 98ab 5139
From : https://www.virtualbox.org/download/oracle_vbox.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : VirtualBox-6.0-6.0.8_130520_el7-1.x86_64 1/1

Creating group 'vboxusers'. VM users must be member of that group!

This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-229.el7.x86_64
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-229.el7.x86_64

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Verifying : VirtualBox-6.0-6.0.8_130520_el7-1.x86_64 1/1

Installed:
VirtualBox-6.0.x86_64 0:6.0.8_130520_el7-1

Complete!
[root@localhost yum.repos.d]# rcvboxdrv setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.el7.x86_64

상위와 같이 virtual box를 셋업 했을 경우

Please install the Linux kernel "header" files matching the current kernel

와 같은 글이 나오면 정상적인 셋업이 되지 않았다는 의미이다.

virtual box에서 요청하는 커널 header는

sudo yum install "kernel-devel-uname-r == $(uname -r)"

를 사용해서 install이 가능한데, 어떤 경우는 devel header kernel이 없는 경우가 있다. (직접 빌드 했다던지...)

[root@localhost yum.repos.d]# sudo yum install "kernel-devel-uname-r == $(uname -r)"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.x86_64 0:3.10.0-957.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================================================================================================
Installing:
kernel-devel x86_64 3.10.0-957.el7 base 17 M

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

Total download size: 17 M
Installed size: 37 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
kernel-devel-3.10.0-957.el7.x86_64.rpm | 17 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : kernel-devel-3.10.0-957.el7.x86_64 1/1
Verifying : kernel-devel-3.10.0-957.el7.x86_64 1/1

Installed:
kernel-devel.x86_64 0:3.10.0-957.el7

Complete!
[root@localhost yum.repos.d]# rcvboxdrv setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.

상위와 같이 작동 안되면 cent0S 새로 까는게 정신 건강에 좋다.

Vagrant install

virtual box가 정상적으로 인스톨 완료 되었다면, vagrant를 install한다.

yum -y install https://releases.hashicorp.com/vagrant/1.9.6/vagrant_1.9.6_x86_64.rpm

1.9.6버전은 virtual box 5.1버전까지만 호환 가능하고 6.0부터는 2.0 이상의 vagrant를 install 해야 한다.

하기는 1.x vagrant를 까는 것을 보여준다. (앞서 virtual box 6.x를 깔았음으로 실패 한다.)

[root@localhost ~]# yum -y install https://releases.hashicorp.com/vagrant/1.9.6/vagrant_1.9.6_x86_64.rpm
Loaded plugins: fastestmirror, langpacks
vagrant_1.9.6_x86_64.rpm | 75 MB 00:00:11
Examining /var/tmp/yum-root-4ytLB4/vagrant_1.9.6_x86_64.rpm: 1:vagrant-1.9.6-1.x86_64
Marking /var/tmp/yum-root-4ytLB4/vagrant_1.9.6_x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package vagrant.x86_64 1:1.9.6-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================================================================================================
Installing:
vagrant x86_64 1:1.9.6-1 /vagrant_1.9.6_x86_64 190 M

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

Total size: 190 M
Installed size: 190 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:vagrant-1.9.6-1.x86_64 1/1
Verifying : 1:vagrant-1.9.6-1.x86_64 1/1

Installed:
vagrant.x86_64 1:1.9.6-1

Complete!

Vagrant Start

vagrant init

vagrant up

으로 최초 vagrant가 잘 install 되었는지 확인 가능하지만

Provider를 설정해달라는 요청이 나오게 되는데

vagrant up --provider=virtualbox

와 같이 provider를 설정 해주면 된다.

[root@localhost yum.repos.d]# cd ~
[root@localhost ~]# ls
anaconda-ks.cfg
[root@localhost ~]# mkdir vagrant
[root@localhost ~]# cd vagrant/
[root@localhost vagrant]# ls
[root@localhost vagrant]# vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[root@localhost vagrant]# vagrant up
No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.

If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.

centos/7이라는 box를 vagrant에 등록 해준다.

이때 default Provider를 선택하면 앞서 --provider= 옵션을 사용하지 않아도 된다.

[root@localhost vagrant]# vagrant box add centos/7
==> box: Loading metadata for box 'centos/7'
box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop

Enter your choice: 3
==> box: Adding box 'centos/7' (v1902.01) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1902.01/providers/virtualbox.box
==> box: Successfully added box 'centos/7' (v1902.01) for 'virtualbox'!

vagrant init

명령어를 사용할 경우

해당 명령어를 실행한 디렉토리에

Vagrantfile이 생성되는데, VM에 대한 설정을 할 수있다.

여기에서는

config.vm.box = "centos/7" 이 부분만 수정 함으로써 기본 OS가 centos 7 버전이라는 것을 알려주었다.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "centos/7"

앞서서 vagrant를 1.x로 깔았음으로

아래와 같이 오류가 나온다.

4.0, 4.1, 4.2, 4.3, 5.0, 5.1

Virtual Box 5.1까지만 호환 한다는 의미이다.

Vagrant를 1.x에서 2.x로 새로 install 하자.

vagrant 삭제

[root@localhost vagrant]# rm -rf /opt/vagrant/
[root@localhost vagrant]# rm -f /usr/bin/vagrant

vagrant install

[root@localhost vagrant]# sudo wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rp

[root@localhost vagrant]# sudo yum localinstall vagrant_2.2.4_x86_64.rpm

[root@localhost vagrant]# vagrant up --provider=virtualbox
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.
[root@localhost vagrant]# yum update vagrant
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirror.moack.net
* extras: centos.mirror.moack.net
* updates: centos.mirror.moack.net
No packages marked for update
[root@localhost vagrant]# yum uninstall vagrant
Loaded plugins: fastestmirror, langpacks
No such command: uninstall. Please use /usr/bin/yum --help
[root@localhost vagrant]# rm -rf /opt/vagrant/
[root@localhost vagrant]# rm -f /usr/bin/vagrant
[root@localhost vagrant]# sudo wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm
--2019-06-21 19:40:06-- https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm
Resolving releases.hashicorp.com (releases.hashicorp.com)... 151.101.229.183, 2a04:4e42:36::439
Connecting to releases.hashicorp.com (releases.hashicorp.com)|151.101.229.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40824607 (39M) [application/x-redhat-package-manager]
Saving to: ‘vagrant_2.2.4_x86_64.rpm’

100%[========================================================================================================================================================================>] 40,824,607 9.96MB/s in 4.7s

2019-06-21 19:40:12 (8.20 MB/s) - ‘vagrant_2.2.4_x86_64.rpm’ saved [40824607/40824607]

[root@localhost vagrant]# vagrant --version
bash: /usr/bin/vagrant: 그런 파일이나 디렉터리가 없습니다
[root@localhost vagrant]# vagrnat
bash: vagrnat: 명령을 찾을 수 없습니다...

[root@localhost vagrant]# ls
Vagrantfile vagrant_2.2.4_x86_64.rpm
[root@localhost vagrant]# sudo yum localinstall vagrant_2.2.4_x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining vagrant_2.2.4_x86_64.rpm: 1:vagrant-2.2.4-1.x86_64
Marking vagrant_2.2.4_x86_64.rpm as an update to 1:vagrant-1.9.6-1.x86_64
Resolving Dependencies
--> Running transaction check
---> Package vagrant.x86_64 1:1.9.6-1 will be updated
---> Package vagrant.x86_64 1:2.2.4-1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================================================================================================
Updating:
vagrant x86_64 1:2.2.4-1 /vagrant_2.2.4_x86_64 110 M

Transaction Summary
==================================================================================================================================================================================================================
Upgrade 1 Package

Total size: 110 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 1:vagrant-2.2.4-1.x86_64 1/2
Cleanup : 1:vagrant-1.9.6-1.x86_64 2/2
경고: file /opt/vagrant/embedded/share/info/rluserman.info: remove failed: 그런 파일이나 디렉터리가 없습니다
경고: file /opt/vagrant/embedded/share/info/readline.info: remove failed: 그런 파일이나 디렉터리가 없습니다
경고: file /opt/vagrant/embedded/share/info/libffi.info: remove failed: 그런 파일이나 디렉터리가 없습니다

앞서 vagrant를 새롭게 install 하였고, 아래와 같이 centos/7을 init 해보자.

vagrant init centos/7

vagrant up

[root@localhost vagrant-centos-7]# vagrant init centos/7
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[root@localhost vagrant-centos-7]# vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/7'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/7' version '1902.01' is up to date...
==> default: Setting the name of the VM: vagrant-centos-7_default_1561113935045_2937
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: No guest additions were detected on the base box for this VM! Guest
default: additions are required for forwarded ports, shared folders, host only
default: networking, and more. If SSH fails on this machine, please install
default: the guest additions and repackage the box to continue.
default:
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Rsyncing folder: /root/vagrant-centos-7/ => /vagrant

상위와 같이 로그가 나왔다면, 성공적으로 virtual box, vagrant가 install 된것이다.

vagrant ssh로 접속까지 된다면 완료 이다.

vagrant ssh

[devops@localhost ~]$ vagrant ssh
[vagrant@localhost ~]$ ls
[vagrant@localhost ~]$ pwd
/home/vagrant
[vagrant@localhost ~]$

ifconfig

linux network 설정을 확인 할 수 있는 명령어이나 centos7에서 삭제 되었다.

ip addr

로 변경되었다.

ip addr

ip addr을 실행 하면 다음과 같이 NIC 정보를 확인 할 수 있다.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:6f:d9:08 brd ff:ff:ff:ff:ff:ff

여기서 enpOs3이 해당 NIC 이름이다. 해당 NIC에 대한 설정을 확인 하기 위해서 다음 path로 이동한다.

/etc/sysconfig/network-scripts

해당 디렉토리를 보면

[root@localhost network-scripts]# ls
ifcfg-enp0s3 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-Team ifup ifup-eth ifup-isdn ifup-post ifup-sit ifup-tunnel network-functions
ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifdown-TeamPort ifup-aliases ifup-ippp ifup-plip ifup-ppp ifup-Team ifup-wireless network-functions-ipv6
ifdown ifdown-ippp ifdown-post ifdown-sit ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plusb ifup-routes ifup-TeamPort init.ipv6-global

ifcfg-enp0s3과 같이 NIC 명으로 된 config 파일을 확인 할 수 있다.

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=a0377aa0-2efa-48a1-91eb-5a547c6d3b43
DEVICE=enp0s3
ONBOOT=yes

해당 파일 마지막 부분을 ONBOOT=yes로 변경 한후 다음 명령어를 실행하면 ip를 얻어 올 수 있다.

[root@localhost network-scripts]# dhclient

아래와 같이 ip를 얻어 오면 된다.

[root@localhost network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:6f:d9:08 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.14/24 brd 192.168.0.255 scope global dynamic enp0s3
valid_lft 4486sec preferred_lft 4486sec
inet6 fe80::6940:5b2a:23b9:cafd/64 scope link noprefixroute
valid_lft forever preferred_lft forever

dhcp의 경우 본체 컴퓨터 ip와는 독립적인 ip를 새롭게 발행 하게 된다.

192.168.0.12	A4-70-C8-99-8A-12	DESKTOP	무선:자동할당	// 본체 컴퓨터
192.168.0.14 A4-70-C8-99-8A-12 무선:자동할당 // virtual box centos

Virtual Box Network 어댑터 설정

네트워크 어댑터 사용하기 : check

다음에 연결됨 : 어댑터에 브리지

이름 : 사용하고자 하는 실 컴퓨터 NIC (wifi device라던가 이더넷 등)

yum update

네트워크가 정상적으로 설정되었다면, 상위 명령어를 실행 했을 시 정상적으로 update가 진행 되거나 또는 update할 것이 없다는 내용을 확인 할 수 있다.

[root@localhost network-scripts]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: data.aonenetworks.kr
* extras: data.aonenetworks.kr
* updates: data.aonenetworks.kr
No packages marked for update