Installing Jenkins on CentOS 7
- 1 minInstalling Jenkins on CentOS 7
Intro & pre-requisites
For this how-to, you will need an install of CentOS 7 and to install Extra Packages for Enterprise Linux (EPEL) repository; but first, let’s update our packages:
$ sudo yum install epel-release -y
$ sudo yum update -y
$ sudo reboot
Once this is done, let’s reboot. Now, let’s install OpenJDK, needed for Jenkins, and position the %JAVA_HOME% and %JRE_HOME% variables, then load everything up:
$ sudo yum install java-1.8.0-openjdk.x86_64
$ echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' | sudo tee -a /etc/profile
$ echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile
$ source /etc/profile
Let’s also make sure that we’ve done things right:
$ echo $JAVA_HOME $JRE_HOME
/usr/lib/jvm/jre-1.8.0-openjdk /usr/lib/jvm/jre
Installing Jenkins
In this step, we’ll install Jenkins, register it as a service and drill a hole in your firewall configuration to allow for Jenkins to be reachable from outside your host.
$ cd ~
$ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
$ sudo rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
$ sudo yum install jenkins -y
$ sudo systemctl start jenkins.service
$ sudo systemctl enable jenkins.service
$ sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
$ sudo firewall-cmd --reload
Configuring Jenkins
Jenkins is now installed. One last step: configuring Jenkins via its web interface ! In order to do that, please point your favourite browser to:
http://%ip-of-your-jenkins-server%:8080