Posted on Leave a comment

Installing and Setting Up Jenkins CI/CD on Linux Mint

Introduction:

Jenkins is an open-source automation server that helps automate parts of the software development process. With Jenkins, you can set up continuous integration and continuous deployment (CI/CD) for your projects, making it easier to build, test, and deploy applications. This guide will walk you through the process of installing and setting up Jenkins on Linux Mint

Prerequisites:

  • Linux Mint system
  • A user with sudo privileges
  • An internet connection

Step 1: Update Your System

Before installing Jenkins, it’s essential to update your system packages to their latest versions. To do this, 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, so you will need to install the Java Development Kit (JDK). In this guide, we will use OpenJDK 11. Install OpenJDK 11 by running the following command:

sudo apt install openjdk-11-jdk

Verify the installation by checking the Java version:

java -version

Step 3: Add Jenkins Repository

Jenkins provides a dedicated repository for its packages. To add this repository to your system, first, install the necessary dependencies by running:

sudo apt install wget apt-transport-https gnupg

Next, import the GPG key for the Jenkins repository:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo gpg --dearmor -o /usr/share/keyrings/jenkins-archive-keyring.gpg

Now, add the Jenkins repository to your system:

echo "deb [signed-by=/usr/share/keyrings/jenkins-archive-keyring.gpg] https://pkg.jenkins.io/debian binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list

Update the package list to include the Jenkins repository:

sudo apt update

Step 4: Install Jenkins

With the repository added, you can now install Jenkins by running:

sudo apt install jenkins

Step 5: Start and Enable Jenkins Service

Once Jenkins is installed, start the Jenkins service and enable it to run at system startup:

sudo systemctl start jenkins
sudo systemctl enable jenkins

Verify that Jenkins is running:

sudo systemctl status jenkins

Step 6: Configure Firewall ( optional for local install )

If you have a firewall enabled, you will need to allow traffic on port 8080, which is the default port Jenkins listens on. In this guide, we will use the UFW (Uncomplicated Firewall) to configure the firewall. If you don’t have UFW installed, you can install it by running:

sudo apt install ufw

Allow traffic on port 8080:

sudo ufw allow 8080

Step 7: Set Up Jenkins

Access the Jenkins web interface by opening a web browser and navigating to:

http://your_server_ip_or_domain:8080

You will be prompted for an unlock key. Retrieve the key by running:

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

Copy the key and paste it into the web interface. Click “Continue” to proceed with the setup.

You will be presented with two options for plugin installation: “Install suggested plugins” and “Select plugins to install.” Choose the option that best suits your needs.

Create an admin user by providing a username, password, and email address. Click “Save and Continue” to proceed. Review the Jenkins URL and ensure that it is correct. Click “Save and Finish” to complete the setup.

Step 8: Accessing Jenkins Dashboard

You will now be redirected to the Jenkins dashboard. From here, you can create and manage jobs, install plugins, configure system settings, and monitor the status of your builds.

Conclusion:

You have successfully installed and set up Jenkins on Linux Mint 20. You can now start exploring Jenkins features and plugins to create your continuous integration and continuous deployment pipelines. With Jenkins, you can automate your software development processes, making it easier and more efficient to build, test, and deploy applications.

Leave a Reply

Your email address will not be published. Required fields are marked *