Ubuntu 16.04安装Openjdk 7
Ubuntu 14是可以正常安装openjdk 7的,Ubuntu 16则只能安装openjdk 8以上,先说结果:使用本博文方法,目前测试ubuntu 16 server/desktop均可以正常安装openjdk 7。
------------------------------------------
ubuntu 16安装openjdk,网上比较常见的,给出了两种方法,均无法实施:
网上方法一(过时):
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-cache search openjdk $ sudo apt update $ sudo apt install openjdk-7-jdk
这种方法已过时,目前已经无法使用。
网上方法二:
离线安装openjdk 7,此方法颇为繁琐,完成很不容易,并且很容易出错,把系统UI挂掉(重启无法进入UI系统,可用tty)。
原因1:openjdk 7依赖特别多(稍后贴出依赖日志),并且还递归,一个依赖又依赖另一个或多个依赖,相当繁琐。
原因2:openjdk 7版本较旧,一些依赖需要低版本,而在线方式可能会安装依赖高版本,解决相当繁琐。
------------------------------------------
Ubuntu 16.04 Server
我测试发现ubuntu 14是可以正常安装openjdk 7,然后把ubuntu 16的源改成ubuntu 14的源,更新之后,就可以正常通过在线方式安装openjdk 7了。
下面是Ubuntu 14的源文件: sources.list
1 #deb cdrom:[Ubuntu 14.04.6 LTS _Trusty Tahr_ - Release amd64 (20190304.5)]/ trusty main restricted 2 3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 4 # newer versions of the distribution. 5 deb http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted 6 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty main restricted 7 8 ## Major bug fix updates produced after the final release of the 9 ## distribution. 10 deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted 11 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates main restricted 12 13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 14 ## team. Also, please note that software in universe WILL NOT receive any 15 ## review or updates from the Ubuntu security team. 16 deb http://cn.archive.ubuntu.com/ubuntu/ trusty universe 17 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty universe 18 deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates universe 19 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates universe 20 21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 22 ## team, and may not be under a free licence. Please satisfy yourself as to 23 ## your rights to use the software. Also, please note that software in 24 ## multiverse WILL NOT receive any review or updates from the Ubuntu 25 ## security team. 26 deb http://cn.archive.ubuntu.com/ubuntu/ trusty multiverse 27 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty multiverse 28 deb http://cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse 29 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-updates multiverse 30 31 ## N.B. software from this repository may not have been tested as 32 ## extensively as that contained in the main release, although it includes 33 ## newer versions of some applications which may provide useful features. 34 ## Also, please note that software in backports WILL NOT receive any review 35 ## or updates from the Ubuntu security team. 36 deb http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 37 deb-src http://cn.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse 38 39 deb http://security.ubuntu.com/ubuntu trusty-security main restricted 40 deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted 41 deb http://security.ubuntu.com/ubuntu trusty-security universe 42 deb-src http://security.ubuntu.com/ubuntu trusty-security universe 43 deb http://security.ubuntu.com/ubuntu trusty-security multiverse 44 deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse 45 46 ## Uncomment the following two lines to add software from Canonical's 47 ## 'partner' repository. 48 ## This software is not part of Ubuntu, but is offered by Canonical and the 49 ## respective vendors as a service to Ubuntu users. 50 # deb http://archive.canonical.com/ubuntu trusty partner 51 # deb-src http://archive.canonical.com/ubuntu trusty partner 52 53 ## This software is not part of Ubuntu, but is offered by third-party 54 ## developers who want to ship their latest software. 55 deb http://extras.ubuntu.com/ubuntu trusty main 56 deb-src http://extras.ubuntu.com/ubuntu trusty main
把这个源替换ubuntu 16的源:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak $ sudo vim /etc/apt/sources.list # 删除原有内容,替换为ubuntu 14的源内容. # apt-get已过时,使用apt. $ sudo apt update $ sudo apt install openjdk-7-jdk
这样Ubuntu Server就可以正常安装openjdk 7了。
上面是ubuntu 自带的中国源,你也可以使用清华,中科大等提供的源,清华提供的源可以访问这里获取:
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/].
下面贴出openjdk 7安装过程中所用到的部分依赖日志:
$ sudo apt install openjdk-7-jdk WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts. Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: ca-certificates-java fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni libgif4 libice-dev libpthread-stubs0-dev libsctp1 libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev lksctp-tools openjdk-7-jre openjdk-7-jre-headless tzdata tzdata-java x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev Suggested packages: default-jre equivs libice-doc libsm-doc libxcb-doc libxt-doc openjdk-7-demo openjdk-7-source visualvm icedtea-7-plugin icedtea-7-jre-jamvm sun-java6-fonts fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei ttf-indic-fonts The following NEW packages will be installed: ca-certificates-java fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni libgif4 libice-dev libpthread-stubs0-dev libsctp1 libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev lksctp-tools openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless tzdata-java x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev The following packages will be upgraded: tzdata 1 upgraded, 26 newly installed, 0 to remove and 63 not upgraded. Need to get 61.9 MB of archives. After this operation, 104 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main ca-certificates-java all 20130815ubuntu1 [13.4 kB] Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main tzdata all 2019a-0ubuntu0.14.04 [167 kB] Get:3 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main tzdata-java all 2019a-0ubuntu0.14.04 [70.0 kB] Get:4 http://cn.archive.ubuntu.com/ubuntu/ trusty/main java-common all 0.51 [130 kB] Get:5 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libsctp1 amd64 1.0.15+dfsg-1 [9,226 B] Get:6 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openjdk-7-jre-headless amd64 7u211-2.6.17-0ubuntu0.1 [39.6 MB] Get:7 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libgif4 amd64 4.1.6-11 [28.6 kB] Get:8 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openjdk-7-jre amd64 7u211-2.6.17-0ubuntu0.1 [172 kB] Get:9 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libatk-wrapper-java all 0.30.4-4 [30.2 kB] Get:10 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libatk-wrapper-java-jni amd64 0.30.4-4 [25.2 kB] Get:11 http://cn.archive.ubuntu.com/ubuntu/ trusty/main fonts-dejavu-extra all 2.34-1ubuntu1 [1,736 kB] Get:12 http://cn.archive.ubuntu.com/ubuntu/ trusty/main xorg-sgml-doctools all 1:1.11-1 [12.9 kB] Get:13 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main x11proto-core-dev all 7.0.26-1~ubuntu2 [700 kB] Get:14 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libice-dev amd64 2:1.0.8-2 [57.6 kB] Get:15 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libpthread-stubs0-dev amd64 0.3-4 [4,068 B] Get:16 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libsm-dev amd64 2:1.2.1-2 [19.9 kB] Get:17 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libxau-dev amd64 1:1.0.8-1 [11.1 kB] Get:18 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libxdmcp-dev amd64 1:1.1.1-1 [26.9 kB] Get:19 http://cn.archive.ubuntu.com/ubuntu/ trusty/main x11proto-input-dev all 2.3-1 [139 kB] Get:20 http://cn.archive.ubuntu.com/ubuntu/ trusty/main x11proto-kb-dev all 1.0.6-2 [269 kB] Get:21 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main xtrans-dev all 1.3.5-1~ubuntu14.04.2 [70.7 kB] Get:22 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libxcb1-dev amd64 1.10-2ubuntu1 [76.6 kB] Get:23 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main libx11-dev amd64 2:1.6.2-1ubuntu2.1 [632 kB] Get:24 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main libx11-doc all 2:1.6.2-1ubuntu2.1 [1,447 kB] Get:25 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libxt-dev amd64 1:1.1.4-1 [455 kB] Get:26 http://cn.archive.ubuntu.com/ubuntu/ trusty/main lksctp-tools amd64 1.0.15+dfsg-1 [51.3 kB] Get:27 http://cn.archive.ubuntu.com/ubuntu/ trusty-updates/main openjdk-7-jdk amd64 7u211-2.6.17-0ubuntu0.1 [16.0 MB] Preconfiguring packages ... Fetched 61.9 MB in 26s (2,301 kB/s) Selecting previously unselected package ca-certificates-java. (Reading database ... 175400 files and directories currently installed.) Preparing to unpack .../ca-certificates-java_20130815ubuntu1_all.deb ... [30mProgress: [ 0%][uUnpacking ca-certificates-java (20130815ubuntu1) ... [30mProgress: [ 1%][u[30mProgress: [ 2%][uPreparing to unpack .../tzdata_2019a-0ubuntu0.14.04_all.deb ... Unpacking tzdata (2019a-0ubuntu0.14.04) over (2018i-0ubuntu0.14.04) ... [30mProgress: [ 3%][u[30mProgress: [ 4%][uProcessing triggers for ca-certificates (20170717~14.04.2) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d....done. Setting up tzdata (2019a-0ubuntu0.14.04) ... [30mProgress: [ 5%][u Current default time zone: 'Asia/Shanghai' Local time is now: 2022年 07月 03日 星期日 08:35:28 CST. Universal Time is now: Sun Jul 3 00:35:28 UTC 2022. Run 'dpkg-reconfigure tzdata' if you wish to change it. Selecting previously unselected package tzdata-java. (Reading database ... 175410 files and directories currently installed.) Preparing to unpack .../tzdata-java_2019a-0ubuntu0.14.04_all.deb ... [30mProgress: [ 6%][uUnpacking tzdata-java (2019a-0ubuntu0.14.04) ... [30mProgress: [ 7%][u[30mProgress: [ 8%][uSelecting previously unselected package java-common. Preparing to unpack .../java-common_0.51_all.deb ... Unpacking java-common (0.51) ... [30mProgress: [ 9%][u[30mProgress: [ 10%][uSelecting previously unselected package libsctp1:amd64. Preparing to unpack .../libsctp1_1.0.15+dfsg-1_amd64.deb ... [30mProgress: [ 11%][uUnpacking libsctp1:amd64 (1.0.15+dfsg-1) ... [30mProgress: [ 12%][uSelecting previously unselected package openjdk-7-jre-headless:amd64. Preparing to unpack .../openjdk-7-jre-headless_7u211-2.6.17-0ubuntu0.1_amd64.deb ... [30mProgress: [ 13%][uUnpacking openjdk-7-jre-headless:amd64 (7u211-2.6.17-0ubuntu0.1) ... [30mProgress: [ 14%][uSelecting previously unselected package libgif4:amd64. Preparing to unpack .../libgif4_4.1.6-11_amd64.deb ... [30mProgress: [ 15%][uUnpacking libgif4:amd64 (4.1.6-11) ... [30mProgress: [ 16%][u[30mProgress: [ 17%][uSelecting previously unselected package openjdk-7-jre:amd64. Preparing to unpack .../openjdk-7-jre_7u211-2.6.17-0ubuntu0.1_amd64.deb ... Unpacking openjdk-7-jre:amd64 (7u211-2.6.17-0ubuntu0.1) ... [30mProgress: [ 18%][u[30mProgress: [ 19%][uSelecting previously unselected package libatk-wrapper-java. Preparing to unpack .../libatk-wrapper-java_0.30.4-4_all.deb ... [30mProgress: [ 20%][uUnpacking libatk-wrapper-java (0.30.4-4) ... [30mProgress: [ 21%][uSelecting previously unselected package libatk-wrapper-java-jni:amd64. Preparing to unpack .../libatk-wrapper-java-jni_0.30.4-4_amd64.deb ... [30mProgress: [ 22%][uUnpacking libatk-wrapper-java-jni:amd64 (0.30.4-4) ... [30mProgress: [ 23%][uSelecting previously unselected package fonts-dejavu-extra. Preparing to unpack .../fonts-dejavu-extra_2.34-1ubuntu1_all.deb ... [30mProgress: [ 24%][uUnpacking fonts-dejavu-extra (2.34-1ubuntu1) ... [30mProgress: [ 25%][uSelecting previously unselected package xorg-sgml-doctools. Preparing to unpack .../xorg-sgml-doctools_1%3a1.11-1_all.deb ... [30mProgress: [ 26%][uUnpacking xorg-sgml-doctools (1:1.11-1) ... [30mProgress: [ 27%][u[30mProgress: [ 28%][uSelecting previously unselected package x11proto-core-dev. Preparing to unpack .../x11proto-core-dev_7.0.26-1~ubuntu2_all.deb ... Unpacking x11proto-core-dev (7.0.26-1~ubuntu2) ... [30mProgress: [ 29%][u[30mProgress: [ 30%][uSelecting previously unselected package libice-dev:amd64. Preparing to unpack .../libice-dev_2%3a1.0.8-2_amd64.deb ... [30mProgress: [ 31%][uUnpacking libice-dev:amd64 (2:1.0.8-2) ... [30mProgress: [ 32%][uSelecting previously unselected package libpthread-stubs0-dev:amd64. Preparing to unpack .../libpthread-stubs0-dev_0.3-4_amd64.deb ... [30mProgress: [ 33%][uUnpacking libpthread-stubs0-dev:amd64 (0.3-4) ... [30mProgress: [ 34%][uSelecting previously unselected package libsm-dev:amd64. Preparing to unpack .../libsm-dev_2%3a1.2.1-2_amd64.deb ... [30mProgress: [ 35%][uUnpacking libsm-dev:amd64 (2:1.2.1-2) ... [30mProgress: [ 36%][u[30mProgress: [ 37%][uSelecting previously unselected package libxau-dev:amd64. Preparing to unpack .../libxau-dev_1%3a1.0.8-1_amd64.deb ... Unpacking libxau-dev:amd64 (1:1.0.8-1) ... [30mProgress: [ 38%][u[30mProgress: [ 39%][uSelecting previously unselected package libxdmcp-dev:amd64. Preparing to unpack .../libxdmcp-dev_1%3a1.1.1-1_amd64.deb ... [30mProgress: [ 40%][uUnpacking libxdmcp-dev:amd64 (1:1.1.1-1) ... [30mProgress: [ 41%][uSelecting previously unselected package x11proto-input-dev. Preparing to unpack .../x11proto-input-dev_2.3-1_all.deb ... [30mProgress: [ 42%][uUnpacking x11proto-input-dev (2.3-1) ... [30mProgress: [ 43%][uSelecting previously unselected package x11proto-kb-dev. Preparing to unpack .../x11proto-kb-dev_1.0.6-2_all.deb ... [30mProgress: [ 44%][uUnpacking x11proto-kb-dev (1.0.6-2) ... [30mProgress: [ 45%][uSelecting previously unselected package xtrans-dev. Preparing to unpack .../xtrans-dev_1.3.5-1~ubuntu14.04.2_all.deb ... [30mProgress: [ 46%][uUnpacking xtrans-dev (1.3.5-1~ubuntu14.04.2) ... [30mProgress: [ 47%][u[30mProgress: [ 48%][uSelecting previously unselected package libxcb1-dev:amd64. Preparing to unpack .../libxcb1-dev_1.10-2ubuntu1_amd64.deb ... Unpacking libxcb1-dev:amd64 (1.10-2ubuntu1) ... [30mProgress: [ 49%][u[30mProgress: [ 50%][uSelecting previously unselected package libx11-dev:amd64. Preparing to unpack .../libx11-dev_2%3a1.6.2-1ubuntu2.1_amd64.deb ... [30mProgress: [ 51%][uUnpacking libx11-dev:amd64 (2:1.6.2-1ubuntu2.1) ... [30mProgress: [ 52%][uSelecting previously unselected package libx11-doc. Preparing to unpack .../libx11-doc_2%3a1.6.2-1ubuntu2.1_all.deb ... [30mProgress: [ 53%][uUnpacking libx11-doc (2:1.6.2-1ubuntu2.1) ... [30mProgress: [ 54%][uSelecting previously unselected package libxt-dev:amd64. Preparing to unpack .../libxt-dev_1%3a1.1.4-1_amd64.deb ... [30mProgress: [ 55%][uUnpacking libxt-dev:amd64 (1:1.1.4-1) ... [30mProgress: [ 56%][u[30mProgress: [ 57%][uSelecting previously unselected package lksctp-tools. Preparing to unpack .../lksctp-tools_1.0.15+dfsg-1_amd64.deb ... Unpacking lksctp-tools (1.0.15+dfsg-1) ... [30mProgress: [ 58%][u[30mProgress: [ 59%][uSelecting previously unselected package openjdk-7-jdk:amd64. Preparing to unpack .../openjdk-7-jdk_7u211-2.6.17-0ubuntu0.1_amd64.deb ... [30mProgress: [ 60%][uUnpacking openjdk-7-jdk:amd64 (7u211-2.6.17-0ubuntu0.1) ... [30mProgress: [ 61%][uProcessing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for doc-base (0.10.5) ... Processing 32 changed doc-base files, 2 added doc-base files... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1.1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for mime-support (3.54ubuntu1.1) ... Processing triggers for hicolor-icon-theme (0.13-1) ... Processing triggers for fontconfig (2.11.0-0ubuntu4.2) ... Setting up tzdata-java (2019a-0ubuntu0.14.04) ... [30mProgress: [ 62%][uSetting up java-common (0.51) ... [30mProgress: [ 63%][u[30mProgress: [ 64%][uSetting up libsctp1:amd64 (1.0.15+dfsg-1) ... [30mProgress: [ 65%][uSetting up libgif4:amd64 (4.1.6-11) ... [30mProgress: [ 66%][u[30mProgress: [ 67%][uSetting up fonts-dejavu-extra (2.34-1ubuntu1) ... [30mProgress: [ 68%][uSetting up xorg-sgml-doctools (1:1.11-1) ... [30mProgress: [ 69%][u[30mProgress: [ 70%][uSetting up x11proto-core-dev (7.0.26-1~ubuntu2) ... [30mProgress: [ 71%][uSetting up libice-dev:amd64 (2:1.0.8-2) ... [30mProgress: [ 72%][u[30mProgress: [ 73%][uSetting up libpthread-stubs0-dev:amd64 (0.3-4) ... [30mProgress: [ 74%][uSetting up libsm-dev:amd64 (2:1.2.1-2) ... [30mProgress: [ 75%][u[30mProgress: [ 76%][uSetting up libxau-dev:amd64 (1:1.0.8-1) ... [30mProgress: [ 77%][uSetting up libxdmcp-dev:amd64 (1:1.1.1-1) ... [30mProgress: [ 78%][u[30mProgress: [ 79%][uSetting up x11proto-input-dev (2.3-1) ... [30mProgress: [ 80%][uSetting up x11proto-kb-dev (1.0.6-2) ... [30mProgress: [ 81%][u[30mProgress: [ 82%][uSetting up xtrans-dev (1.3.5-1~ubuntu14.04.2) ... [30mProgress: [ 83%][uSetting up libxcb1-dev:amd64 (1.10-2ubuntu1) ... [30mProgress: [ 84%][u[30mProgress: [ 85%][uSetting up libx11-dev:amd64 (2:1.6.2-1ubuntu2.1) ... [30mProgress: [ 86%][uSetting up libx11-doc (2:1.6.2-1ubuntu2.1) ... [30mProgress: [ 87%][u[30mProgress: [ 88%][uSetting up libxt-dev:amd64 (1:1.1.4-1) ... [30mProgress: [ 89%][uSetting up lksctp-tools (1.0.15+dfsg-1) ... [30mProgress: [ 90%][u[30mProgress: [ 91%][uSetting up openjdk-7-jre-headless:amd64 (7u211-2.6.17-0ubuntu0.1) ... update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode [30mProgress: [ 92%][uSetting up libatk-wrapper-java (0.30.4-4) ... [30mProgress: [ 93%][u[30mProgress: [ 94%][uSetting up ca-certificates-java (20130815ubuntu1) ... Adding debian:Swisscom_Root_EV_CA_2.pem Adding debian:AffirmTrust_Premium_ECC.pem Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem Adding debian:Entrust_Root_Certification_Authority.pem Adding debian:Microsec_e-Szigno_Root_CA_2009.pem Adding debian:QuoVadis_Root_CA_3.pem Adding debian:UbuntuOne-Go_Daddy_CA.pem Adding debian:UbuntuOne-Go_Daddy_Class_2_CA.pem Adding debian:EC-ACC.pem Adding debian:Global_Chambersign_Root_-_2008.pem Adding debian:Hellenic_Academic_and_Research_Institutions_ECC_RootCA_2015.pem Adding debian:thawte_Primary_Root_CA.pem Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem Adding debian:OpenTrust_Root_CA_G3.pem Adding debian:Cybertrust_Global_Root.pem Adding debian:LuxTrust_Global_Root_2.pem Adding debian:Actalis_Authentication_Root_CA.pem Adding debian:IdenTrust_Commercial_Root_CA_1.pem Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Sağlayıcısı_H5.pem Adding debian:GlobalSign_Root_CA_-_R2.pem Adding debian:thawte_Primary_Root_CA_-_G3.pem Adding debian:AffirmTrust_Networking.pem Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem Adding debian:Security_Communication_EV_RootCA1.pem Adding debian:Certum_Root_CA.pem Adding debian:QuoVadis_Root_CA_3_G3.pem Adding debian:ACCVRAIZ1.pem Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem Adding debian:Deutsche_Telekom_Root_CA_2.pem Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem Adding debian:EE_Certification_Centre_Root_CA.pem Adding debian:Amazon_Root_CA_1.pem Adding debian:Visa_eCommerce_Root.pem Adding debian:Camerfirma_Chambers_of_Commerce_Root.pem Adding debian:AddTrust_External_Root.pem Adding debian:COMODO_RSA_Certification_Authority.pem Adding debian:UTN_USERFirst_Hardware_Root_CA.pem Adding debian:SZAFIR_ROOT_CA2.pem Adding debian:GeoTrust_Universal_CA_2.pem Adding debian:SwissSign_Gold_CA_-_G2.pem Adding debian:AddTrust_Qualified_Certificates_Root.pem Adding debian:DigiCert_Assured_ID_Root_G3.pem Adding debian:ssl-cert-snakeoil.pem Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem Adding debian:USERTrust_RSA_Certification_Authority.pem Adding debian:Amazon_Root_CA_4.pem Adding debian:Entrust_Root_Certification_Authority_-_G2.pem Adding debian:Baltimore_CyberTrust_Root.pem Adding debian:TÜBİTAK_UEKAE_Kök_Sertifika_Hizmet_Sağlayıcısı_-_Sürüm_3.pem Adding debian:Camerfirma_Global_Chambersign_Root.pem Adding debian:Buypass_Class_3_Root_CA.pem Adding debian:DST_Root_CA_X3.pem Adding debian:Certum_Trusted_Network_CA.pem Adding debian:UbuntuOne-ValiCert_Class_2_VA.pem Adding debian:AddTrust_Low-Value_Services_Root.pem Adding debian:T-TeleSec_GlobalRoot_Class_2.pem Adding debian:CFCA_EV_ROOT.pem Adding debian:Taiwan_GRCA.pem Adding debian:Comodo_AAA_Services_root.pem Adding debian:GeoTrust_Global_CA_2.pem Adding debian:TUBITAK_Kamu_SM_SSL_Kok_Sertifikasi_-_Surum_1.pem Adding debian:XRamp_Global_CA_Root.pem Adding debian:GeoTrust_Primary_Certification_Authority.pem Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem Adding debian:Atos_TrustedRoot_2011.pem Adding debian:TWCA_Root_Certification_Authority.pem Adding debian:DST_ACES_CA_X6.pem Adding debian:COMODO_ECC_Certification_Authority.pem Adding debian:SecureTrust_CA.pem Adding debian:COMODO_Certification_Authority.pem Adding debian:Comodo_Secure_Services_root.pem Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem Adding debian:Buypass_Class_2_Root_CA.pem Adding debian:Certum_Trusted_Network_CA_2.pem Adding debian:Hongkong_Post_Root_CA_1.pem Adding debian:Amazon_Root_CA_3.pem Adding debian:USERTrust_ECC_Certification_Authority.pem Adding debian:OpenTrust_Root_CA_G1.pem Adding debian:DigiCert_Global_Root_CA.pem Adding debian:E-Tugra_Certification_Authority.pem Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem Adding debian:Certplus_Root_CA_G1.pem Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem Adding debian:Swisscom_Root_CA_2.pem Adding debian:GeoTrust_Global_CA.pem Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem Adding debian:CA_Disig_Root_R2.pem Adding debian:AffirmTrust_Premium.pem Adding debian:Go_Daddy_Class_2_CA.pem Adding debian:ISRG_Root_X1.pem Adding debian:DigiCert_Assured_ID_Root_G2.pem Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem Adding debian:QuoVadis_Root_CA_1_G3.pem Adding debian:SecureSign_RootCA11.pem Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem Adding debian:DigiCert_Trusted_Root_G4.pem Adding debian:OpenTrust_Root_CA_G2.pem Adding debian:GlobalSign_Root_CA.pem Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem Adding debian:Sonera_Class_2_Root_CA.pem Adding debian:Certinomis_-_Autorité_Racine.pem Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem Adding debian:DigiCert_Global_Root_G3.pem Adding debian:Secure_Global_CA.pem Adding debian:QuoVadis_Root_CA_2_G3.pem Adding debian:DigiCert_Assured_ID_Root_CA.pem Adding debian:Network_Solutions_Certificate_Authority.pem Adding debian:Certplus_Root_CA_G2.pem Adding debian:Izenpe.com.pem Adding debian:ePKI_Root_Certification_Authority.pem Adding debian:ACEDICOM_Root.pem Adding debian:GeoTrust_Universal_CA.pem Adding debian:thawte_Primary_Root_CA_-_G2.pem Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem Adding debian:TURKTRUST_Certificate_Services_Provider_Root_2007.pem Adding debian:Swisscom_Root_CA_1.pem Adding debian:GlobalSign_Root_CA_-_R3.pem Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem Adding debian:certSIGN_ROOT_CA.pem Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem Adding debian:QuoVadis_Root_CA.pem Adding debian:SwissSign_Silver_CA_-_G2.pem Adding debian:CA_Disig_Root_R1.pem Adding debian:Starfield_Class_2_CA.pem Adding debian:AddTrust_Public_Services_Root.pem Adding debian:Comodo_Trusted_Services_root.pem Adding debian:Security_Communication_RootCA2.pem Adding debian:Certinomis_-_Root_CA.pem Adding debian:QuoVadis_Root_CA_2.pem Adding debian:Amazon_Root_CA_2.pem Adding debian:China_Internet_Network_Information_Center_EV_Certificates_Root.pem Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem Adding debian:TWCA_Global_Root_CA.pem Adding debian:Certigna.pem Adding debian:TeliaSonera_Root_CA_v1.pem Adding debian:PSCProcert.pem Adding debian:AffirmTrust_Commercial.pem Adding debian:DigiCert_Global_Root_G2.pem Adding debian:CNNIC_ROOT.pem Adding debian:VeriSign_Universal_Root_Certification_Authority.pem Adding debian:Certplus_Class_2_Primary_CA.pem Adding debian:AC_RAIZ_FNMT-RCM.pem Adding debian:Trustis_FPS_Root_CA.pem Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem Adding debian:T-TeleSec_GlobalRoot_Class_3.pem Adding debian:Chambers_of_Commerce_Root_-_2008.pem Adding debian:Security_Communication_Root_CA.pem Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2015.pem done. Setting up libatk-wrapper-java-jni:amd64 (0.30.4-4) ... [30mProgress: [ 95%][u[30mProgress: [ 96%][uSetting up openjdk-7-jre:amd64 (7u211-2.6.17-0ubuntu0.1) ... [30mProgress: [ 97%][uupdate-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode Setting up openjdk-7-jdk:amd64 (7u211-2.6.17-0ubuntu0.1) ... [30mProgress: [ 98%][uupdate-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/idlj to provide /usr/bin/idlj (idlj) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jhat to provide /usr/bin/jhat (jhat) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto mode update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/bin/xjc to provide /usr/bin/xjc (xjc) in auto mode [30mProgress: [ 99%][uProcessing triggers for libc-bin (2.19-0ubuntu6.14) ... Processing triggers for ca-certificates (20170717~14.04.2) ... [30mProgress: [100%][uUpdating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d.... done. done.
Ubuntu 16.04.7 desktop
1, 首先备份apt源,然后替换为Ubuntu 14.04的源:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak $ sudo vim /etc/apt/sources.list # 替换为ubuntu 14.04的源. $ sudo apt update
2, 安装openjdk 7:
$ sudo apt autoremove tzdata # 因tzdata-java需要,ubuntu 16的tzdata版本需降级,这里降级成ubuntu 14的版本. $ sudo apt install tzdata=2019a-0ubuntu0.14.04 $ sudo add-apt-repository ppa:openjdk-r/ppa $ sudo apt update $ sudo apt-cache search openjdk $ sudo apt install tzdata-java $ sudo apt install openjdk-7-jre-headless $ sudo apt install openjdk-7-jre $ sudo apt install openjdk-7-jdk
经过以上步骤,就可以在ubuntu中安装上openjdk 7了,但是,我把源换回ubuntu 16的,再安装openjdk 8,就会覆盖掉openjdk 7,保持使用ubuntu 14源的情况下安装openjdk 8没有测试,你们可以自己试试。