How To Install Jenkins on Linux Cloud
In this tutorial we are going to discuss how to install Jenkins on Linux Cloud Server by adding its Debian package repository.
1st Step: Installing Jenkins
The versions of Jenkins included with the default Ubuntu bundles is regularly behind the most recent accessible form from the project itself. In order to take benefits of most recent fixes and highlights, we are going to use the project-maintained package to install Jenkins on our Linux Cloud server.
Now we are going to add the repository key to the system.
$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
At the point when the key is included, the system will revert with OK status. Next, we'll annex the Debian bundle repository address to the Ubuntu Cloud server's sources.list:
$ echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
At the point when both of these are set up, we will run updatewith the goal that apt-get will utilize the new repository:
$ sudo apt-get update
At last, we will install Jenkins and its dependencies, containing Java:
$ sudo apt-get install jenkins
Since Jenkins and its dependencies are set up, we'll begin the Jenkins server.
2nd Step: Starting Jenkins
Utilizing systemctl we'll begin Jenkins:
sudo systemctl start jenkins
Since systemctl does not show any output, we will utilize its status command to confirm that it began effectively:
$ sudo systemctl status jenkins
In the case of everything went well, the start of the output should demonstrate that the administration is active and configured to begin at boot:
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
Active:active (exited) since Wed 2018-05-29 10:51:13 UTC; 21min 27s ago
Since Jenkins is functioning, we will modify our firewall rules with the goal that we can achieve Jenkins from a web rules to finish the underlying set up.
3rd Step: Opening the Firewall
By default Jenkins use 8080 port number to run, so we will open that port utilizing ufw:
$ sudo ufw allow 8080
We can check the new rules by checking UFW's status.
$ sudo ufw status
Now we should see that traffic is permitted to port 8080 from anywhere:
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
8080 ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
Since Jenkins is installed and the firewall enables us to get to it, we can finish the underlying setup.
4th Step: Setting up Jenkins
To set up our installation, we will visit Jenkins on its default port, 8080, utilizing the server space name or IP address: http://ip_address_or_website_domain_name:8080
We should see "Unlock Jenkins" screen, which shows the area of the underlying password.
In the terminal screen, we'll utilize the cat command to show the password:
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
We will copy the 32-character alphanumeric password from the terminal and paste it into the "Administrator password" area, at that point click "Continue". The following screen displays the alternative of installing recommended modules or choosing particular modules.
We will hit the "Install suggested plugins" alternative, which will quickly start the installation procedure:
At the point when the installation is finished, we will be incited to set up the primary administrative user. It's conceivable to step this progression and proceed as administrator utilizing the underlying password we utilized above, yet we'll pause for a minute to make the user.
Once the main administrator user is set up, you should see a "Jenkins is ready!" confirmation window.
Hit "Start using Jenkins" to visit the primary Jenkins dashboard:
Now, Jenkins has been effectively installed.