Jenkins: Install Jenkins on Redhat 9 with OpenJDK 17
Install Jenkins on Redhat 9 with OpenJDK 17
Procedure
1) Configure Jenkins repository
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key sudo yum upgrade
2) Add required dependencies for the jenkins package
sudo yum install fontconfig java-17-openjdk sudo yum install jenkins sudo systemctl daemon-reload
3) Configure to use java-17-openjdk
In my case I need to have java-11 and java-17, i will configure Jenkins service to use jdk 17
I prefere to use vim as system editor
export SYSTEMD_EDITOR=vim
Edit
systemctl edit jenkins --full
Uncomment and define JAVA_HOME
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk"
Save and Quit
4) Start and enable Jenkins service using following commands
sudo systemctl start Jenkins sudo systemctl status jenkins