环境背景
centos7.9,java8,java11,Jenkins 2.401.3 本来想装老版的jenkins,但是各种插件装不上,而新版的jenkins又依赖java11,但maven的打包又是java8的,所以必须要折腾下了
步骤
- 下载jdk8,jdk11安装包 略
- 解压改名
[root@VM-4-12-opencloudos home]# ls
jdk-11.0.18_linux-x64_bin.tar.gz jdk-8u241-linux-x64.tar.gz jenkins.war jenkins.war.bak jenkins.war.tmp
[root@VM-4-12-opencloudos home]# tar -xzvf jdk-8u241-linux-x64.tar.gz
[root@VM-4-12-opencloudos home]# tar -xzvf jdk-11.0.18_linux-x64_bin.tar.gz
[root@VM-4-12-opencloudos home]# mv jdk1.8.0_241/ java8
[root@VM-4-12-opencloudos home]# mv jdk-11.0.18 java11
- 配置java8为默认的版本
vi ~/.bashrc
export JAVA_HOME=/home/java8
export PATH=$JAVA_HOME/bin:$PATH
source ~/.bashrc
- 添加软链接
cd /usr/bin
ln -s /home/java11/bin/java java11
ln -s /home/java8/bin/java java8
so jenkins直接用 java11 -jar jenkins.war 进行启动即可
标签:bin,java,tar,centos,俩个,jenkins,home,java8,java11 From: https://blog.51cto.com/bomby/6879065