Jenkins Redhat Packages
To use this repository, run the following command:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
If you've previously imported the key from Jenkins, the rpm --import will fail because you already have a key. Please ignore that and move on.
yum install fontconfig java-11-openjdk
yum install jenkins
[root@localhost ~]# rpm -ql jenkins
/etc/init.d/jenkins
/etc/logrotate.d/jenkins
/etc/sysconfig/jenkins
/usr/bin/jenkins
/usr/lib/systemd/system/jenkins.service
/usr/sbin/rcjenkins
/usr/share/java/jenkins.war
/usr/share/jenkins
/usr/share/jenkins/migrate
/var/cache/jenkins
/var/lib/jenkins
/var/log/jenkins
[root@localhost ~]# jenkins
六月 29, 2022 11:17:28 上午 Main verifyJavaVersion
严重: Running with Java class version 52, which is older than the Minimum required version 55. See https://jenkins.io/redirect/java-support/
java.lang.UnsupportedClassVersionError: 52.0
at Main.verifyJavaVersion(Main.java:143)
at Main.main(Main.java:107)
Jenkins requires Java versions [17, 11] but you are running with Java 1.8 from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre
java.lang.UnsupportedClassVersionError: 52.0
at Main.verifyJavaVersion(Main.java:143)
at Main.main(Main.java:107)
[root@localhost ~]# yum search jdk
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.cqu.edu.cn
* extras: mirrors.cqu.edu.cn
* updates: mirrors.cqu.edu.cn
================================================== N/S matched: jdk ====================================================
copy-jdk-configs.noarch : JDKs configuration files copier
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without audio and video support
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk.x86_64 : OpenJDK 8 Runtime Environment
java-1.8.0-openjdk-accessibility.i686 : OpenJDK accessibility connector
java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.8.0-openjdk-demo.i686 : OpenJDK Demos 8
java-1.8.0-openjdk-demo.x86_64 : OpenJDK 8 Demos
java-1.8.0-openjdk-devel.i686 : OpenJDK Development Environment 8
java-1.8.0-openjdk-devel.x86_64 : OpenJDK 8 Development Environment
java-1.8.0-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 8
java-1.8.0-openjdk-headless.x86_64 : OpenJDK 8 Headless Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed in a single archive
java-1.8.0-openjdk-src.i686 : OpenJDK Source Bundle 8
java-1.8.0-openjdk-src.x86_64 : OpenJDK 8 Source Bundle
java-11-openjdk.i686 : OpenJDK Runtime Environment 11
java-11-openjdk.x86_64 : OpenJDK 11 Runtime Environment
java-11-openjdk-demo.i686 : OpenJDK Demos 11
java-11-openjdk-demo.x86_64 : OpenJDK 11 Demos
java-11-openjdk-devel.i686 : OpenJDK Development Environment 11
java-11-openjdk-devel.x86_64 : OpenJDK 11 Development Environment
java-11-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-headless.x86_64 : OpenJDK 11 Headless Runtime Environment
java-11-openjdk-javadoc.i686 : OpenJDK 11 API documentation
java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation
java-11-openjdk-javadoc-zip.i686 : OpenJDK 11 API documentation compressed in a single archive
java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in a single archive
java-11-openjdk-jmods.i686 : JMods for OpenJDK 11
java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11
java-11-openjdk-src.i686 : OpenJDK Source Bundle 11
java-11-openjdk-src.x86_64 : OpenJDK 11 Source Bundle
java-11-openjdk-static-libs.i686 : OpenJDK libraries for static linking 11
java-11-openjdk-static-libs.x86_64 : OpenJDK 11 libraries for static linking
ldapjdk-javadoc.noarch : Javadoc for ldapjdk
icedtea-web.x86_64 : Additional Java components for OpenJDK - Java browser plug-in and Web Start implementation
ldapjdk.noarch : The Mozilla LDAP Java SDK
名称和简介匹配 only,使用“search all”试试。
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# yum list |grep java-11
java-11-openjdk.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-demo.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-demo.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-devel.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-devel.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-headless.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-headless.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-javadoc.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-javadoc.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-javadoc-zip.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-javadoc-zip.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-jmods.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-jmods.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-src.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-src.x86_64 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-static-libs.i686 1:11.0.15.0.9-2.el7_9 updates
java-11-openjdk-static-libs.x86_64 1:11.0.15.0.9-2.el7_9 updates
[root@localhost ~]# yum install -y java-11-openjdk.x86_64
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
* base: mirrors.cqu.edu.cn
* extras: mirrors.cqu.edu.cn
* updates: mirrors.cqu.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 java-11-openjdk.x86_64.1.11.0.15.0.9-2.el7_9 将被 安装
--> 正在处理依赖关系 java-11-openjdk-headless(x86-64) = 1:11.0.15.0.9-2.el7_9,它被软件包 1:java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 java-11-openjdk-headless.x86_64.1.11.0.15.0.9-2.el7_9 将被 安装
--> 解决依赖关系完成
依赖关系解决
===================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================
正在安装:
java-11-openjdk x86_64 1:11.0.15.0.9-2.el7_9 updates 235 k
为依赖而安装:
java-11-openjdk-headless x86_64 1:11.0.15.0.9-2.el7_9 updates 39 M
事务概要
====================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:40 M
安装大小:166 M
Downloading packages:
(1/2): java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64.rpm | 235 kB 00:00:00
(2/2): java-11-openjdk-headless-11.0.15.0.9-2.el7_9.x86_64.rpm | 39 MB 00:00:05
-----------------------------------------------------------------------------------------------------------
总计 7.6 MB/s | 40 MB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 1:java-11-openjdk-headless-11.0.15.0.9-2.el7_9.x86_64 1/2
正在安装 : 1:java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64 2/2
验证中 : 1:java-11-openjdk-headless-11.0.15.0.9-2.el7_9.x86_64 1/2
验证中 : 1:java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64 2/2
已安装:
java-11-openjdk.x86_64 1:11.0.15.0.9-2.el7_9
作为依赖被安装:
java-11-openjdk-headless.x86_64 1:11.0.15.0.9-2.el7_9
完毕!
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# java -version
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# rpm -ql jdk
未安装软件包 jdk
[root@localhost ~]# rpm -qa jdk
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# vi /etc/profile
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# source /etc/profile 修改环境变量,配置JAVA_HOME
[root@localhost ~]# java -version
openjdk version "1.8.0_332"
OpenJDK Runtime Environment (build 1.8.0_332-b09)
OpenJDK 64-Bit Server VM (build 25.332-b09, mixed mode)
[root@localhost ~]# whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz
[root@localhost ~]# ls -las /usr/bin/java
0 lrwxrwxrwx 1 root root 22 6月 29 11:19 /usr/bin/java -> /etc/alternatives/java
您在 /var/spool/mail/root 中有新邮件
[root@localhost ~]# alternatives --config java
共有 4 个提供“java”的程序。
选项 命令
-----------------------------------------------
1 java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64/jre/bin/java)
*+ 2 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre/bin/java)
3 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
4 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64/bin/java)
按 Enter 保留当前选项[+],或者键入选项编号:4
您在 /var/spool/mail/root 中有新邮件
某些Java应用程序使用JAVA_HOME环境变量来确定Java安装位置,并指定应使用哪个Java版本来运行该应用程序。
vi /etc/profile.d/java.sh
添加
JAVA_HOME="/usr/lib/jvm/java-11-openjdk"
[root@localhost ~]# source /etc/profile
[root@localhost ~]# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el7_9.x86_64
[root@localhost ~]#