Saturday 26 August 2017

Installation of Jenkins in Linux

In this blog, I would just summarize installation of jenkins in few steps

1. Jenkins is Java based application, hence install Java version 8
2. Tomcat is required to deploy Jenkins war file, hence install Apache Tomcat version 9
3. Download Jenkins war file
4. Deploy Jenkins war file using Tomcat 
5. Install suggested plugins

Environment: CentOS / Redhat

- Install latest Java version

#yum install java-1.8.0-openjdk

- Download Apache Tomcat 

#tar -xzvf apache-tomcat-9.0.0.M10.tar.gz

#mv apache-tomcat-9.0.0.M10 apache9

- Provide username and password for Apache Tomcat

#mv apache9/conf/tomcat-users.xml apache9/conf/tomcat-users.xml.original
#vim apache9/conf/tomcat-users.xml

<?xml version="1.0" encoding="UTF-8"?>
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  See the License for the specific language governing permissions and
  limitations under the License.
<tomcat-users xmlns=""
              xsi:schemaLocation=" tomcat-users.xsd"
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="
" password="
" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

#cd apache9/bin

[user@localhost bin]$ ./
Using CATALINA_BASE:   /home/vagrant/tomcat9
Using CATALINA_HOME:   /home/vagrant/tomcat9
Using CATALINA_TMPDIR: /home/vagrant/tomcat9/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /home/vagrant/tomcat9/bin/bootstrap.jar:/home/vagrant/tomcat9/bin/tomcat-juli.jar
Tomcat started.
[user@localhost bin]$

- Open your local browser and point your URL to http://localhost:8080 to display Apache Tomcat

In-order to deploy jenkins war file click on "Manager App" , provide credentials written in tomcat-users.xml
In deploy section write your context path and WAR file to be deloyed

Once above is completed, it will be deployed and in the Application and click on Jenkins, you need to unlock Jenkins by providing password located in your home directory. 
#cat /home/user/.jenkins/secret/initialAdminPassword

Once they are unlocked, install the suggested plugins and get started. Create your First Admin user and Jenkins is ready