Jenkins is an open source server which is for continuous integration and written by JAVA. This is a world famous CI(Continuous Integration) tool. This tutorial guides you through the steps to deploy jenkins server on RHEL(Red Hat Enterprise Linux) server. The steps are given below.
- Check the JAVA is available on the RHEL server.
# java -versionOutput :
java version "1.8.0_45"Java(TM) SE Runtime Environment (build 1.8.0_45-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) - If there is no JAVA is installed on your, install java and get it confirmed that’s installed.# yum install java
- Add the Jenkins repository to the host machine, then install the rpm file.wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
-
Install Jenkins server
# yum install jenkins -
Adding jenkins to system boot
# chkconfig jenkins on - Start Jenkins and check the port 8080 is opened from the server side.
# service jenkins start# netstat -tnlp | grep 8080 - Open your browser and load Jenkins server http://<server_ip>:8080
# ssh-keygen -t jenkin@localhost.com
# ls -al ~/.ssh/- Open the rsa.pub file and copy the content to the clip board then update the Github user in Github dashboard. Go to Github -> Your Profile -> SSH Keys -> Add New
- Install the git plugin in Jenkins server.
Go to Jenkins -> Manage Jenkins -> Manage Plugins -> Install git Plugin - Create a job in Jenkins with you project details.
Jenkins Dashboard -> New Item - After creating the job, you will see the git server settings on configuration on the specified project.
Go to project -> configure
13. Under git settings in configuration page you can add the specific git configurations.
14. In Git credentials you have to add the Private key you generated at step number 8, copy the RSA key content to the clip board, then go to Add -> select SSH Username with private key. Then add username, private key value.
15. Then add the build step with “execute shell” and add the command to execute scala application.
16. Now add the scala command to build play applications.
17. In order to execute the play application build command in Jenkins, SBT should be installed on the host machine. Go to this link http://www.scala-sbt.org/download.html and get the latest SBT.zip file and extract it in a suitable directory (e.g.: /srv/sbt).
# cd /srv/sbt/bin/# ./sbt
Output :
18. Now time to build the play application, go to Jenkins server and run the "Build Now”, then you will see the console output. Finally if you are getting message “success”, then you are done. :)