Javatpoint Logo
Javatpoint Logo

Install Jenkins on Ubuntu

Introduction to Jenkins

Jenkins is a free automation server. It aids in automating the elements of software development associated with building, deploying, testing, and providing continuous delivery and continuous integration. It's a server-based system that executes in servlet containers, including Apache Tomcat.

Jenkins supports several tools of version control, including RTC, ClearCase, Perforce, Mercurial, Git, Subversion, CVS, and AccuRev, and can run sbt, Apache Maven, and Apache Ant-based projects and arbitrary Windows and shell scripts batch commands as well.

Brief History of Jenkins

Originally, the Jenkins project was called Hudson and was retitled in 2011 after a conflict with Oracle. Hudson, the Oracle fork, continued to be integrated for a time back being chargeless to the Eclipse Foundation. Hudson of Oracle is no longer managed and was introduced in February 2017 as obsolete.

Hudson became popular as a better replacement to Cruise Control and many free build-servers around 2007. In May 2008, at the JavaOne conference, Jenkins won the choice award of Duke in the category of Developer Solutions.

  • After the recovery of Oracle's Sun Microsystems in November 2010, an issue occurred in the Hudson community with the infrastructure used, which was developed to encompass the questions on the control and stewardship of Oracle.
  • Discussions took place between Oracle and project contributors. However, there were several agreement areas; a key point was the "Hudson" trademark name after Oracle accused the right of the name and used a trademark in December 2010.
  • A vote call was made to modify the project name to "Jenkins" from "Hudson" on 11 January 2011.
  • The proposal was authorized by a community vote on 29 January 2011, making the Jenkins project.
  • Oracle specified that they wanted to continue the Hudson development on 1 February 2011. Therefore, Hudson and Jenkins continued as two different projects, both accusing another was a fork.
  • In 2011, Kohsuke Kawaguchi, the creator, got an O'Reilly Open Source Award for his performance on the Jenkins/Hudson project.
  • On 20 April 2016, version 2 was enabled by default and published with the Pipeline plugin.
  • The plugin permits to write build procedures with a language which is domain-specific and Apache Groovy-based.
  • Jenkins substituted Hudson since 8 February 2017 in Eclipse.
  • For Kubernetes, the Jenkins X software program was publicly granted in March 2018, with support from several cloud providers, such as AWS EKS, among others.

Jenkins builds

Builds can be encountered by several means, including:

  • Required by another build
  • After another build within the queue have built
  • Requesting a particular build URL
  • Scheduling by a cron-like method
  • A webhook that encountered under pushed commits within a version control system

Jenkins Plugins

  • Mailer: It permits us to configure email messages for build outcomes. Jenkins will provide email for the named recipients if a certain essential event appears, like:
    • Unstable build.
    • Failed build.
    • Unstable build, later a successful one, showing that there is a regression.
    • Successful build, later a failed build, showing that a disaster is over.
  • Inspecting external jobs: These add the capability to inspect the outcome of executed jobs externally.
  • Credentials: Credentials permit saving credentials within Jenkins. They offer a standardized API for another plugin to save and fetch different kinds of credentials.
  • SSH agents: It permits maintaining agents executing on nix machines on SSH. It includes a new agent launch mechanism. This launch mechanism will:
    • Initiate the agent process.
    • It copies agent.jar by SFTP when it has a compatible Java version.
    • Find the default Java version for the user.
    • Launch the SSH connection to the named host as the named username.
  • Online explanation: To schedule and inspect the execution of a shell script by user interface rather than the command prompt, Jenkins can efficiently be used.
  • Javadoc: It supports Javadoc for Jenkins. This process used to be an element of the core, although as of the 1.431 version of Jenkins, it was divided into different plugins. It enables the "Publish Javadoc" selection due to a post-build operation, naming the directory in which the Javadoc is to be collected and if confinement is expected for all successful builds.

Jenkins security

The security of Jenkins relies on two different factors: protection and access control from outside threats. Protection from outside threats, including malicious builds and CSRF attacks, is supported. Access control can be tailored in two ways: user authorization and authentication.

Installing Jenkins on Ubuntu

Before moving on to installing the packages on the server, our system package manager must be updated. Use the following command to ensure your system package manager is up to date:

Install Java

Since Jenkins is written in Java, the first step is to install Java. Install the Java 8 OpenJDK package with the following command:

The current version of Jenkins doesn't support Java 10 or more yet. If you have multiple java versions installed on your system then make sure java 8 is the default java version.

To check the version of java on your system, use the following command:

Add the Jenkins Debian Repository

Import the GPG (GnuPG - GNU Privacy Guard) keys of the Jenkins repository using the following wget command:

The output of the above command should OK which means that the key has been successfully imported and packages from this repository will be considered trusted.

Now, add the Jenkins repository to the system with the following command:

Install Jenkins

Once the Jenkins repository is enabled and keys and sources are added, update the apt package list:

Now, install the latest version of Jenkins by using the following command:

Once the installation is completed, Jenkins service will start automatically.

We can verify it with the help of following command:

We should see something like this:

Adjusting Firewall

If you are installing Jenkins on a remote server of Ubuntu that is protected by a firewall, you will need to open port 8080. Consider that you are using UFW to manage your firewall; you can open the port with the following command:

Verify the change with the following command:

Output will look like this:

Status: active

To               Action          From
--               ------          ----
OpenSSH          ALLOW          Anywhere
8080             ALLOW          Anywhere
OpenSSH (v6)     ALLOW          Anywhere (v6)
8080 (v6)        ALLOW          Anywhere (v6)

Setting Up Jenkins

To set up the new Jenkins installation, open the browser, type the domain or IP address followed by port 8080, http://your_ip_or_domain:8080, and screen (unlock Jenkins screen) similar to the following will be displayed:

Installing Jenkins on Ubuntu

In the terminal, type the following cat command to see the password:

Copy the password from the terminal and paste it into the "Administrator password" field and then click continue. Now, the screen presents the option of installing suggested plugins or selecting specific plugins:

Installing Jenkins on Ubuntu

After the installation of plugins, it's time to create an admin account to login to Jenkins:

Installing Jenkins on Ubuntu

Fill the required fields and click on save and finish button.

Installing Jenkins on Ubuntu

We have successfully setup Jenkins and now Jenkins server is ready for use.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA