Jenkins and How to Install it on Ubuntu

Introduction:

Jenkins is a free and open-source automation server that helps with continuous integration and delivery (CI/CD) in software development. It automates tasks like building, testing, and deploying applications. In this blog, we'll explore what Jenkins is all about and guide you through installing it on your Ubuntu machine.

What is Jenkins?

Jenkins is a tool that automates various tasks in the software development process. It allows developers to integrate their code changes frequently and catch any issues early on. Jenkins is written in Java and has a large collection of plugins that make it customizable and adaptable to different projects.

Key Features of Jenkins:

  1. Continuous Integration: Jenkins allows developers to integrate their code changes regularly into a shared repository. It automates the process of building and testing the code and notifies the team of any failures or problems.

  2. Distributed Builds: Jenkins can distribute build tasks across multiple machines, making the build process faster and more efficient. It helps utilize resources effectively.

  3. Extensibility: Jenkins has a wide range of plugins that enhance its functionality. These plugins integrate Jenkins with other tools like version control systems, build tools, and testing frameworks.

  4. Easy Configuration: Jenkins provides a web-based interface that makes it easy to set up and manage projects. It allows users to define build steps, trigger conditions, and post-build actions without much hassle.

  5. Scalability: Jenkins can handle large projects by adding more nodes to distribute the building workload. It ensures that builds run smoothly, even in projects with high demands.

Installation of Jenkins on Ubuntu:

Step 1: Update System Packages Before installing Jenkins, it's a good idea to update your system's packages. Open a terminal and run the following commands:

sudo apt update

sudo apt upgrade

Step 2: Install Java Development Kit (JDK) Jenkins requires Java to run. Install OpenJDK by running the following command:

sudo apt install openjdk-8-jdk

Step 3: Add Jenkins Repository To install Jenkins, we need to add its repository key and source list. Run the following commands:

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'

Step 4: Install Jenkins Now, let's install Jenkins using the following commands:

sudo apt update

sudo apt install jenkins

Step 5: Start and Enable Jenkins Jenkins will start automatically after the installation. You can check its status using the following command:

sudo systemctl status jenkins

By default, Jenkins runs on port 8080. Open a web browser and enter http://localhost:8080 or http://your_server_ip:8080 to access the Jenkins dashboard.

Step 6: Unlock Jenkins During the first run, Jenkins requires an administrator password. Retrieve it by running the following command:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the password and paste it into the Jenkins setup wizard.

Step 7: Customize Jenkins The setup wizard will give you options to choose and install suggested plugins or manually select specific plugins. Once the plugins are installed, create the first admin user and configure the Jenkins URL.

Conclusion:

Jenkins is a powerful automation server that simplifies the continuous integration and delivery process in software development. By following the installation steps mentioned in this blog, you can easily set up Jenkins on your Ubuntu machine. Enjoy automating your development workflow with Jenkins!