본문 바로가기

Java/Deploy

[Jenkins] Ubuntu에 설치하는 방법

반응형

[ 설치 환경 ]

Ubuntu : 16.04v

Linux kernel : 4.9v


 

1. Java 설치 여부 확인 

Java 버전 확인하기 

- 아래와 같이 Java 버전이 1.8.0처럼 표기되지 않는 경우, 미설치된 것으로 관련 설치방법은 생략함

$ java -version

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
OpenJDK Client VM (build 25.222-b10, mixed mode)

 

2. Jenkins 설치 과정

  2-1. apt key 추가

$ wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

[sudo] password for [접근 ID]: [ID의 비밀번호 입력]
OK

 

  2-2. Jenkins repository 추가

$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

 

  2-3. Jenkins 설치

젠킨스는 설치가 완료되면 자동적으로 실행할 것이며, 당신은 아래의 명령어(2-4)를 통해 그 서비스의 상태를 확인할 수 있을 것입니다.

$ sudo apt update

Ign:1 http://pkg.jenkins.io/debian-stable binary/ InRelease                                                                                   
Hit:2 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease                                                                      
Hit:3 http://pkg.jenkins.io/debian-stable binary/ Release                                                                                       
Get:4 http://deb.odroid.in/5422-s xenial InRelease [1,721 B]                                                                                    
Hit:5 http://ports.ubuntu.com/ubuntu-ports xenial InRelease                                                                            
Hit:7 http://ppa.launchpad.net/umang/indicator-stickynotes/ubuntu xenial InRelease                  
Get:8 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease [109 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports xenial-backports InRelease [107 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease [109 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main Sources [341 kB]
Get:12 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages [788 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports xenial-updates/universe armhf Packages [684 kB]                                                     
Get:14 http://ports.ubuntu.com/ubuntu-ports xenial-security/main Sources [156 kB]                                                               
Get:15 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages [533 kB]                                                        
Get:16 http://ports.ubuntu.com/ubuntu-ports xenial-security/universe armhf Packages [402 kB]                                                    
Fetched 3,232 kB in 9s (351 kB/s)                                                                                                               
Reading package lists... Done
Building dependency tree       
Reading state information... Done
40 packages can be upgraded. Run 'apt list --upgradable' to see them.

 

$ sudo apt install jenkins

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm4.0 libqmi-glib1 libqpdf17
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  jenkins
1 upgraded, 0 newly installed, 0 to remove and 39 not upgraded.
Need to get 77.5 MB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://pkg.jenkins.io/debian-stable binary/ jenkins 2.190.2 [77.5 MB]
Fetched 77.5 MB in 21s (3,538 kB/s)                                                                                                             
(Reading database ... 234490 files and directories currently installed.)
Preparing to unpack .../jenkins_2.190.2_all.deb ...
Unpacking jenkins (2.190.2) over (2.176.2) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Setting up jenkins (2.190.2) ...

 

  2-4. Jenkins 설치 여부 확인

$ systemctl status jenkins

● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
   Active: active (exited) since Tue 2019-10-29 13:45:10 UTC; 4min 45s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 10958 ExecStart=/etc/init.d/jenkins start (code=exited, status=0/SUCCESS)

 

  2-5. Jenkins 보안 설정

  Jenkins의 기본 포트는 8080으로, 변경하기 위해서는 "/etc/default/jenkins"에서 HTTP_PORT를 수정한다.

$ sudo vi /etc/default/jenkins

...
# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=9090
...

 

  2-6. Jenkins 종료 및 재시작

$ sudo service jenkins stop
$ sudo service jenkins start

 

반응형

❥ CHATI Github