yum install mvn
注意
会默认安装java8的JDK,会和新版Jenkins强制使用java11起冲突。
解决方式
查找jdk安装目录
[root@iZwz92bor1grj7ixzyjfuaZ jenkins]# which java
/usr/bin/java
[root@iZwz92bor1grj7ixzyjfuaZ jenkins]# ls -lrt /usr/bin/java
lrwxrwxrwx 1 root root 22 Feb 9 10:06 /usr/bin/java -> /etc/alternatives/java
[root@iZwz92bor1grj7ixzyjfuaZ jenkins]# ls -lrt /etc/alternatives/java
lrwxrwxrwx 1 root root 73 Feb 9 10:06 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java
[root@iZwz92bor1grj7ixzyjfuaZ jenkins]# cd /usr/lib/jvm
[root@iZwz92bor1grj7ixzyjfuaZ jvm]# ll
total 8
lrwxrwxrwx 1 root root 26 Feb 9 10:06 java -> /etc/alternatives/java_sdk
drwxr-xr-x 6 root root 4096 Feb 9 09:29 java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64
lrwxrwxrwx 1 root root 32 Feb 9 10:06 java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0
lrwxrwxrwx 1 root root 40 Feb 9 10:06 java-1.8.0-openjdk -> /etc/alternatives/java_sdk_1.8.0_openjdk
drwxr-xr-x 7 root root 4096 Feb 9 10:06 java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64
lrwxrwxrwx 1 root root 34 Feb 9 10:06 java-openjdk -> /etc/alternatives/java_sdk_openjdk
lrwxrwxrwx 1 root root 21 Feb 9 10:06 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root 24 Feb 9 09:29 jre-11 -> /etc/alternatives/jre_11
lrwxrwxrwx 1 root root 32 Feb 9 09:29 jre-11-openjdk -> /etc/alternatives/jre_11_openjdk
lrwxrwxrwx 1 root root 43 Feb 9 09:29 jre-11-openjdk-11.0.18.0.10-1.el7_9.x86_64 -> java-11-openjdk-11.0.18.0.10-1.el7_9.x86_64
lrwxrwxrwx 1 root root 27 Feb 9 10:06 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx 1 root root 35 Feb 9 10:06 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx 1 root root 51 Feb 9 10:06 jre-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64 -> java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre
lrwxrwxrwx 1 root root 29 Feb 9 10:06 jre-openjdk -> /etc/alternatives/jre_openjdk
调整jenkins启动方式
nohup /usr/lib/jvm/jre-11-openjdk-11.0.18.0.10-1.el7_9.x86_64/bin/java -Dhudson.util.ProcessTree.disable=true -jar jenkins.war --httpPort=8081 >> nohup.out 2>&1 &