How to install a plugin in Jenkins manually

JenkinsJenkins Plugins

Jenkins Problem Overview


Installing a plugin from the Update center results in:

> Checking internet connectivity Failed to connect to > http://www.google.com/. Perhaps you need to configure HTTP proxy? Deploy Plugin Failure - Details hudson.util.IOException2: Failed to download from > http://updates.jenkins-ci.org/download/plugins/deploy/1.9/deploy.hpi

Is it possible to download the plugin and install it manually into Jenkins?

Jenkins Solutions


Solution 1 - Jenkins

Yes, you can. Download the plugin (*.hpi file) and put it in the following directory:

<jenkinsHome>/plugins/

Afterwards you will need to restart Jenkins.

Solution 2 - Jenkins

  1. Download the plugin.
  2. Inside Jenkins: Manage JenkinsManage Plugins → There is a tab called Advanced and on that page there is an option to upload a plugin (the extension of the file must be hpi).

Sometimes, when you download plugins you may get (.zip) files then just rename with (.hpi) and use the UI to install the plugin.

Solution 3 - Jenkins

If you use Docker, you should read this file: https://github.com/cloudbees/jenkins-ci.org-docker/blob/master/plugins.sh

Example of a parent Dockerfile:

FROM jenkins
COPY plugins.txt /plugins.txt
RUN /usr/local/bin/plugins.sh /plugins.txt

plugins.txt

<name>:<version>
<name2>:<version2>

Solution 4 - Jenkins

I have created a simple script that does the following:

  • Download one or more plugins to the plugin directory
  • Scan all plugins in that directory for missing dependencies
  • download this dependencies as well
  • loop until no open dependencies are left

The script requires no running jenkins - I use it to provision a docker box.

https://gist.github.com/micw/e80d739c6099078ce0f3

Solution 5 - Jenkins

Sometimes when you download plugins you may get (.zip) files then just rename with (.hpi) and then extract all the plugins and move to <jenkinsHome>/plugins/ directory.

Solution 6 - Jenkins

Update for Docker: use the install-plugins.sh script. It takes a list of plugin names minus the '-plugin' extension. See the description here.

install-plugins.sh replaces the deprecated plugins.sh which now warns :

WARN: plugins.sh is deprecated, please switch to install-plugins.sh

To use a plugins.txt as per plugins.sh see this issue and this workaround:

RUN /usr/local/bin/install-plugins.sh $(cat /usr/share/jenkins/plugins.txt | tr '\n' ' ')

Solution 7 - Jenkins

Use https://updates.jenkins-ci.org/download/plugins/. Download it from this central update repository for Jenkins.

Solution 8 - Jenkins

The accepted answer is accurate, but make sure that you also install all necessary dependencies as well. Installing using the CLI or web seems to take care of this, but my plugins were not showing up in the browser or using java -jar jenkins-cli.jar -s http://localhost:8080 list-plugins until I also installed the dependencies.

Solution 9 - Jenkins

The answers given work, with added plugins.

If you want to replace/update a built-in plugin like the credentials plugin, that has dependencies, then you have to use the frontend. To automate I use:

 curl -i -F file=@pluginfilename.hpi http://jenkinshost/jenkins/pluginManager/uploadPlugin

Solution 10 - Jenkins

In my case, I needed to install a plugin to an offline build server that's running a Windows Server (version won't matter here). I already installed Jenkins on my laptop to test out changes in advance and it is running on localhost:8080 as a windows service.

So if you are willing to take the time to setup Jenkins on a machine with Internet connection and carry these changes to the offline server Jenkins (it works, confirmed by me!), these are steps you could follow:

  • Jenkins on my laptop: Open up Jenkins, http://localhost:8080
  • Navigator: Manage Jenkins | Download plugin without install option
  • Windows Explorer: Copy the downloaded plugin file that is located at "c:\program files (x86)\Jenkins\plugins" folder (i.e. role-strategy.jpi)
  • Paste it into a shared folder in the offline server
  • Stop the Jenkins Service (Offline Server Jenkins) through Component Services, Jenkins Service
  • Copy the plugin file (i.e. role-strategy.jpi) into "c:\program files (x86)\Jenkins\plugins" folder on the (Offline Jenkins) server
  • Restart Jenkins and voila! It should be installed.

Solution 11 - Jenkins

This is a way to copy plugins from one Jenkins box to another.

Copy over the plugins directory:

scp -r jenkins-box.url.com:/var/lib/jenkins/plugins .

Compress the plugins:

tar cvfJ plugins.tar.xz plugins

Copy them over to the other Jenkins box:

scp plugins.tar.xz different-jenkins-box.url.com
ssh different-jenkins-box.url.com "tar xvfJ plugins.tar.xz -C /var/lib/jenkins"

Restart Jenkins.

Solution 12 - Jenkins

To install plugin "git" with all its dependencies:

curl -XPOST http://localhost:8080/pluginManager/installNecessaryPlugins -d '<install plugin="git@current" />'

Here, the plugin installed is git ; the version, specified as @current is ignored by Jenkins. Jenkins is running on localhost port 8080, change this as needed. As far as I know, this is the simplest way to install a plugin with all its dependencies 'by hand'. Tested on Jenkins v1.644

Solution 13 - Jenkins

RUN /usr/local/bin/install-plugins.sh amazon-ecs:1.37 configuration-as-code:1.47 workflow-aggregator:2.6 \
cloudbees-folder:6.15 antisamy-markup-formatter:2.1 build-timeout:1.20 credentials-binding:1.24 

Cat out the plugins.txt and install in Dockerfile as above.

Solution 14 - Jenkins

use this link to download the lastest version of the plugins' hpi. https://updates.jenkins-ci.org/download/plugins/

Then upload the plugin through 'manage plugin' in Jenkins

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKishore TamireView Question on Stackoverflow
Solution 1 - JenkinsMichael KüllerView Answer on Stackoverflow
Solution 2 - JenkinsjfcorugedoView Answer on Stackoverflow
Solution 3 - JenkinsSergioArcosView Answer on Stackoverflow
Solution 4 - JenkinsMichael WyrazView Answer on Stackoverflow
Solution 5 - JenkinsDnyaneshwar KalmeView Answer on Stackoverflow
Solution 6 - JenkinssatolizardView Answer on Stackoverflow
Solution 7 - JenkinsraikumardipakView Answer on Stackoverflow
Solution 8 - JenkinsjdfView Answer on Stackoverflow
Solution 9 - JenkinsbbaassssiieeView Answer on Stackoverflow
Solution 10 - JenkinsyyardimView Answer on Stackoverflow
Solution 11 - JenkinsjmunschView Answer on Stackoverflow
Solution 12 - Jenkinsm.kocikowskiView Answer on Stackoverflow
Solution 13 - JenkinsddtravellerView Answer on Stackoverflow
Solution 14 - Jenkinsfloki91View Answer on Stackoverflow