Linux
How to Install and Use Jenkins for Continuous Integration
Jenkins is a popular open-source automation server used for continuous integration and continuous delivery (CI/CD). It allows developers to automate the building, testing, and deployment of applications, making the development process more efficient.
Step 1: Install Jenkins
On Ubuntu:
sudo apt update
sudo apt install openjdk-11-jre
wget -q -O - https://pkg.jenkins.io/debian/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
On Windows:
- Download the Jenkins Windows Installer from the official Jenkins website.
- Run the installer and follow the setup wizard instructions.
Step 2: Start Jenkins
Ubuntu:
sudo systemctl start jenkins
sudo systemctl enable jenkins
Windows:
- Jenkins starts automatically as a service after installation.
Step 3: Access Jenkins Web Interface
- Open a web browser and go to
http://localhost:8080
. - Retrieve the initial admin password from
/var/lib/jenkins/secrets/initialAdminPassword
.
Step 4: Install Plugins
- Jenkins will prompt you to install recommended plugins during the initial setup.
- You can install additional plugins later from the Jenkins dashboard under
Manage Jenkins > Manage Plugins
.
Step 5: Create a New Job
- Click on
New Item
. - Provide a job name and select a job type (e.g., Freestyle project).
- Configure the job by specifying the build steps and triggers.
Step 6: Run a Build
- Click on
Build Now
to trigger a manual build. - Check the build history and console output to verify the results.
Step 7: Set Up Continuous Integration
- Configure source code management (SCM) like Git under
Build Triggers
. - Enable polling or webhook integration for automatic builds on code changes.
Conclusion
Jenkins is a versatile tool for continuous integration and deployment. By following these steps, you can successfully install and start using Jenkins for automating your software development pipelines.