Bobcares

Install Jenkins in Centos 7 in Digitalocean

by | Jun 1, 2022

Install Jenkins in Centos 7 in the Digitalocean enables automated integration and external build monitoring.

Bobcares responds to all questions, big or small, as part of our Digitalocean managed service.

Let’s take a look at how our Support team assisted one of our customers in installing Jenkins in Centos 7 in Digitalocean.

Install Jenkins in Centos 7 in Digitalocean

Jenkins is primarily a continuous integration solution. It serves as the project’s operational headquarters. It can keep track of, regulate, compare, merge, and maintain all aspects of our project. Jenkins is primarily used for two purposes: automated integration and external build monitoring.

This means it can greatly simplify the process of keeping our code maintainable while also keeping a close and unwavering eye on the quality of our builds. Thus ensuring we don’t get any unpleasant surprises when a few of our developers merge their code before it’s ready.

Prerequisites

We’ll need the following items to complete this tutorial:

  • Droplet running CentOS 7
  • sudo privileges for a non-root user

We should execute all commands as a non-root user. Add sudo to the command if it requires root access.

Step 1: Install Jenkins

We can install Jenkins on CentOS in two ways: via a repository, or repo, or via a WAR file. The preferred method is to install from a repository, which is what we’ll go over first.

To run Jenkins (either method), we’ll need Java, so if our server doesn’t already have it, install it with:

sudo yum -y install java

In general, if we require a service or tool but are unsure which package provides it, we can always run:

yum whatprovides service

Where service is the name of the required service or tool.

Installing from a repo
  1. Firstly, execute the following commands to download Jenkins from the Red Hat repository:

    sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

  2. Then, using the package manager RPM, import the verification key:

    sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

  3. Finally, run the following command to install Jenkins:

    sudo yum install jenkins

  4. That’s all! Jenkins should now be available as a service:

    sudo systemctl start jenkins.service

  5. We can check the status of the service after it has begun:

    sudo systemctl status jenkins.service

This indicates that the Jenkins services have completed their startup and are operational. We can confirm this by returning to the web interface at http://ip-of-our-machine:8080.

install jenkins centos 7 digitalocean

Step 2: Users’ Creation

  1. Firstly, go back to the Jenkins interface in the browser (http://ip-of-our-machine:8080) once our service is up and running.
  2. Then select Manage Jenkins from the left-hand menu.
  3. This will take us to a page with a variety of customization options.
  4. We might also notice a warning at the top: Jenkins is not secured, so anyone on the network can launch processes on our behalf. Consider enabling authentication at the very least to prevent abuse. Jenkins has given us instructions to add some level of security to our system.
  5. Then, near the top of the list of links on the manage Jenkins page, go to Configure Global Security.
  6. To bring up a group of options for this purpose, check the option box for Enable security.
  7. Then, select Jenkins’ own user database from the Access Control section that appeared after we flagged the checkbox.
  8. Deselect the Allow users to sign up checkbox. Only administrators will be able to create new accounts as a result of this.
  9. Then, select the Matrix-based security option under Authorization.
  10. We’ll see that there’s already a user named Anonymous. An anonymous user can be anyone from anywhere, even if they aren’t logged in, which is why they have no abilities by default.
  11. Then, to select all permissions, click the small button to the right of the Anonymous row.
  12. Finally, use the User/group to add input field to specify a new user for whom we should add the permissions.
  13. Press Add after entering a username. As with the anonymous user, grant all permissions to the new user. In essence, this creates a new administrator.
  14. Then, Press Apply and then Save.
  15. We’ll be automatically redirected to a signup page where we can create a new account.
  16. Then, Scroll down to the security matrix on the security page (Manage Jenkins -> Configure Global Security).
  17. Finally, we can restrict the permissions of the anonymous user now that we’ve created an administrative user. Click Apply and Save after deselecting all of the permissions in the anonymous row.

Step 3: Create Additional user’s

  1. Firstly, Return to the Manage Jenkins page.
  2. Then, near the bottom of the page, click Manage Users.
  3. A sidebar with links will be found on the left. Select Create User from the drop-down menu.
  4. Then, in the same way that we created the first user, enter the information for the new user.
  5. After that, click Sign up.
  6. Then, we’ll be taken to the user list, which will now include the new user.
  7. We’ll have to repeat the permissions process because this user will have no permissions.
  8. Go to Global Security Configuration.
  9. Then specify permissions using the User/group to add field to add a row to the matrix.
  10. Finally, click Save and Apply.

If we have multiple users to create, create them all before adding permissions for the sake of simplicity.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, our Support team demonstrated how to set up Jenkins in Digitalocean using Centos 7.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.