Post

CentOS Jenkins 설치

1. Jenkins 설치 확인

1
2
3
4
5
6
7
8
[root@localhost ~]# yum list installed jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.navercorp.com
 * extras: mirror.navercorp.com
 * updates: mirror.navercorp.com
Error: No matching Packages to list
[root@localhost ~]#

2. Jenkins 다운로드

  • /etc/yum.repos.d/jenkins.repo 경로 다운로드
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2020-04-07 10:31:42--  https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 52.202.51.185
Connecting to pkg.jenkins.io (pkg.jenkins.io)|52.202.51.185|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
 
100%[==============================================================================>] 85          --.-K/s   in 0s      
 
2020-04-07 10:31:47 (5.78 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]
 
[root@localhost ~]#

3. Key Import

1
2
[root@localhost ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[root@localhost ~]#

4. 설치

1
2
3
4
5
6
7
8
9
10
11
[root@localhost ~]# yum install jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 
...
 
Installed:
  jenkins.noarch 0:2.222.1-1.1                                                                                                                                                                               
 
Complete!
[root@localhost ~]#

5. Jenkins 설정

Jenkins는 기본 포트 8080으로 설정되어 있어 Tomcat과 충돌하기 때문에 9090으로 변경한다.

  • 편집
1
[root@localhost ~]# vi /etc/sysconfig/jenkins
  • 수정
1
JENKINS_PORT="9090"

6. 서비스 시작 및 종료

  • 시작
1
2
3
[root@localhost ~]# service jenkins start
Starting jenkins (via systemctl):                          [  OK  ]
[root@localhost ~]#
  • 종료
1
2
3
[root@localhost ~]# service jenkins stop
Stopping jenkins (via systemctl):                          [  OK  ]
[root@localhost ~]#

7. 방화벽 설정

설정한 포트 9090을 열어준다.

1
2
3
4
5
[root@localhost ~]# firewall-cmd --zone=public --permanent --add-port=9090/tcp
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#

8. 웹 접속

  • 접속 주소: http://서버주소:9090
  • 초기 비밀번호: /var/lib/jenkins/secrets/initialAdminPassword에 있음
1
[root@localhost ~]# vi /var/lib/jenkins/secrets/initialAdminPassword

img001

[출처 및 참고]

This post is licensed under CC BY 4.0 by the author.