一、前言
1、在项目开发过程中以及UAT测试阶段,为解决频繁发布问题,往往我们会安装一个jenkins部署工具,减少我们频繁发布等问题,在测试阶段我们需要客户提供一台服务器安装此插件,由于客户服务器网络限制等问题,Linux系统服务器不能连接外网导致在安装jenkins过程中不能正常的安装我们需要的插件,由于jenkins从官网下载后,默认是没有插件的,需要我们自己安装对应的插件,安装插件过程中需要连接外网进行下载,如果是有网络的情况下安装是非常方便的,但是如果是离线安装会多出几步操作,官方给出了离线安装方法,但是给出的文档有的小伙伴看不懂,网上详细资料也非常少,今天借此机会在参照官方的给出的安装方法再次进行补充,今天在这里做下记录分享给在项目中需要的小伙伴仅做参考。
一、jenkins下载
1、jenkins下载地址:War Jenkins Packages
2、选择对应的安装版本、注意每个版本支持的jdk
3、选择对应的版本号,本次安装采用war包方式启动
二、jenkins离线下载插件
1、官方提供的离线安装方法:Installing Jenkins
2、下载离线安装插件工具
3、进入plugin-installation-manager-tool:注意、最新的插件工具默认jdk最低要求只支持jdk11上GitHub - jenkinsci/plugin-installation-manager-tool: Plugin Manager CLI tool for Jenkins
4、第三步是自己下载源码自己打jar包,也可以采用第四步官方下载一个打包的jar包,下载地址:
5、下载插件工具包地址:
Release 2.12.11 · jenkinsci/plugin-installation-manager-tool · GitHub
6、下载后放到wind本地使用命令启动
java -jar jenkins-plugin-manager-2.12.11.jar --war C:\Users\xunliu\Desktop\jenkins\jenkins.war --plugin-file C:\Users\xunliu\Desktop\jenkins\plugins.txt --plugins delivery-pipeline-plugin:1.3.2 deployit-plugin
输入命令后,会读取C:\Users\xunliu\Desktop\jenkins\plugins.txt文件内容对应的插件名称,在输入上面命令前,需要先把需要的插件名称写入到plugins.txt后,在执行此命令会自动去官网下载war包对应的插件依赖,第一次有点久需要等待几分钟不要关闭窗口,下载完成后会自动关闭jar服务。
文章来源地址https://www.toymoban.com/news/detail-468648.html
ant
antisamy-markup-formatter
batch-task
credentials
cvs
external-monitor-job
javadoc
junit
ldap
mailer
matrix-auth
matrix-project
maven-plugin
pam-auth
powershell
publish-over-ftp
publish-over-ssh
rebuild
role-strategy
script-security
ssh-credentials
ssh-slaves
subversion
translation
view-job-filters
windows-slaves
Localization
Localization: Chinese (Simplified)
下载完成后的插件路径:
7、第六步命令解释:
-
--plugin-file
or-f
: (optional) Path to the plugins.txt, or plugins.yaml file, which contains a list of plugins to install. If this file does not exist, or if the file exists, but does not have a .txt or .yaml/.yml extension, then an error will be thrown. -
--plugin-download-directory
or-d
: (optional) Directory in which to install plugins. This configuration can also be made via the PLUGIN_DIR environment variable. The directory will be first deleted, then recreated. If no directory configuration is provided, the defaults are C:\ProgramData\Jenkins\Reference\Plugins if the detected operating system is Microsoft Windows, or /usr/share/jenkins/ref/plugins otherwise. -
--plugins
or-p
: (optional) List of plugins to install (see plugin format below), separated by a space. -
--clean-download-directory
: (optional) If sets, cleans the plugin download directory before plugin installation. Otherwise the tool performs plugin download and reports compatibility issues, if any. -
--jenkins-version
: (optional) Version of Jenkins to be used. If not specified, the plugin manager will try to extract it from the WAR file or other sources. The argument can be also set using theJENKINS_VERSION
environment variable. -
--war
or-w
: (optional) Path to Jenkins war file. If no war file is entered, will default to /usr/share/jenkins/jenkins.war or C:\ProgramData\Jenkins\jenkins.war, depending on the user's OS. Plugins that are already included in the Jenkins war will only be downloaded if their required version is newer than the one included. -
--list
or-l
: (optional) Lists plugin names and versions of: installed plugins (plugins that already exist in the plugin directory), bundled plugins (non-detached plugins that exist in the war file), plugins that will be downloaded (highest required versions of the requested plugins and dependencies that are not already installed), and the effective plugin set (the highest versions of all plugins that are already installed or will be installed) -
--verbose
: (optional) Show additional information about plugin dependencies and the download process -
--hide-security-warnings
: (optional) Hide if any of the user specified plugins have security warnings -
--view-all-security-warnings
: (optional) Show all plugins that have security warnings. -
--available-updates
: (optional) Show if any requested plugins have newer versions available. If a Jenkins version-specific update center is available, the latest plugin version will be determined based on that update center's data. -
--output {stdout,yaml,txt}
: (optional) Format to output plugin updates file in, stdout is the default. -
--latest {true,false}
: (optional) Set to false to download the minimum required version of all dependencies. -
--latest-specified
: (optional) (advanced) Download latest dependencies of any plugin that is requested to have the latest version. All other plugin dependency versions are determined by the update center metadata or the plugin MANIFEST.MF. -
--jenkins-update-center
: (optional) Sets the main update center filename, which can also be set via the JENKINS_UC environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/update-center.actual.json -
--jenkins-experimental-update-center
: (optional) Sets the experimental update center, which can also be set via the JENKINS_UC_EXPERIMENTAL environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/experimental/update-center.actual.json -
--jenkins-incrementals-repo-mirror
: (optional) Sets the incrementals repository mirror, which can also be set via the JENKINS_INCREMENTALS_REPO_MIRROR environment variable. If a CLI option is entered, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to Index of incrementals/. -
--jenkins-plugin-info
: (optional) Sets the location of plugin information, which can also be set via the JENKINS_PLUGIN_INFO environment variable. If a CLI option is provided, it will override what is set in the environment variable. If not set via CLI option or environment variable, will default to https://updates.jenkins.io/current/plugin-versions.json. -
--version
or-v
: (optional) Displays the plugin management tool version and exits. -
--no-download
: (optional) Do not download plugins. By default plugins will be downloaded. -
--skip-failed-plugins
: (optional) Adds the option to skip plugins that fail to download - CAUTION should be used when passing this flag as it could leave Jenkins in a broken state. -
--credentials
: (optional) Comma-separated list of credentials to use for Basic Authentication for specific hosts (and optionally ports). Each value must adhere to format<host>[:port]:<username>:<password>
. The password must not contain a,
! The credentials are not used preemptively.
三、jenkins离线安装步骤
1、以上把插件与war包准备好后,准备开始安装jenkins了
2、在安装jenkins需要的必备软件,jdk8环境,tomcat9服务环境,把jenkins.war包放入到tomcat /webapps目录下 启动成功后,系统会自动创建目录/root/.jenkins/plugins。
3、把上面下载好的插件C:\ProgramData\Jenkins\Reference\Plugins 目录文件上传到linux服务器路径下:/root/.jenkins/plugins
4、打开地址登录:http://192.168.1.102:8080/jenkins
5、输入密码后根据提示安装,这里就不在赘述,安装时不要选择推荐插件,选择自定义插件安装,并且把已经勾选的推荐插件去掉,选择无。文章来源:https://www.toymoban.com/news/detail-468648.html
到了这里,关于Jenkins离线部署方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!