Install jenkins on ubuntu LEARNOVITA

How To Install Jenkins on Ubuntu | Free Guide Tutorial

Last updated on 28th Oct 2022, Artciles, Blog

About author

Buvanesh (Azure DevOps Engineer )

Buvanesh is an Azure DevOps Engineer, and he has tons of experience in the areas of BI and Data Science teams, CI/CD with Git, Jenkins/Azure DevOps, NoSQL Databases, and Data Modeling in Hive, CDH/HDP, CDH or HDP, Spark, Airflow, NiFi, Kafka, Hive, HBase or MongoDB, Neo4J, Elastic Search, Impala, Sqoop, and Hive. He spends his precious time researching various technologies and startups.

(5.0) | 19577 Ratings 2096
    • In this article you will learn:
    • 1. Prerequisites.
    • 2. Why Use Jenkins?
    • 3. Installation Procedure.
    • 4. Uninstall Jenkins.
    • 5. Conclusion.

Prerequisites:

Hardware Requirements:

  • RAM- 4 GB (Recommended) .
  • Storage- more than a 50 GB of Hard Disk Space (Recommended) .

Software Requirements:

Java: Java Development Kit (JDK) or a Java Runtime Environment (JRE).

Web Browser: Any browser like Google Chrome, Mozilla Firefox, Microsoft Edge.

Operating System: An Ubuntu 18.04 server installed with the non-root sudo user and firewall. For help in a planning of production capability of a Jenkins.

Why Use Jenkins?

Need to consider a continuous integration (CI) and continuous delivery (CD) to understand a Jenkins:

Continuous integration – Practice of a continuous production combined with a main industry.

Continuous delivery – A code is constantly delivered to an area after code is ready for delivery. It could be for the production or staging. The commodity is supplied to be consumer base that can provide QA or inspection by a customers. Developers update code regularly in a shared repository (such as GitHub or TFS). Improvements made in source code are made at the end of the day, making it complex to identify the errors. So, Jenkins is used here.

Installation process of Jenkins

Installation Procedure:

Step 1: Install Java

  • Jenkins needs Java for a running, but it doesn’t include the certain distributions by default, and Java versions of Jenkins are incompatible.
  • Multiple Java implementations are be available. OpenJDK is currently the most famous one, which will use in this guide.
  • Being an open-source Java application, Jenkins needs the installation of OpenJDK 8 on a system. The apt repositories can be directly access OpenJDK 8.
  • The installation of a OpenJDK from standard repositories is be recommended:

1.$ sudo apt update

2.$ sudo apt install openjdk-8-jdk

Step 2: Install Jenkins

The default Ubuntu packages for a Jenkins are always behind the current version of a project itself. May use a project-maintained packages to install Jenkins to take advantage of newest patches and features.

1. add a framework repository key.

2. Next, link repository of Debian packages to sources.list of the server.

3. When both are place, upgrade to apt to use a new repository:

  • $ sudo apt update .

4. Install Jenkins:

  • $ sudo apt install jenkins .
  • Now going to start a Jenkins server, as Jenkins and its dependencies are in place.

Step 3: Start Jenkins

1. can start a Jenkins using systemctl:

  • $ sudo systemctl start jenkins .

2. As systemctl does not display the performance, and can use the status command to check that Jenkins has been successfully launched:

  • $ sudo systemctl status jenkins.
 Use Cases of Jenkins

Step 4: Opening a Firewall

1. Jenkins works by a default on port 8080, so let’s open port with ufw:

  • $ sudo ufw allow 8080.

2. Check a ufw’s status:

  • $ sudo ufw status.

3. If the firewall is be inactive, the following commands will allow a OpenSSH and turn it back on:

  • $ sudo ufw allow OpenSSH.
  • $ sudo ufw enable.

Step 5: Setting Up a Jenkins

  • To set up installation, visit Jenkins on its default 8080 port with a server domain name or IP.
  • Can use the cat command to display a password: $ sudo cat /var/lib/jenkins/secrets/initialAdminPassword.
  • Copy alphanumeric terminal 32-character password and paste into an Administrator Password field, then click Continue.
  • We will click on option to install  a proposed plugins to start installation process immediately.
  • When installation is done, the first administrative user will be prompted. And can save this step and use an initial password to continue as an Admin. However, will take some time to create user.
  • Will see a configuration instance page, which asks to confirm a Jenkins instance’s URL of choice. Confirm either server’s domain name or the IP address of server.
  • Click Save and Finish once have confirmed a relevant information. A confirmation page will show that “Jenkins is ready!
  • Hit Start using a Jenkins button and it will take to a Jenkins dashboard.

Step 6: Creation of a New Build Jobs in Jenkins The freestyle job is highly versatile and user-friendly choice. It’s simple to set up and many of its options appear in a many other build jobs. For all projects, can use it. Follow following steps:

Have to login to a Jenkins Dashboard by visiting.

Create New item: Click on New Item on a left-hand side of the dashboard.

Fill project description: Can enter a job details as per your need.

Source Code Management: Under source code management, enter a repository URL.and can also use Local repository.

Build Environment: Click on “Add build Setup” Select “Execute Windows batch command”.

Save project: Click Apply and save project.

Build a Source Code and check its status: Click on “Build Now” on a left-hand side of the screen to create a source code.

Console Output: Select build number and click on “Console Output” to check status of a build run.When it shows a success, it means that have successfully run a HelloWorld program from cGitHub Repository. In case of failure, can check the job logs by clicking on a failure icon and debug a root cause.

Uninstall Jenkins:

  • $ sudo apt-get remove –auto-remove jenkins .
  • Purging data: $ sudo apt-get purge jenkins .
  • or can use: $ sudo apt-get purge –auto-remove jenkins .

Conclusion:

Installing Jenkins on a Ubuntu is really that easy. Jenkins has a low learning curve and so can start to work with it as quickly as possible.

Are you looking training with Right Jobs?

Contact Us

Popular Courses