Jenkins 2.0 has lots of great functionalities that will make the CI pipeline really smooth. One such example is the DSL based build pipeline. In this guide, we will walk you through the steps for installing and configuring Jenkins on a ubuntu server.
Install and Configure Jenkins
Follow the steps given below to install and configure Jenkins 2 on a ubuntu server.
Note: Centos/Rehat users follow this tutorial Install jenkins on centos/Redhat
Step 1: Log in to the server and update it.
sudo apt-get -y update
Step 2: Install open JDK 11.
sudo apt install openjdk-11-jdk -y
Step 3: Add the Jenkins Debian repo.
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Step 4: Update the packages
sudo apt-get update -y
Step 5: Install latest LTS Jenkins.
sudo apt-get install jenkins -y
Step 6: Start the Jenkins service & enable it for starting during bootup.
sudo systemctl start jenkins sudo systemctl enable jenkins
You can check the status of Jenkins service using the following command.
sudo systemctl status jenkins
Step 7: Now you will be able to access the Jenkins server on port 8080 from localhost or using the IP address as shown below.
Step 8: As you can see in the above image, you need to provide the administrative password. You can get the password using the following command.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and click continue.
Step 9: Next, you will be asked to configure plugins as shown below. Select “Install Suggested Plugins” option. This will install all the required plugins for building your projects. It will take few minutes to install the plugins.
Step 10: Once installed, You need to create a user with password and click “save and finish”
Click “Start Using Jenkins” and it will take you to the Jenkins Dashboard. Log in using the username and password that you have given in step 8.
That’s it! Now you have a fully functional Jenkins 2.0 server up and running. Next, would be the configuration of a distributed setup wherein you will have an active master and slaves for building the projects.
If you are a docker user, you can Configure Jenkins using the following commands.
docker run -p 8080:8080 -p 50000:50000 --name jenkins jenkinsci/jenkins:2.0-rc-1