0% found this document useful (0 votes)
9 views4 pages

Complete Jenkins Guide

The document is a comprehensive guide on Jenkins, an open-source automation tool for Continuous Integration and Continuous Deployment. It covers installation steps for Ubuntu/Debian, setting up Jenkins, creating Freestyle jobs, configuring CI/CD pipelines, and running Jenkins in a Docker container, along with best practices for effective usage. Key features include extensive plugin support, scalability, and integration with various tools like Git and Docker.

Uploaded by

ksrivenu362
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Complete Jenkins Guide

The document is a comprehensive guide on Jenkins, an open-source automation tool for Continuous Integration and Continuous Deployment. It covers installation steps for Ubuntu/Debian, setting up Jenkins, creating Freestyle jobs, configuring CI/CD pipelines, and running Jenkins in a Docker container, along with best practices for effective usage. Key features include extensive plugin support, scalability, and integration with various tools like Git and Docker.

Uploaded by

ksrivenu362
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Complete Jenkins Guide: Installation, Usage & Concepts

By: Kammisetty Srivenu

1. Introduction to Jenkins
Jenkins is an open-source automation tool for Continuous Integration (CI) and Continuous
Deployment (CD). It automates software development, testing, and deployment by integrating
various tools and processes.

Key Features of Jenkins:


- Open-source and widely used
- Supports CI/CD pipelines
- Extensive plugin ecosystem
- Scalable for distributed builds
- Integrates with Git, Docker, Kubernetes, AWS, etc.

2. Installing Jenkins (Step-by-Step)


For Ubuntu/Debian:
1. Update system packages:
```bash
sudo apt update && sudo apt upgrade -y
```
2. Install Java:
```bash
sudo apt install openjdk-11-jdk -y
```
3. Install Jenkins:
```bash
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update && sudo apt install jenkins -y
```
4. Start and enable Jenkins:
```bash
sudo systemctl start jenkins
sudo systemctl enable jenkins
```

3. Setting Up Jenkins
1. Open Jenkins in a browser: `http://localhost:8080`
2. Retrieve the initial setup password:
```bash
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
```
3. Install recommended plugins and create an admin user.
4. Jenkins is now ready for use!

4. Creating a Freestyle Job in Jenkins


1. Open Jenkins dashboard and click 'New Item'.
2. Enter a job name and select 'Freestyle project'.
3. Under 'Source Code Management', select 'Git' and enter the repository URL.
4. Under 'Build Steps', select 'Execute Shell' and enter:
```bash
echo 'Building project...'
mvn clean install
```
5. Click 'Save' and then 'Build Now' to trigger the job.

5. Setting up a Jenkins CI/CD Pipeline


1. Click 'New Item' and select 'Pipeline'.
2. In the 'Pipeline' section, enter the following Jenkinsfile script:
```groovy
pipeline {
agent any
stages {
stage('Clone Repository') {
steps {
git 'https://github.com/your-repo.git'
}
}
stage('Build') {
steps {
sh 'mvn clean install'
}
}
stage('Deploy') {
steps {
echo 'Deploying application...'
}
}
}
}
```
3. Click 'Save' and 'Build Now' to run the pipeline.

6. Running Jenkins in a Docker Container


1. Pull the Jenkins image:
```bash
docker pull jenkins/jenkins:lts
```
2. Run Jenkins in a container:
```bash
docker run -p 8080:8080 -p 50000:50000 --name jenkins -v jenkins_home:/var/jenkins_home
jenkins/jenkins:lts
```
3. Retrieve the Jenkins setup password:
```bash
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword
```

7. Best Practices for Jenkins


- Use Jenkins Pipelines instead of Freestyle jobs.
- Store Jenkinsfiles inside repositories.
- Use Declarative Pipelines for readability.
- Integrate Jenkins with Docker & Kubernetes.
- Set up Jenkins agents (slaves) for parallel builds.
- Implement security best practices (use role-based access control, secrets management, etc.).

You might also like