Linux 安装Jenkins
1、安装jdk1.8
下载地址:https://github.com/frekele/oracle-java/releases
- 下载
root@123:~/my_java# wget https://github.com/frekele/oracle-java/releases/download/8u212-b10/jdk-8u212-linux-x64.tar.gz
- 解包解压
root@123~/my_java# tar -zxvf jdk-8u212-linux-x64.tar.gz
- 修改java目录名
root@123~/my_java# my_java# mv jdk1.8.0_212 jdk1.8
- 添加环境变量
root@123:~/my_java# cd /etc/
root@123:~/my_java# vim profile
# 添加环境变量
JAVA_HOME=/root/my_java/jdk1.8
export JRE_HOME=/root/my_java/jdk1.8/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
- 刷新环境变量
root@123:/etc# source profile
- 测试环境变量添加成功
root@123:/etc# java
root@123:/etc# java -v
root@123:/etc# javac -version
2、下载Tomcat9
下载地址:http://tomcat.apache.org/download-90.cgi
- 下载
root@123:~# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz
- 解包解压
root@123:~# tar -zxvf apache-tomcat-9.0.30.tar.gz
3、下载jenkins.war放在Tomcat的webapps目录下
jenkins官网:https://jenkins.io/zh/
XX上网能加快下载,
root@123:~# cd apache-tomcat-9.0.30/webapps/
root@123456:~/apache-tomcat-9.0.30/webapps# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
4、启动Tomcat
root@123:~/apache-tomcat-9.0.30/bin# cd /root/apache-tomcat-9.0.30/bin/
root@iZuf6c0rnhno78oq2pxylnZ:~/apache-tomcat-9.0.30/bin# sh ./startup.sh
Using CATALINA_BASE: /root/apache-tomcat-9.0.30
Using CATALINA_HOME: /root/apache-tomcat-9.0.30
Using CATALINA_TMPDIR: /root/apache-tomcat-9.0.30/temp
Using JRE_HOME: /root/my_java/jdk1.8/jre
Using CLASSPATH: /root/apache-tomcat-9.0.30/bin/bootstrap.jar:/root/apache-tomcat-9.0.30/bin/tomcat-juli.jar
Tomcat started.
5、访问服务器或者本地80端口/jenkins
http:localhost:8080/jenkins
6、查找并输入jenkins密码
root@iZuf6c0rnhno78oq2pxylnZ:~/.jenkins/secrets# cd /root/.jenkins/secrets/
root@iZuf6c0rnhno78oq2pxylnZ:~/.jenkins/secrets# cat initialAdminPassword
f06989f0b7444c219c5704cb17351bad