Jenkins | Deploy & Configure for Play Applications in RHEL 6.x

Jenkins is an open source server for continuous integration and written by JAVA. This is one of 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.

  1. Check the JAVA is available on the RHEL server.
    # java -version
    Output : 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)
  2. If there is no JAVA is installed on your, install java and get it confirmed that’s installed.
    # yum install java
  3. Add the Jenkins repository to the host machine, then install the rpm file.
    wget -O /etc/yum.repos.d/jenkins.repo
    rpm –import
  4. Install Jenkins server
    # yum install jenkins
  5. Adding jenkins to system boot
    # chkconfig jenkins on
  6. Start Jenkins and check the port 8080 is opened from the server side.
    # service jenkins start
    # netstat -tnlp | grep 8080
  7. Open your browser and load Jenkins server http://:8080
    Screen Shot 2015-05-07 at 3.49.05 PM
  8. After successfully deploy the Jenkins server, you can setup the server to build scala applications. In here the application code will be retrieved from the git server, so git server should have a separate user for jenkins. In order to achieve that, user have to generate a SSH key file from the host machine.

    # ssh-keygen -t
    # ls -al ~/.ssh/

  9. Open the file and copy the content to the clip board then update the Github user in Github dashboard. Go to Github -> Your Profile -> SSH Keys -> AddScreen Shot 2015-05-07 at 2.23.19 PM
  10. NewInstall the git plugin in Jenkins server.
    Go to Jenkins -> Manage Jenkins -> Manage Plugins -> Install git Plugin
    Screen Shot 2015-05-07 at 2.34.41 PM
  11. Create a job in Jenkins with you project details.
    Jenkins Dashboard -> New Item
    Screen Shot 2015-05-07 at 11.43.11 AM
  12. After creating the job, you will see the git server settings on configuration on the specified project. Go to project -> configure
    Screen Shot 2015-05-07 at 3.00.45 PM
  13. Under git settings in configuration page you can add the specific git configurations.
    Screen Shot 2015-05-07 at 3.05.36 PM
  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.
    Screen Shot 2015-05-07 at 3.08.57 PM
  15. Then add the build step with “execute shell” (Under LINUX Platform) and add the command to execute scala application.
    Screen Shot 2015-05-07 at 3.18.52 PM
  16. Now add the scala command to build play applications.
    Screen Shot 2015-05-07 at 3.28.45 PM
  17. In order to execute the play application build command in Jenkins, SBT should be installed on the host machine. Go to this link and get the latest file and extract it in a suitable directory (e.g.: /srv/sbt).
    # cd /srv/sbt/bin/
    # ./sbt
    Output :
    Screen Shot 2015-05-08 at 11.34.45 AM
  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. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s