软硬件要求
(1)、jenkins
jenkins插件:
(2)、Gitlab
(3)、Jira
(4)、Nexus
1、安装JDK
(1)下载
链接: https://pan.baidu.com/s/147LT9ICgl5lYRhGe4D7QUQ 密码: 2h1e
rpm -ivh jdk-8u131-linux-x64.rpm
(2)配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/lib/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export JENKINS_HOME=/vdc/data/jenkins_home
source /etc/profile
2、安装tomcat(tomcat和jdk版本最好相同)
(1)下载
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz
(2)解压缩
tar -zxf apache-tomcat-8.5.31.tar.gz
(3)启动
cd apache-tomcat-8.5.31/
./bin/startup.sh
3、安装jenkins
(1)去jenkins官网(https://jenkins.io/download/)(http://mirrors.jenkins.io/war-stable/)下载所需jar包
(2)设置jenkins主目录
打开tomcat的bin目录,编辑catalina.sh文件。
在# OS specific support. $var _must_ be set to either true or false.上面添加:export JENKINS_HOME=""
在引号中填入你的路径。
//方案二
export JAVA_HOME=/opt/jdk1.8.0_102
export JRE_HOME=/opt/jdk1.8.0_102/jre
export JAVA_OPTS="-server -Xms512m -Xmx8000m -Xss1024K -Dorg.apache.tomcat.util.buf.Udecoder.ALLOW_ENCODED_SLASH=true -Djava.awt.headless=true"
export JENKINS_HOME=/opt/jenkins
export CATALINA_OPTS="-Dfile.encoding=utf-8"
(3)启动jenkins:
把jenkins的war放入tomcat的webapp(/home/tomcat/apache-tomcat-8.5.31/webapps),然后启动tomcat
/home/tomcat/apache-tomcat-8.5.31/bin/startup.sh
(4)修改防火墙,开通8080端口
vim /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT
重启防火墙service iptables restart
(5)访问url
http://serverIP:8080/jenkins/
(6)按照提示输入管理员密码
more /root/.jenkins/secrets/initialAdminPassword
(7)安装插件:
选择install suggested plugins,等待安装完毕,如果有安装失败的可以跳过,之后可以手动根据需求安装。
(8)创建管理员账号
4、安装gitlab
https://my.oschina.net/sh021/blog/1796901
5、jira和jinkins关联
jira和jinkins要注意版本对应:jira7.5.0,jenkins2.107.1
(1)jira中需要安装的插件
Jenkins Integration for JIRA Server
(2)jenkins中需要安装的插件
JIRA Integration for Jenkins 3.1.4
Jira Issue Updater 1.18
JIRA Pipeline Steps 1.4.1
JIRA plugin 3.0.0
JIRA Trigger Plugin 0.6.3
JiraTestResultReporter plugin 2.0.6
https://repository.marvelution.org/content/repositories/releases/org/marvelution/jji/assemblies/jenkins-jira-plugin/3.1.4/
(3)jira中配置
6、jira和gitlab关联
(1)jira中需要安装的插件
it Integration for Jira (3.2.1)
(2)jira中配置:应用程序-git仓库-连接到git信息库-输入git仓库地址和访问用户名密码
(3)jenkins中配置jira
在jenkins系统管理->系统配置
参考链接:
http://www.daxiblog.com/2017/01/11/jirajenkins%E9%9B%86%E6%88%90%EF%BC%8C%E5%AE%9E%E7%8E%B0%E4%BB%BB%E5%8A%A1%E7%8A%B6%E6%80%81%E6%94%B9%E5%8F%98%E8%87%AA%E5%8A%A8%E8%A7%A6%E5%8F%91%E5%A2%9E%E9%87%8F%E5%8F%91%E5%B8%83/