In this article, we will have explained the necessary steps to install and configure Jenkins on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Jenkins is an open-source continuous integration (CI) and continuous delivery (CD) tool built in Java. Jenkins basically builds, tests, and deploys software projects.
Jenkins is written in the JAVA language and currently focuses on two main purposes:
- Building and testing software projects, just like Cruise Control or Damage Control. Jenkins provides an easy-to-use continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated, continuous build increases productivity.
- Monitoring executions of externally-run jobs, such as cron jobs, even those that are run on a remote machine. Jenkins keeps those outputs and makes it easy for you to notice when something is wrong.
Install Jenkins on Ubuntu
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade
Step 2. Install Java.
Since Jenkins is a Java application, the first step is to install Java. Update the package index and install the Java 8 OpenJDK package with the following commands:
sudo apt update sudo apt install openjdk-8-jdk
After installing Java you can verify it by running the following command:
Step 3. Install Jenkins on Ubuntu.
Jenkins is not available in the official Ubuntu repositories. You will need to add Jenkins’ repository before being able to install it:
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'
We can now install and configure Jenkins on our Ubuntu server:
sudo apt update sudo apt install jenkins
After the installation process is completed, start the Jenkins service with:
sudo systemctl start jenkins sudo systemctl enable jenkins
Step 4. Adjusting Firewall for Jenkins.
In order to allow visitors access to Jenkins, you need to allow inbound traffic on port 8080:
sudo ufw allow 8080
Step 4. Accessing Jenkins.
For start setting up our Jenkins, we need to visit its web dashboard running on port 8080. so open your browser and see your public IP address or your Domain name followed by the port number through it:
When you first access a new Jenkins instance, you are asked to unlock it using an automatically generated password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You should see an 32 character long alphanumeric password:
Copy the password from your terminal, paste it into the Administrator password field and click Continue:
Next, click on the Install suggested plugins box, and the installation process will start immediately:
Once the installation is complete, you will be prompted to set up the first administrative user.
That’s all you need to do to install Jenkins on Ubuntu 18.04. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.