- 2 vCPU
- 4 GB RAM
- 20 GB Disk
- 1 vCPU
- 2 GB RAM
Create a VM (Cloud VM or VirtualBox VM) and install the required tools.
Follow:
https://github.com/lerndevops/labs/blob/master/jenkins/Install/README.md
Follow:
https://github.com/lerndevops/labs/blob/master/jenkins/Install/README.md
sudo wget https://raw.githubusercontent.com/lerndevops/labs/master/scripts/installDocker.sh -P /tmp sudo chmod 755 /tmp/installDocker.sh sudo bash /tmp/installDocker.sh
sudo apt update sudo apt install -y ansible sudo su - jenkins cd ~ ansible-config init --disabled > ansible.cfg cd ~ ; vi ansible.cfg
Uncomment & set as below:
host_key_checking = FalseNote: Disabling host key checking is acceptable for lab environments. In production, host key checking should remain enabled.
Open:
http://<SERVER-IP>:8080
For cloud deployments, use the public IP and ensure port 8080 is allowed.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Install Suggested Plugins
- Complete the setup wizard
Manage Jenkins → Plugins
Install:
- JUnit
- coverage
- Warnings NG
- Build Pipeline (optional)
- pipeline stage view
- Docker Pipeline
Manage Jenkins → Credentials
Kind: Username with Password
Scope: Global
Username: <Docker Hub Username>
Password: <Docker Hub Personal Access Token>
ID: DOCKER_HUB_LOGIN
Description: DOCKER_HUB_LOGIN
Recommended: Use Docker Hub Personal Access Token (PAT) instead of your account password.
Manage Jenkins → Global Tool Configuration → JDK
Name: JDK21
JAVA_HOME: /path/to/java/home
Manage Jenkins → Global Tool Configuration → Maven
Name: Maven3
MAVEN_HOME: /path/to/maven/home
Manage Jenkins → Global Tool Configuration → Git
Name: git
Path to Git executable: /usr/bin/git
sudo usermod -aG docker jenkins sudo systemctl restart jenkins
Validate:
sudo su - jenkins docker version docker ps docker pull nginx
If these commands work without permission errors, Jenkins can successfully execute Docker commands.
- 1 Control Plane
- 1 Worker Node
OR
- 1 Manager
- 1 Worker
- Minimum 3 Control Plane Nodes
- Multiple Worker Nodes
- Minimum 3 Manager Nodes
- Multiple Worker Nodes
vi /tmp/inv sudo chmod 640 /tmp/inv sudo chown jenkins:jenkins /tmp/inv
Sample Inventory:
https://raw.githubusercontent.com/lerndevops/PetClinic/master/deploy/inv
Ensure only manager/control-plane IPs are added as required. Do not add worker/node IPs unless your deployment model specifically requires them.
Jenkins Home → New Item
Name: CICD-Pipeline
Type: Pipeline
Pipeline Tab
Definition:
Pipeline Script from SCM
SCM:
Git
Repository URL:
https://github.com/lerndevops/it-services-portal
Script Path:
jenkins/cicd.gvy
Pipeline Script:
https://github.com/lerndevops/it-services-portal/blob/main/jenkins/cicd.gvy
Save and click Build Now.
Store the Jenkinsfile (or cicd.gvy) inside the application repository and manage the pipeline as code.
Avoid maintaining build logic directly inside Jenkins jobs whenever possible.