ふたりで

jenkins upgrade후 해주어야 할 것들 java11 본문

Jenkins

jenkins upgrade후 해주어야 할 것들 java11

graykang 2024. 1. 17. 18:07
728x90
반응형
SMALL

기존 jenkins를 2.1XX.X 버전을 사용하고 있었는데 현재 기준 최신버전 2.426.2 버전으로 업그레이드를

하고 나니 jenkins가 실행이 아니 된다...

하여 해결했던 과정을 정리해 본다.

1. jenkins 최신버전 war파일 다운로드.

https://get.jenkins.io/war-stable/2.426.2/jenkins.war

 

2. 기존 jenkins.war 파일 백업 및 다운로드한 jenkins.war 파일로 교체 작업은 /home/graykang 에서 한다.

백업 # cp /usr/share/java/jenkins.war ./jenkins.backup.war

교체 # cp ./jenkins.war /usr/share/java/

 

3. 2번까지 하고 jenkins를 실행하면 아래와 같은 오류가 빡 발생한다.

]# systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
]#

 

겁내 구글링을 해본 결과 음... jenkins의 실행 포트문제 또는 JAVA버전문제라고...

 

4. jenkins.service 상태를 확인하면 아래와 같이 나온다.

]# systemctl status jenkins.service
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/jenkins.service.d
           └─override.conf
   Active: failed (Result: start-limit) since 수 2024-01-17 15:56:25 KST; 56min ago
  Process: 7360 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 7360 (code=exited, status=1/FAILURE)

 1월 17 15:56:25 localhost.localdomain systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
 1월 17 15:56:25 localhost.localdomain systemd[1]: Failed to start Jenkins Continuous Integration Server.
 1월 17 15:56:25 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
 1월 17 15:56:25 localhost.localdomain systemd[1]: jenkins.service failed.
 1월 17 15:56:25 localhost.localdomain systemd[1]: jenkins.service holdoff time over, scheduling restart.
 1월 17 15:56:25 localhost.localdomain systemd[1]: Stopped Jenkins Continuous Integration Server.
 1월 17 15:56:25 localhost.localdomain systemd[1]: start request repeated too quickly for jenkins.service
 1월 17 15:56:25 localhost.localdomain systemd[1]: Failed to start Jenkins Continuous Integration Server.
 1월 17 15:56:25 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
 1월 17 15:56:25 localhost.localdomain systemd[1]: jenkins.service failed.
]#

 음...failed 라네.... 구글링을 통해 습득한 정보를 토대로 ㄱㄱㄱ

 

4. yum으로 openjdk-11을 설치해 준다.

]# yum install -y java-11-openjdk-devel.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.kaist.ac.kr
 * extras: ftp.kaist.ac.kr
 * updates: ftp.kaist.ac.kr
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package java-11-openjdk-devel.x86_64 1:11.0.21.0.9-1.el7_9 will be installed
--> Processing Dependency: java-11-openjdk(x86-64) = 1:11.0.21.0.9-1.el7_9 for package: 1:java-11-openjdk-devel-11.0.21.0.9-1.el7_9.x86_64
--> Running transaction check
---> Package java-11-openjdk.x86_64 1:11.0.21.0.9-1.el7_9 will be installed
--> Processing Dependency: java-11-openjdk-headless(x86-64) = 1:11.0.21.0.9-1.el7_9 for package: 1:java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64
--> Running transaction check
---> Package java-11-openjdk-headless.x86_64 1:11.0.21.0.9-1.el7_9 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================================================================================
 Package                                                                    Arch                                                     Version                                                                   Repository                                                 Size
===============================================================================================================================================================================================================================================================================
Installing:
 java-11-openjdk-devel                                                      x86_64                                                   1:11.0.21.0.9-1.el7_9                                                     updates                                                   3.4 M
Installing for dependencies:
 java-11-openjdk                                                            x86_64                                                   1:11.0.21.0.9-1.el7_9                                                     updates                                                   242 k
 java-11-openjdk-headless                                                   x86_64                                                   1:11.0.21.0.9-1.el7_9                                                     updates                                                    39 M

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

Total download size: 43 M
Installed size: 170 M
Downloading packages:
(1/3): java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64.rpm                                                                                                                                                                                                   | 242 kB  00:00:00
(2/3): java-11-openjdk-devel-11.0.21.0.9-1.el7_9.x86_64.rpm                                                                                                                                                                                             | 3.4 MB  00:00:00
(3/3): java-11-openjdk-headless-11.0.21.0.9-1.el7_9.x86_64.rpm                                                                                                                                                                                          |  39 MB  00:00:03
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                           10 MB/s |  43 MB  00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:java-11-openjdk-headless-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                       1/3
  Installing : 1:java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                                2/3
  Installing : 1:java-11-openjdk-devel-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                          3/3
  Verifying  : 1:java-11-openjdk-headless-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                       1/3
  Verifying  : 1:java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                                2/3
  Verifying  : 1:java-11-openjdk-devel-11.0.21.0.9-1.el7_9.x86_64                                                                                                                                                                                                          3/3

Installed:
  java-11-openjdk-devel.x86_64 1:11.0.21.0.9-1.el7_9

Dependency Installed:
  java-11-openjdk.x86_64 1:11.0.21.0.9-1.el7_9                                                                                      java-11-openjdk-headless.x86_64 1:11.0.21.0.9-1.el7_9

Complete!
]#

 

728x90
반응형
SMALL

5. jenkins.service 내용 수정.

centos7의 기본 JAVA_HOME 설정은 jdk1.8로 되어있는 상태이고 추가로 jdk11을 설치한 상태이며 이 상태에서 

jenkins가 구동될 때만 jdk11을 바라보도록 해준다.

yum으로 jdk를 설치할 경우 보통 /usr/lib/jvm/ 경로에 설치가 된다.

]# vi /usr/lib/systemd/system/jenkins.service

 

수정한 부분: jdk11 경로 설정 및 jenkins의 포트설정.

# The Java home directory. When left empty, JENKINS_JAVA_CMD and PATH are consulted.
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.21.0.9-1.el7_9.x86_64/"

# Port to listen on for HTTP requests. Set to -1 to disable.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
Environment="JENKINS_PORT=9100"

 

위와 같이 설정해 주고 실행하니 아주 잘 된다. ㅎㅎ http://localhost:9100/으로 접근하면 새로 바뀐 로그인 화면이 뜨고

로그인하면 기존에 등록했던 Job들도 잘 보인다.

 

참고로 이 글을 작성하는 기준 24년 6월에 CentOS7 지원이 공식 적으로 중단된다고 한다 ㅠㅜ;;

나만 몰랐던것 같다 ㅠㅜ;;;

한바탕 뒤집어질 것 같다;;;;;

728x90
반응형
LIST
Comments