Installing Jenkins (zip version)

Installing Jenkins (zip version)

These instructions are quick and easy to follow steps for installing Jenkins (the zip version). It requires Tomcat, which in turn requires JDK. Instructions here are specific to Linux, but with simple adjustments can apply to Microsoft Windows too.

The software versions here are based on the latest versions as of March 2024:

  • Java Development Kit (JDK) 22
  • Apache Tomcat 9.0.88
  • Jenkins 2.440.3.

Download Software

  1. Download Java Development Kit (JDK) 22 from here (e.g., jdk-22_linux-x64_bin.tar.gz).
  2. Download the Apache Tomcat 9 core binary distribution from here (e.g., apache-tomcat-9.0.88.zip).
  3. Download the Jenkins 2.x generic Java package from here (e.g., jenkins.war).

Install Software

JDK and Tomcat simply require unzipping them to some folder.

# Extract Java
gtar -xzvf jdk-22_linux-x64_bin.tar.gz

# Unzip Tomcat
unzip apache-tomcat-9.0.88.zip</pre>

Set Environment

Set the environment variables as shown.

# Set Java environment variable
export JAVA_HOME=/home/opc/jenkins/jdk-22.0.1

# Set Tomcat home
export TOMCAT_HOME=/home/opc/jenkins/apache-tomcat-9.0.88

# Set PATH
export PATH=${JAVA_HOME}/bin:${TOMCAT_HOME}/bin:${PATH}

Configure Tomcat

On Linux, the shell scripts to startup and shutdown need their permissions updated to executable. Also, the admin user needs to be set up. Lastly, Tomcat by default only allows the Manager App to be accessible from localhost, so removing this restriction in non-production environments allows easy access to the administration console.

# Update permissions
cd ${TOMCAT_HOME}/bin
chmod 700 *.sh

# Enable admin user
vi ${TOMCAT_HOME}/conf/tomcat-users.xml

# Add this line to the file
<user username="admin" password="welcome1" roles="manager-gui">

# Enable admin console
vi ${TOMCAT_HOME}/webapps/manager/META-INF/context.xml

# Comment this entry in the file
<!--
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->

Open Local Firewall for Tomcat Port (Linux only)

In many current distributions of Linux, by default the local firewall may be set up to lock down certain ports. These instructions open up the default HTTP 8080 port so that the Tomcat/Jenkins web consoles can be accessed from outside the box.

# As the 'root' user
firewall-cmd --zone=public --add-port=8080/tcp --permanent
systemctl stop firewalld
systemctl start firewalld

Deploy Jenkins

The Jenkins WAR file can be deployed through the Tomcat Manager App, or simply copying it to the ~/webapps folder before startup. On startup, it's contents are automatically extracted.

cp jenkins.war ${TOMCAT_HOME}/webapps

Startup Tomcat

# Startup Tomcat
cd ${TOMCAT_HOME}/bin
./startup.sh

Access the Jenkins Console

There is also some minor initial Jenkins setup required.

  1. Navigate to the Jenkins console at http://devhost:8080/jenkins.
  2. Copy the password from the flat file listed and paste it as shown, then click on "Continue".
  1. Select "Install suggested plugins". Additional plugins can be installed in the future if needed.
  1. Enter the first admin user details, then click on "Save and Continue".
  1. Click on "Save and Finish".

For reference, the Tomcat page is accessible at http://devhost:8080.

For reference, the Tomcat Manager App is accessible at http://devhost:8080/manager/html.

For reference, the Jenkins console is accessible at http://devhost:8080/jenkins.