Support Online
Skip to main content

Ubuntu 22.04 Jenkins CI Pipeline Installation

Installing Pipeline with Jenkins on Ubuntu 22.04

Speed and trust are critical in software development.
In this guide,

oaicite:0

with**

oaicite:1

**by establishing the integration,
We will create a modern CI pipeline that runs automatic testing on every code submission.

Tests

oaicite:2

Works in containers.

What Will You Learn in This Guide?

  • Configuring Jenkins to run Docker
  • Establishing a secure Token & Webhook connection between GitHub and Jenkins
  • Writing a code-based CI scenario with Jenkinsfile
  • Activating the automatically triggered CI line with push

Technical Summary

Subject: Continuous Integration (CI) with Jenkins
Problem: Manual testing and build processes
Solution: Docker isolated test pipeline triggered by GitHub push events

This structure:

  • Provides faster feedback
  • Catches errors early
  • Improves development quality

Preliminary Preparations

Before you start you should have the following ready:

-**

oaicite:3

Server with 22.04** installed
  • At least 1 GB RAM
  • Jenkins, Nginx and Docker installed
  • A dedicated domain for Jenkins (ex: ci.ornek.com)
  • GitHub account and a sample project

Step 1: Grant Docker Privilege to Jenkins User

We must authorize Jenkins to use Docker.

sudo usermod -aG docker jenkins
  • This command adds the Jenkins user to the docker group.

Check:


grep docker /etc/group

  • Restart Jenkins for the change to take effect:

sudo systemctl restart jenkins

Note: From Manage Jenkins → Manage Plugins

  • Make sure Docker and Docker Pipeline plugins are installed.

Step 2: Creating a GitHub Personal Access Token (PAT)

  1. A token is required for Jenkins to monitor GitHub.
  • On GitHub:

Settings → Developer settings → Personal access tokens

Generate new token

  • Powers:

1st repo:status

  1. repo:public_repo (repo for private repo)

  2. admin:org_hook

  • Copy the token as soon as you create it. Then it is invisible.

Step 3: Defining the Token to Jenkins

  1. In Jenkins panel:
  • Click on the username at the top right

  • Credentials → (global) → Add Credentials


Settings:

Kind: Secret text

Secret: GitHub token

Description: GitHub CI Token


  • Then:

Manage Jenkins → Configure System → GitHub

  • Select Token

  • Say test connection

  • Save if successful


Step 4: Sample Project and Jenkinsfile

  • You can use a sample Node.js project for testing:

https://github.com/content-demo/hello-hapi

  • Jenkinsfile is located in the repo root directory:

pipeline {
agent {
docker {
image 'node'
args '-u root'
}
}
stages {
stage('Derleme') {
steps {
sh 'npm install'
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
}
}

  • This pipeline:

Node starts the Docker image

  • Installs dependencies

  • Runs tests


Step 5: Creating Jenkins Pipeline

  1. On the Jenkins home screen:
  • New Item

Give name (ex: NodeJS-CI-Test)

  • Select Pipeline → OK

Settings:

  1. GitHub project: Repo URL

  2. Build Triggers: GitHub hook trigger

  3. Pipeline: Pipeline script from SCM


  1. SCM: Go

  2. Script Path: Jenkinsfile

  3. Exit with Save.


Step 6: First Build and Create Webhook

  1. Initial build is required for the webhook to be created automatically.

  2. Press the Build Now button

  3. When the build is completed, go to Configure → Save

  4. Jenkins should appear in GitHub → Settings → Webhooks.


Test

  1. Make a small change in the repo and commit.

  2. Jenkins starts automatic build


Frequently Asked Questions (FAQ)

  1. Why do we use Docker? The test environment is isolated, no dependencies conflict.

  2. What should I do if the webhook does not occur? You can add it manually from GitHub.

  3. Is Jenkinsfile mandatory? Yes for Pipeline from SCM.

  4. Is private repo supported? Yes, token is enough.


Result

With this guide:

You have set up Jenkins + GitHub integration You have created an automated testing pipeline in Docker You have implemented a modern CI process

You can use the GenixNode VDS infrastructure with peace of mind to run this structure in a stable and powerful environment.