136

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kishore Tamire
  • 2,054
  • 5
  • 23
  • 25

14 Answers14

172

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

<jenkinsHome>/plugins/

Afterwards you will need to restart Jenkins.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Michael Küller
  • 3,982
  • 4
  • 22
  • 42
  • 8
    This method does not automatically install any plugins that are dependencies of the plugin being installed. As such I do not recommend it and I am down-voting for this reason. Please let me know if I am mistaken and I will undo my down-vote. – Farrukh Najmi Feb 17 '17 at 20:21
  • 11
    If you are forced to install a plugin manually (for whatever reason) I'm not aware of any other method that will take care of automatically installing dependencies as well. – Michael Küller Feb 19 '17 at 13:06
  • How can I find out where the home of jenkins is? By using `whereis jenkins` ? – Black Mar 27 '17 at 06:57
  • 5
    I found it under `/var/lib/jenkins` however, there are already many plugins but they end with `.jpi` instead of `.hpi`. What should I do? – Black Mar 27 '17 at 07:18
  • 3
    Jenkins renames the plugin file during the installation from .hpi to .jpi that way it is able to detect a new plugin to install over an existing one. See here: http://stackoverflow.com/questions/30658375/what-is-difference-between-hpi-and-jpi-of-jenkins-plugins – Michael Küller Mar 29 '17 at 07:37
  • Simply placing the `.hpi` file in the `/var/lib/jenkins/plugins/` directory doesn't appear to be enough or necessarily work. It causes Jenkins (2.138.2) to fill `/var/log/jenkins/jenkins.log` with exceptions complaining the files are not Zip Archives; e.g.: `Caused by: Error while expanding /var/lib/jenkins/plugins/handlebar.hpi java.util.zip.ZipException: archive is not a ZIP archive` – code_dredd Oct 18 '18 at 22:53
  • New command line tool available see https://stackoverflow.com/a/59057166/1241663 – user1241663 Nov 27 '19 at 13:05
  • 2
    @Farrukh Najmi: The OP asked for ways to do a manual installation, so downvoting a correct answer because manual installations have drawbacks is a bad decision. Don't mix the validity of an answer with your perception of best practices regarding the question. Just for you: There are several situations where manual installation is needed, where requirements or constraints overrule "best practices". e.g. no direct connection to plugin repository, jenkins not running properly and there is no working GUI etc. – Bgs Mar 08 '21 at 11:48
150
  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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jfcorugedo
  • 9,793
  • 8
  • 39
  • 47
  • 4
    This is probably "safer" than http://stackoverflow.com/a/14953877/627806 since it's going through the front-end. – Jon Burgess May 14 '15 at 03:21
  • Sometimes this is necessary if Jenkins fails to start due to plugin misconfiguration. E.g. I had to do a manual install because of this [issue](https://groups.google.com/forum/#!topic/jenkinsci-users/1_SbyrWCqqI). – dskrvk Mar 21 '16 at 02:21
  • 1
    I tried installing this plugin, changed zip to hpi, and tried uploading from advanced option in manage plugins, but it is giving error `A problem occurred while processing the request. Please check our bug tracker to see if a similar problem has already been reported. If it is already reported, please vote and put a comment on it to let us gauge the impact of the problem. If you think this is a new issue, please file a new issue. When you file an issue, make sure to add the entire stack trace, along with the version of Jenkins and relevant plugins.` –  Dec 13 '16 at 21:33
  • What problem have you found? Can we know the actual exception? – jfcorugedo Dec 14 '16 at 07:21
  • 1
    Note that there's a size limit imposed by nginx (see: [https://issues.jenkins-ci.org/browse/JENKINS-32575]), so you may need to either change the nginx config or upload manually. – Moshe Zvi Aug 28 '17 at 19:44
22

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>
SergioArcos
  • 404
  • 6
  • 13
  • I was trying to solve this for docker and stumbled across this answer. Works great! – muglio Oct 08 '16 at 21:40
  • it depends on the way jenkins is installed. In my installation (apt-get install jenkins) I could not locate the plugin.sh file. However, if we start from FROM jenkins then it exists. – hadaytullah Nov 09 '16 at 08:48
  • note that you have to include the plugin and all its dependencies in plugins.txt since it won't resolve transitive dependencies. For example, blueocean has like 10+ dependencies you would also have to include manually.. – code4cause Jan 14 '17 at 00:11
  • How do I use this method when I'm running docker behind a proxy? `plugins.sh` cannot install plugins if the proxy isn't configured in Jenkins. And I don't think there's a method to configure proxy in Jenkins using Dockerfile. – 7_R3X Oct 03 '18 at 11:34
16

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

Michael Wyraz
  • 3,638
  • 1
  • 27
  • 25
11

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.

jam
  • 3,640
  • 5
  • 34
  • 50
11

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' ' ')

satolizard
  • 199
  • 2
  • 3
5

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
raikumardipak
  • 1,461
  • 2
  • 29
  • 49
4

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jdf
  • 699
  • 11
  • 21
  • 2
    I've created a simple gist to list all required latest versions of plugin dependencies from the web (scans entire dependency tree): https://gist.github.com/Lucasus/1a6b8df71425c790361c – Łukasz Wiatrak Jan 06 '16 at 22:55
4

The answers given works, 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 use:

 curl -i -F file=@pluginfilename.hpi http://jenkinshost/jenkins/pluginManager/uploadPlugin
bbaassssiiee
  • 6,013
  • 2
  • 42
  • 55
2

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.
yyardim
  • 116
  • 5
1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jmunsch
  • 22,771
  • 11
  • 93
  • 114
1

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

floki91
  • 11
  • 3
0

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

m.kocikowski
  • 5,422
  • 2
  • 23
  • 9
0
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.

ddtraveller
  • 1,029
  • 12
  • 18