Comprehensive Guide to Jenkins Installation and Deployment

Jenkins Overview

Jenkins is an open-source automation server written in Java that helps automate the building, testing, and deployment of software. It provides hundreds of plugins to support building, deploying, and automating any project. Originally known as Hudson, Jenkins has evolved into a powerful CI/CD tool.

Key Features:

  • Open-source and free
  • Cross-platform compatibility
  • Master-slave architecture for distributed builds
  • Web-based graphical interface
  • Simple installation and configuration
  • 200+ available plugins

Installation Steps

Prerequisites

Before installing Jenkins, ensure you have Java Development Kit (JDK) installed. Jenkins requires Java 8 or later.

Installation via WAR File

Download the Jenkins WAR file from the official site. After downloading, execute the following command:

nohup java -jar jenkins.war --httpPort=8888 &

Access Jenkins through your browser at http://your-server-ip:8888. Follow the on-screen instructions to complete the initial setup, including creating an admin account and installing recommended plugins.

Environment Setup

JDK Configuration

First, check for existing Java installations:

java -version

If you need to remove OpenJDK:

rpm -qa | grep java
rpm -e --nodeps [package-name]

Extract and install Oracle JDK:

tar -xvf jdk-8u144-linux-x64.tar.gz
mv jdk1.8.0_144 /opt/java
mv jdk1.8.0_144 jdk1.8

Configure environment variables:

vim /etc/profile

Add these lines:

export JAVA_HOME=/opt/java/jdk1.8
export JRE_HOME=/opt/java/jdk1.8/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export PATH=.:${JAVA_HOME}/bin:$PATH

Apply changes:

source /etc/profile
java -version

Maven Installation

Extract Maven to /opt directory and configure settings.xml:

<mirrors>
   <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
   </mirror>
</mirrors>

Set Maven environment variables:

export MAVEN_HOME=/opt/apache-maven-3.5.0
export PATH=.:${JAVA_HOME}/bin:$MAVEN_HOME/bin:$PATH

Git Configuration

Install Git if not present and configure SSH keys:

git config --global user.name "username"
git config --global user.email "email@example.com"
ssh-keygen -t rsa -C "email@example.com"

Copy the public key to your Git provider account.

Node.js Setup

tar -zxvf node-v11.15.0-linux-x64.tar.gz
mv node-v11.15.0-linux-arm64/ nodejs
mv nodejs/* /usr/local/nodejs
ln -s /usr/local/nodejs/bin/node /usr/local/bin
ln -s /usr/local/nodejs/bin/npm /usr/local/bin
npm install -g yarn
ln -s /usr/local/nodejs/bin/yarn /usr/local/bin

Jenkins Configuration

Essential Plugins

Install these plugins via Manage Jenkins → Manage Plugins:

  • Maven Integration
  • Git Parameter Plug-In
  • Publish over SSH
  • ThinBackup

System Configuration

Navigate to Manage Jenkins → Configure System. Set up paths for JDK, Maven, Git, and Node.js. Configure SSH servers for remote deployment.

Project Configuration

Java Project Setup

  1. Create a new Maven project
  2. Configure Git repository and branch selection
  3. Set build goals (e.g., clean install)
  4. Configure post-build actions for SSH deployment

Frontend Project Setup

  1. Create a Freestyle project
  2. Configure Git repository
  3. Add build steps:
npm install --unsafe-perm=true
chmod -R 777 node_modules/
npm run build
  1. Set up artifact transfer via SSH

Advanced Configuration

Custom Workspace

In project configuration, enable "Use custom workspace" to specify a custom directory for code checkout.

Project Dependencies

Set up project relationships where Project A depends on Project B. Configure Project A to build automatically after successful completion of Project B.

Parameterized Builds

Enable "This project is parameterized" to allow runtime parameter selection, such as Git branches.

Backup Configuration

Use the ThinBackup plugin to regularly back up Jenkins configurations.

Troubleshooting Common Issues

Git Clone Errors (Status 128)

Verify SSH key configuration and test with manual git clone from the Jenkins server.

SSH Key Format Issues

Generate compatible SSH keys:

ssh-keygen -m PEM -t rsa -b 4096

Node.js Build Failures

For node-sass errors, use:

npm install --unsafe-perm=true

For permission issues:

npm install && chmod -R 777 node_modules/ && npm run build

Dependency Version Conflicts

For Vue-related errors:

npm install @vue/compiler-sfc

For engine incompatibility warnings:

yarn config set ignore-engines true

Tags: Jenkins CI/CD automation devops installation

Posted on Mon, 17 Aug 2026 16:16:14 +0000 by anoopd