How to install jenkins plugins in offline mode - jenkins

I am sitting behind proxy. I can not bypass it as I am not allowed to download anything on this linux box. I don't have root privilege either.
I have deployed jenkins.war on apache tomcat. Also, downloaded all necessary Jenkins plugins and placed it as shown below:
jenkins
+apache-tomcat-8.5.12/webapps/jenkins
+apache-tomcat-8.5.12/webapps/jenkins.war
+plugins
Can anyone please let me know is there any way I can simply point to 'jenkins/plugins' directory path in some config file to install plugins.
Thanks

On the master
Assuming a .hpi file has been explicitly downloaded, the administrator can manually place the .hpi file in a specific location on the file system.
Copy the downloaded .hpi` file into the JENKINS_HOME/plugins directory on the Jenkins master (for example, on Debian systems JENKINS_HOME is generally /var/lib/jenkins).
The master will need to be restarted before the plugin is loaded and made available in the Jenkins environment.
pay attention for the dependencies plugins some plugins claim other plugins
Jenkins plugins

Finally resolved this issue. Copied all plugins # /home/appuser/.jenkins/plugins. When we deploy jenkins.war on apache tomcat it creates jenkins-home # /home/user/.jenkins

Related

Unable to locate Jenkins file when Jenkins is installed over Tomcat on Linux Machine

Unable to locate Jenkins file when Jenkins is installed over Tomcat on Linux Machine
I have installed Jenkins(Jenkins.war) on a Linux (RedHat) machine using Tomcat application server.Prior to installation I had set my JENKINS_HOME(in ~/.bash_profile) to /apps/jenkins folder so that Tomcat will install Jenkins on this directory.
Post installation Jenkins is up and running and my jobs are executing fine.However, I need to change JENKINS_USER to other user but I am not able to locate the Jenkins file that will have info like JENKINS_USER and JENKINS_PORT.
I tried searching this file under following directories but no success.
/var/lib/jenkins
/etc/sysconfig
/etc/default
I am not able to find it even in the Jenkins installation directory.
Any help would be appreciated.
Thanks
The files you are searching are only found in the standalone installations of Jenkins through various package managers of different supported Linux distributions for which Jenkins offers packages.
The install of Jenkins in Tomcat is just downloading and copying jenkins.war in Tomcat's webapps folder as a servlet, everything else is managed through Tomcat config files, like setting JENKINS_HOME or changing the port by editing the connector xml for example.
The documentation on running Jenkins as a .war in Tomcat is here. You can see examples on how to change the connector port in $TOMCAT_HOME/conf/server.xml and also JENKINS_HOME in the context. I assume you understand at least how Tomcat works and how to configure it.

Jenkins install plugins offline

Installed Jenkins on a Linux server and want to install some plugins manually.
I want to install Blue Ocean and Artifactory.
For both plugins I downloaded the hpi file and tried to install it, but I get a lot of dependency errors.
Do I now have to install those dependencies manually as well? or is there a better way to do this?
I tried to install one of those dependency and that one also had some dependency errors as well :-(
The Linux server is not able to access the internet.
Thanks!
Robert
You are correct that BlueOcean has a lot of dependencies.
Given you are not able to connect to the internet you will need to download all 21 BlueOcean related hpi files and upload them from the Manage Jenkins > Manage Plugins > Advanced tab.
Alternatively, if you have access to the server that your Jenkins instance is running on you can copy the hpi files into the %JENKINS_HOME%/plugins folder. The corresponding directories (exploded from the hpi, which is just a zip file) will be created on Jenkins restart.
The easiest way to acquire all 21 plugin files is to open The Jenkins plugin page and search for blueocean. Download the same numbered version of all 21 and upload them one by one. Order shouldn't be an issue. As long as they are all present on restart the dependencies will resolve.
Same process goes for any other plugin. If you're able to get the machine connected to the internet it will make the process a lot simpler as you will be able to use the update center, which manages dependencies and update notifications.
Same case here. Our Jenkins is setup in OpenShift which is not allowed to connect to the Internet. Downloading a plugin 1-by-1 is tiresome. Not to mention that each plugins have its own dependencies that needs to be downloaded as well.
Here's what you would do...
Run a Jenkins locally in a machine that can download plugins.
Download and update all the plugins you want using the Update Center.
Go %JENKINS_HOME%/plugins directory. Inside this folder you would see *.jpi. These are your plugins. Its dependencies will be downloaded as well.
Rename it to *.hpi then keep it in some directory.
To test...
In your local Jenkins delete everything in %JENKINS_HOME%/plugins directory then put all *.hpi in this directory.
Restart your local Jenkins.
Verify if the plugins you require are installed and updated.

Update jenkins war on one machine and then move it to another one: possible?

I have a machine with blocked outgoing connections so it is not possible to update jenkins nor install the plugins I need for my work.
My idea is the following: I download the jenkins .war on my personal laptop and complete the installation + the plugin download.
Then I just move this .war to the machine where I need jenkins to be up and running.
Is it possible? Where are the plugins/updated data stored?
Also, would it be a problem the fact that my laptop has windows as os, while the destination machine is a linux RHEL?
Your solution sounds crazy :D
This could be help you:
Update Jenkins war
If you have shell access with root privilege, there is a manual way.
Download latest war file inside your linux, using wget , curl or just upload it using winscp from your windows.
Stop jenkins
Backup EVERYTHING: linux snapshot, jenkins workspace, jenkins war file, etc
Replace the old war with new war
Start jenkins
Detailed steps in this webs:
https://mohitgoyal.co/2017/02/15/upgrade-jenkins-server-to-a-new-version/
https://www.thegeekstuff.com/2016/06/upgrade-jenkins-and-plugins/
Plugin
Jenkins has an option to install plugins called Manage Plugins
This offer two options :
(1) Install plugins using available option
For official and compatible plugins, suggested by Jenkins :
(2) Install plugins using upload option
For custom plugins or when is not available on official repositories:

How do I move Jenkins from one server to another?

I need to move Jenkins version 2.32 from Server A to Jenkins 2.72.1 Server B.
Both server have ubuntu 16.04.3
I could not install any plugin and take back up in Server A due to memory issues. Is there any way that I could achieve this?
Copy all the files in your JENKINS_HOME directory over to the new server.
Point JENKINS_HOME on the new server at the new directory.
Copy the Jenkins war file (or your servlet container setup if you have one) over to the new machine and start it up.
All Jenkins settings, jobs, plugins, config, etc. live in JENKINS_HOME. You just need a copy of it to start it elsewhere.
Following JENKINS/Administering+Jenkins, you still need to make a backup of JENKINS_HOME.
See also How to Migrate a Jenkins Job to New Jenkins Server
If you want to exclude the plugins for space issue, you can list them in a text file, and reload them with a groovy script.

How to install jenkins offline?

I could successfully install the jenkins online over my laptop. But while trying to install the jenkins offline (on my office workstation which cannot be connected to internet) the hell breaks loose.
After running the jenkins.war over command line although the jenkins was successfully installed yet some of the plugins were missing.I managed to get some help from the post How to install a plugin in Jenkins manually?
But then each of the plugins have to be individually downloaded and then copied over to my offline machine. So I had a trick.
I copied all the folders under .jenkins directory (in my online installation machine) and then copied them to my offline machine. Whoa!
It worked!
But I still get one single error:
Maven Integration Plugin V2.16 .javadoc 1.0 is missing. To fix, install v1.0 or later
So is there a way/website/pdf/repository which is a one stop solution/steps to smoothly install (read has all the required dependencies as a zip) Jenkins in offline mode. (If not, to the creators of Jenkins: Would it be a good idea to have one?)
I'm also searching for an easy way to manage the dependencies between the plugins but as far as I know there is no official tool for that.
Either you have a .zip file with all the plugins which you prepare one time or you fix the errors manually.
For your problem it should be enough to install the following .hpi file: https://updates.jenkins-ci.org/latest/javadoc.hpi (javadoc has no dependencies to other plugins)
You can download the .hpi version of plugins required and paste them in plugins folder at jenkins_home and then restart the jenkins,then you can able to use those plugins.

Resources