You are currently viewing How to install a plugin in Jenkins?

How to install a plugin in Jenkins?

How to install a plugin in Jenkins?

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In today’s blog post, we will discuss what is plugin in Jenkins, where to get plugins for Jenkins and how to install a plugin in Jenkins.

What is a plugin in Jenkins?

Plugin is one or set of additional features that you can add to your Jenkins configuration. If you think Jenkins as your home then plugins will be all the utilities like fridge (to keep food cool), television (entertainment) etc. that you add into your home to get more features. Plugins is the primary means of enhancing the feature of Jenkins and for al most every feature there is a plugin for it (even for git or pipeline there are plugins that you need to install to access those features in Jenkins).

Where to get plugins for Jenkins?

You can add any community or enterprise level plugins to your Jenkins setup or create your own custom plugins. You can get the list of all available plugins in this link. You can even search for all available plugins from within your Jenkins dash board under “Manage Plugins” option.

How to install a plugin in Jenkins?

There are different ways to install a plugin in your Jenkins setup. You can use the Jenkins dash board “Plugin Manager” to search and install a plugin. You can also use Jenkins CLI to install a new plugin or even simply manually copy the plugins file directory to your Jenkins setup. But the best and safe way is to use either Jenkins’s plugin manager if you prefer UI option or open source Jenkins plugin installation manager tool if you want Jenkins plugin manager tool CLI option.

Note: Some plugins might have dependency on other plugins and if you are using copy paste or Jenkins CLI then your need to make sure all those dependencies are already resolved before you attempt to install the plugin manually.

In this blog post, we will look into both the options using Plugin Manager (UI option) and Jenkins Plugin CLI (CLI option) to install a Jenkins plugin.

Prerequisites:

One system with Jenkins installed.

Install Jenkins plugin using plugin manager (UI option):

Step 1: Login to Jenkins dashboard => Click “Manage Jenkins” => Click “Manage Plugins”.

How to install a plugin in Jenkins?

Step 2: Search the plugin name in the “Available” tab, select the plugin and click “Download and install after restart”.

How to install a plugin in Jenkins?

Note: You can also install the new plugin without restart and the main difference between ‘with restart’ and ‘without restart’ plugin installation is that you cannot upgrade or uninstall plugins without restart (because of the architectural choice made in Jenkins).

In this demo we are installing Jenkins Blue Ocean plugin which enhances the Jenkins pipeline user interface. You can choose other plugin as per your requirements.

Jenkins will download the plugin and all its dependencies automatically.

How to install a plugin in Jenkins?

Step 3: Restart Jenkins service.

Option 1: From the plugin manager, select the checkbox “Restart Jenkins when installation is complete and no jobs are running” and Jenkins will automatically restart if its idle.

How to install a plugin in Jenkins?

Option 2: From the Jenkins URL.

To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser):

  • <jenkins_url>/safeRestart – Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
  • <jenkins_url>/restart – Forces a restart without waiting for builds to complete.

How to install a plugin in Jenkins?

Option 3: From command line.

Connect to your Jenkins controller server and execute below Jenkins cli command to restart the Jenkins server.

Install Jenkins plugin using Jenkins plugin installation manager tool (CLI option):

Step 1: Download the latest version of Jenkins plugin manager cli tool.

Step 2: Install a new Jenkins plugin using CLI.

Step 3: Restart the Jenkins controller.

Hope you have enjoyed this article, to get more details on Jenkins, please refer below Jenkins official documentation.

https://www.jenkins.io/doc/

Get details of all publicly available Jenkin plugins

https://plugins.jenkins.io/

Jenkins plugin installation manager tool documentation

https://github.com/jenkinsci/plugin-installation-manager-tool