Jenkins is an open source continuous integration (CI) and continuous delivery (CD) tool built in Java. Jenkins basically builds, tests and deploy software projects. It’s one of the most useful development tools you can master, that’s why today we’ll show you how to install Jenkins on Ubuntu 18.04. Empower your VPS server with this powerful tool!
Jenkins is loved by teams of different sizes, for projects with various languages such as Java, Ruby, Dot Net, PHP, etc. Jenkins is an independent platform, which means you can use it on Windows, Linux or any other operating system.
Why Use Jenkins?
In order to understand Jenkins, you must have an understanding of Continuous Integration (CI) and Continuous Delivery (CD):
- Continuous Integration – the practice of constantly merging development work with the main branch.
- Continuous Delivery – is continual delivery of code to an environment once the code is ready to ship. This could be to staging or production. The product is delivered to a user base, which can be QAs or customers for review and inspection.
Developers regularly update the code in the shared repository (such as GitHub or TFS). In nightly builds, changes made in the source code throughout the day are built together at the end of the day, making it hard to find the errors. This is where Jenkins comes in
As soon as a developer commits any change to the shared repository, Jenkins will immediately trigger a build, and in case of an error, immediately notify (Continuous Integration CI).
With Jenkins, we can also set post-build tests (unit test, performance test, acceptance test) in an automated manner. Whenever there is a successful build, Jenkins will perform these tests and generate a report (Continuous Delivery CD).
Why is Jenkins Popular?
- Easy to Use – the user interface is simple, intuitive and visually appealing
- Great extensibility – Jenkins is extremely flexible and easy to adapt to your preferences. There are thousands of open source plugins available for Jenkins with different functionalities
With Jenkins you get support for different version control systems, code quality metrics, build notifiers, UI customization, and more!
How to Install Jenkins on Ubuntu 18.04
Now it’s time to learn how you can start using Jenkins on your Ubuntu 18.04 machine or server:
1. Access Your VPS
Access your VPS using SSH. If you’re having trouble, check out our PuTTY tutorial!
2. Install JDK
The first Jenkins prerequisite is JDK. The following command will install JDK and JRE:
sudo apt-get install openjdk-8-jdk
3. Install a Web Server
The next thing you need is a Web server like Apache or Nginx. You can install any Web server of your choice. For this tutorial we’ll use Nginx. To install Nginx on your VPS, execute the following command in the command line:
sudo apt-get install nginx
Make sure Nginx is up and running on your Ubuntu based machine by typing in your server’s IP in your web browser and hitting enter. You should be greeted by the Nginx welcome screen.
4. Install Jenkins
Next we will install Jenkins. Issue the following four commands in sequence to install Jenkins on Ubuntu:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.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-get update
sudo apt-get install jenkins
5. Type in the Administrator Password
By default Jenkins will run on port 8080. To start Jenkins type in the IP of your VPS and the port number 8080. It would look something like this in your browser – 188.8.131.52:8080.
You will be asked to enter the administrator password. You can find the password in the /var/lib/jenkins/secrets/initialAdminPassword file. You can use the cat command to display the password:
Copy the password to the Administrator password field and press enter.
6. Customize Jenkins
Next, you will see following screen, where we recommend you install the suggested plugins.
7. Set the Admin Username and Password for Jenkins
Next, you can set username and password on following screen. After that you will be taken to the Jenkins dashboard, where you can begin working!
It’s really that simple to install Jenkins on Ubuntu. Jenkins as a whole has a low learning curve and, meaning you can start working with it as soon as possible. We hope this tutorial helps improve the development of your project! Good luck!