Installation Guide to Jenkins

Read it in 10 Mins

Last updated on
07th Jun, 2022
Published
25th Sep, 2019
Views
9,834
Installation Guide to Jenkins

Jenkins is a Java-based open-source automation tool with plugins designed for ongoing integration. Jenkins is used to constantly develop and test software projects that help developers to incorporate project modifications and make it simpler for users to achieve a new build. The Jenkins allows developers to quickly locate and resolve flaws in a code base and to automatically test their structures. Jenkins can be changed and expanded readily on all operating platforms and various devices, whether OS X, Windows or Linux.  It immediately deploys code, produces test reports. During integration and continuous delivery, Jenkins can be configured according to the demands.

Also, read more about how to Install Jenkins on Ubuntu.

Jenkins can be configuration

System Requirements for Jenkins Installation

Following are the software and hardware requirements for installing Jenkins:

Minimum hardware requirements:

  • 256 MB of RAM
  • 1 GB of drive space (although 10 GB is a recommended minimum if running Jenkins as a Docker container)

Recommended hardware configuration for a small team:

  • 1 GB+ of RAM
  • 50 GB+ of drive space

Installation on Windows

You must first install JDK. Jenkins promotes JDK8 only at this time. Jenkins can be installed when Java is running. The recent Jenkins package for Windows (presently version 2.191) can be downloaded. Click on the Jenkins exe file to unzip the file into a folder.

Jenkins Installation on Windows

To begin the installation click on "Next."

Jenkins Installation on Windows

To install Jenkins in another directory, click the "Change..." button. I'll hold the default choice in this instance and click on "Next."

Jenkins in another directory

To begin the installation process, click on the "Install" button.

Jenkins Installation on Windows

The installation is being processed.

The installation in Jenkins

When finished, you can finish the setup by clicking the "Finish" button.

Completed the jenkins steps

The URL http:/localhost:8080 will automatically be redirected to a Jenkins local page or the browser can be pasted.

Unlock jenkins

Copy and paste the password from the C:\Program Files (x85)\Jenkins\secrets\initialAdminPassword file for Jenkins unlocking. Click on the button "Continue."

Unlock jenkins

The suggested plugins or chosen plugins that you select can be installed. We will install the suggested plugins to maintain it easy.

Customize Jenkins

Wait for the complete installation of plugins.

Started window of jenkins

The next step is to build a Jenkins admin user. Click "Save and Continue." Please enter your information.

Create first admin user in jenkins

To finish the Jenkins setup, click on "Save and Finish."

Instance configuration Jenkins

To begin Jenkins, click on "Start using Jenkins."

Jenkins Ready window

Below is the default page of Jenkins.

Welcome window of jenkins

Jenkins Installation on Linux/CentOS 7 system

Make sure that you are signed in as a user with sudo privileges before continuing this tutorial.

  • The first step is to install Java, Jenkins being a Java application. To set up OpenJDK 8 package, execute the following command:
$ sudo yum install java-1.8.0-openjdk-devel

Jenkins does not currently support Java 10 (and Java 11). Make sure that Java 8 is the default Java version when multiple Java versions are installed on your computer.

  • The next step is to allow the repository of Jenkins. To do so, use the following curl command to import the GPG key:
$ curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo

Add your system's repository with:

$ sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  • Upon activation of the repository, install the recent stable Jenkins version by typing:
$ sudo yum install jenkins
  • Upon completion of the installation, begin the Jenkins service with:
$ sudo systemctl start jenkins
  • To verify if it has been successful, check with below command:
$ systemctl status jenkins
  • Something like this you should see:

Output

jenkins.service - LSB: Jenkins Automation Server

Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)

Active: active (running) since Thu 2018-09-20 14:58:21 UTC; 15s ago

Docs: man:systemd-sysv-generator(8)

Process: 2367 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)

CGroup: /system.slice/jenkins.service

  • Finally, allow the Jenkins service to start on system boot 
$ sudo systemctl enable jenkins

Output

jenkins.service is not a native service, redirecting to /sbin/chkconfig.

Executing /sbin/chkconfig jenkins on

Opening Firewall port

If you install Jenkins on a remote CentOS firewall-protected server, port 8080 is necessary. To open   the required port, use the following instructions:

$ sudo firewall-cmd --permanent --zone=public --add-port=8080/tcpsudo firewall-cmd --reload

Setting Jenkins

Open your browser and type in your domain or IP address followed by port 8080 in order to set your fresh Jenkins setup:

http://your_ip_or_domain:8080

Below screen will be displayed which prompts you to enter the admin password generated during setup:

Setting Jenkins

To print the password on your terminal, use the following instructions:

 $ sudo cat /var/lib/jenkins/secrets/initialAdminPassword

The alphanumeric password should be 32 characters long, as shown below:

Output 

3226*****************************

Copy your terminal password, paste it in the password field for the Administrator and click on Continue.

Costomize Jenkins

On the next screen, you are asked if you would like to install or pick certain plugins. To begin the installation process instantly, just click on the Install suggested plug-ins box.

Started window of Jenkins

When the installation is finished, the first administrative user is prompted for the setting. Fill in all the necessary data. and click the Save and Continue.

Creating first admin user in Jenkins

On your next page, the URL for the Jenkins instance will be requested. An automatically produced URL will be added to the URL field.

Instance configuration in Jenkins

To finish the configuration, click the Save and Finish button to verify the setup.

Window of Jenkins is ready

Finally,  click start using  Jenkins Button to start the process and the user we created in one of the past steps as admin user will log in Jenkins dashboard.

Jenkins welcome window

You have effectively mounted Jenkins on your CentOS scheme when you have reached this point.

Jenkins Installation on Mac

Prerequisite

  • A Mac machine with Mac OSX Yosemite or higher with admin access
  • Installation of Java Development Kit on the machine.
  • Access to Git, Svn, etc. remote repository.

Download Jenkins installer.pkg file from Jenkins ' official website and get through the wizard setup.

Jenkins official website and get through the wizard setup

The jenkins setup wizard sets up a distinct Jenkins user on your system.We need to make some changes in the ‘Users & Groups’ section as well. Do follow below steps.

  • Open ‘System Preferences -> Users & Groups’
  • Click on the Lock icon located in the bottom left corner which reads, ‘Click the lock to make changes’. Enter your login password.
  • Under the ‘Other Users’ section you may see the user without any name but with admin rights. This is our Jenkins user. Let's rename it.
  • Right-click the empty user and select Advanced Options. This will show you all the details. Give the ‘Full name’ as Jenkins. Press OK
  • Click on ‘Reset Password’. Enter a new password and make sure that you remember this.

Now our Jenkins user is almost ready.This is just like another mac user with admin rights.Now restart your Mac machine and log in with Jenkins user with the password which you just reset.

Click the lock to save the changes and restart the system to login with Jenkins user account.

In localhost Jenkins resides at port 8080.

Open your browser, go to localhost:8080 and make the original set-up, which consists of installing some plugins and creating account for safety purpose.

Welcome to Jenkins

Setting Jenkins as Launch agent

  • Jenkins operates by default as a daemon. A daemon is a non-interactive background that operates in the entire scheme and is not linked to a particular user.
  • Much of CI runs simulators and other GUI apps, so another option is required. You can modify Jenkins as a launch agent to resolve this. On behalf of the user, a launch agent operates behind the scenes.
  • You need to edit the settings folder and alter your place to begin rebooting automatically if you want to alter how the Jenkins process is started.
  • Enter the below command to unload Jenkins as a Daemon
    sudolaunchctlunload/Library/LaunchDaemons/org.jenkins-ci.plist
  • Next, migrate to the LaunchAgents folder the.plist file which defines how Jenkins will be running.
    sudo mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/
  • Start the jenkins again and now it will run as launch agent.
Profile

Ashish Kumar

Senior Technology Specialist

Ashish is working as a Senior Technology Specialist in leading financial bank has more than 13 years of experience in developing enterprise applications