Jenkins安装及基础环境配置
Jenkins服务安装
方式1:下载jenkins.war包,直接tomcat或者java -jar jenkins.war运行;
方式2:直接jenkins.msi安装(Windows环境推荐);
方式3:rpm安装(Linux环境推荐);
[@darr2-220-218 ~]# rpm -ivh jenkins-2.190.2-1.1.noarch.rpm
修改端口号:
vi /etc/sysconfig/jenkins 修改:JENKINS_PORT="8080"
启动 service jenkins start/stop/restart
Jenkins插件安装
常用Jenkins插件主要有:
多语言选择插件:locale plugin
中文汉化包插件:Localization: Chinese (Simplified)
多任务:MultiJob plugin
角色管理 plugin安装:Role-based Authorization Strategy
用户权限管理插件:Role-based Authorization Strategy
svn插件:Subversion
Git插件:Git plugin
Git参数插件:Git Parameter
Gitee插件:Gitee plugin
Github插件:Github plugin
Gradle插件:Gradle Plugin
SSH远程连接插件:Publish Over SSH
NodeJS插件:NodeJS Plugin
Pipeline插件:Pipeline
Jenkins Configure System配置
Maven项目配置
全局MAVEN_OPTS
D:\tools\apache-maven-3.2.3
全局属性
勾选:Environment variables
JAVA_HOME
D:\Program Files\Java\jdk1.8.0_181
LANG
zh_CN.UTF-8
M2_HOME
D:\tools\apache-maven-3.2.3
Gitee 配置(如果安装了Gitee插件)
链接名:Gitee
Gitee 域名 URL:http://gitee.com
证书令牌:选择在Gitee上生成的Gitee API令牌
Gitee令牌获取地址:https://gitee.com/profile/personal_access_tokens
Publish over SSH
Path to key:C:\Users\whwtr\.ssh\id_rsa
SSH Servers
配置需要远程连接的服务器
例:
Name:business-test-39.xx.xx.xx
Hostname:39.xx.xx.xx
Username:business
Remote Directory:/
勾选:Use password authentication, or use a different key
Path to key:C:\Users\whwtr\.ssh\id_rsa
点击Test Configuration测试连接配置,显示Success,表示连接配置成功
Jenkins Tool Configuration配置
Maven 配置
默认 settings 提供选择:Settings file in filesystem
文件路径:D:\tools\apache-maven-3.2.3\conf\settings.xml
默认全局 settings 提供选择:Global settings file on filesystem
文件路径:D:\tools\apache-maven-3.2.3\conf\settings.xml
JDK
点击JDK安装,配置多版本的jdk
JDK别名:jdk8
JAVA_HOME:D:\Program Files\Java\jdk1.8.0_181
JDK别名:jdk11
JAVA_HOME:D:\Program Files\Java\jdk11.0.15
Git
Name:GIt
Path to Git executable:D:\Program Files\Git\bin\git.exe
Maven
Name:maven-3.2.3
MAVEN_HOME:D:\tools\apache-maven-3.2.3
NodeJS
NodeJS别名:NodeJS
安装目录:D:\Program Files\nodejs