【CentOS】yum install --downloadonly 下载依赖包研究

在CentOS中可以使用yum自动安装软件,在离线环境中却行不通。

  • Linux localhost 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

对于同一版本CentOS,我们可以事先下载离线依赖包,后面用命令手动安装。

  • Java

自动安装命令:

yum install -y java

安装结果:

Installed:
  java-1.8.0-openjdk.x86_64 1:1.8.0.121-0.b13.el7_3
Dependency Installed:
  copy-jdk-configs.noarch 0:1.2-1.el7                                           fontconfig.x86_64 0:2.10.95-10.el7
  fontpackages-filesystem.noarch 0:1.44-8.el7                                   giflib.x86_64 0:4.1.6-9.el7
  java-1.8.0-openjdk-headless.x86_64 1:1.8.0.121-0.b13.el7_3                    javapackages-tools.noarch 0:3.4.1-11.el7
  libICE.x86_64 0:1.0.9-2.el7                                                   libSM.x86_64 0:1.2.2-2.el7
  libX11.x86_64 0:1.6.3-3.el7                                                   libX11-common.noarch 0:1.6.3-3.el7
  libXau.x86_64 0:1.0.8-2.1.el7                                                 libXcomposite.x86_64 0:0.4.4-4.1.el7
  libXext.x86_64 0:1.3.3-3.el7                                                  libXfont.x86_64 0:1.5.1-2.el7
  libXi.x86_64 0:1.7.4-2.el7                                                    libXrender.x86_64 0:0.9.8-2.1.el7
  libXtst.x86_64 0:1.2.2-2.1.el7                                                libfontenc.x86_64 0:1.1.2-3.el7
  libjpeg-turbo.x86_64 0:1.2.90-5.el7                                           libpng.x86_64 2:1.5.13-7.el7_2
  libxcb.x86_64 0:1.11-4.el7                                                    libxslt.x86_64 0:1.1.28-5.el7
  lksctp-tools.x86_64 0:1.0.17-2.el7                                            python-javapackages.noarch 0:3.4.1-11.el7
  python-lxml.x86_64 0:3.2.1-4.el7                                              ttmkfdir.x86_64 0:3.0.9-42.el7
  tzdata-java.noarch 0:2017b-1.el7                                              xorg-x11-font-utils.x86_64 1:7.5-20.el7
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7         

如果手动去一个个找依赖是很困难的,即便已经知道名字、版本,下面就依赖系统自带的命令完成该步骤

yum install --downloadonly --downloaddir=/home/java java

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.121-0.b13.el7_3 will be installed
--> Processing Dependency: java-1.8.0-openjdk-headless = 1:1.8.0.121-0.b13.el7_3 for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjli.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: fontconfig(x86-64) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjli.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libawt.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libXtst.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libXrender.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libXi.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libXext.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libXcomposite.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
--> Running transaction check
---> Package fontconfig.x86_64 0:2.10.95-10.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.10.95-10.el7.x86_64
---> Package giflib.x86_64 0:4.1.6-9.el7 will be installed
--> Processing Dependency: libSM.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
--> Processing Dependency: libICE.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64
---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.121-0.b13.el7_3 will be installed
--> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: copy-jdk-configs >= 1.1-3 for package: 1:java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64
--> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64
---> Package libX11.x86_64 0:1.6.3-3.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.3-3.el7 for package: libX11-1.6.3-3.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.3-3.el7.x86_64
---> Package libXcomposite.x86_64 0:0.4.4-4.1.el7 will be installed
---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed
---> Package libXi.x86_64 0:1.7.4-2.el7 will be installed
---> Package libXrender.x86_64 0:0.9.8-2.1.el7 will be installed
---> Package libXtst.x86_64 0:1.2.2-2.1.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-5.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed
---> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
--> Running transaction check
---> Package copy-jdk-configs.noarch 0:1.2-1.el7 will be installed
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch
--> Processing Dependency: libxslt for package: javapackages-tools-3.4.1-11.el7.noarch
---> Package libICE.x86_64 0:1.0.9-2.el7 will be installed
---> Package libSM.x86_64 0:1.2.2-2.el7 will be installed
---> Package libX11-common.noarch 0:1.6.3-3.el7 will be installed
---> Package libxcb.x86_64 0:1.11-4.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.11-4.el7.x86_64
---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed
---> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
---> Package tzdata-java.noarch 0:2017b-1.el7 will be installed
---> Package xorg-x11-font-utils.x86_64 1:7.5-20.el7 will be installed
--> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-20.el7.x86_64
--> Processing Dependency: libXfont.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-20.el7.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libXfont.x86_64 0:1.5.1-2.el7 will be installed
---> Package libfontenc.x86_64 0:1.1.2-3.el7 will be installed
---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed
---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed
--> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                                     Arch                   Version                                    Repository               Size
=============================================================================================================================================
Installing:
 java-1.8.0-openjdk                          x86_64                 1:1.8.0.121-0.b13.el7_3                    updates                 232 k
Installing for dependencies:
 copy-jdk-configs                            noarch                 1.2-1.el7                                  base                     14 k
 fontconfig                                  x86_64                 2.10.95-10.el7                             base                    229 k
 fontpackages-filesystem                     noarch                 1.44-8.el7                                 base                    9.9 k
 giflib                                      x86_64                 4.1.6-9.el7                                base                     40 k
 java-1.8.0-openjdk-headless                 x86_64                 1:1.8.0.121-0.b13.el7_3                    updates                  31 M
 javapackages-tools                          noarch                 3.4.1-11.el7                               base                     73 k
 libICE                                      x86_64                 1.0.9-2.el7                                base                     65 k
 libSM                                       x86_64                 1.2.2-2.el7                                base                     39 k
 libX11                                      x86_64                 1.6.3-3.el7                                base                    606 k
 libX11-common                               noarch                 1.6.3-3.el7                                base                    162 k
 libXau                                      x86_64                 1.0.8-2.1.el7                              base                     29 k
 libXcomposite                               x86_64                 0.4.4-4.1.el7                              base                     22 k
 libXext                                     x86_64                 1.3.3-3.el7                                base                     39 k
 libXfont                                    x86_64                 1.5.1-2.el7                                base                    150 k
 libXi                                       x86_64                 1.7.4-2.el7                                base                     40 k
 libXrender                                  x86_64                 0.9.8-2.1.el7                              base                     25 k
 libXtst                                     x86_64                 1.2.2-2.1.el7                              base                     20 k
 libfontenc                                  x86_64                 1.1.2-3.el7                                base                     30 k
 libjpeg-turbo                               x86_64                 1.2.90-5.el7                               base                    134 k
 libpng                                      x86_64                 2:1.5.13-7.el7_2                           base                    213 k
 libxcb                                      x86_64                 1.11-4.el7                                 base                    189 k
 libxslt                                     x86_64                 1.1.28-5.el7                               base                    242 k
 lksctp-tools                                x86_64                 1.0.17-2.el7                               base                     88 k
 python-javapackages                         noarch                 3.4.1-11.el7                               base                     31 k
 python-lxml                                 x86_64                 3.2.1-4.el7                                base                    758 k
 ttmkfdir                                    x86_64                 3.0.9-42.el7                               base                     48 k
 tzdata-java                                 noarch                 2017b-1.el7                                updates                 183 k
 xorg-x11-font-utils                         x86_64                 1:7.5-20.el7                               base                     87 k
 xorg-x11-fonts-Type1                        noarch                 7.5-9.el7                                  base                    521 k

Transaction Summary
=============================================================================================================================================
Install  1 Package (+29 Dependent packages)

Total download size: 36 M
Installed size: 114 M
Background downloading packages, then exiting:
(1/30): copy-jdk-configs-1.2-1.el7.noarch.rpm                                                                         |  14 kB  00:00:00
(2/30): fontpackages-filesystem-1.44-8.el7.noarch.rpm                                                                 | 9.9 kB  00:00:00
(3/30): java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64.rpm                                                           | 232 kB  00:00:00
(4/30): javapackages-tools-3.4.1-11.el7.noarch.rpm                                                                    |  73 kB  00:00:00
(5/30): giflib-4.1.6-9.el7.x86_64.rpm                                                                                 |  40 kB  00:00:00
(6/30): libSM-1.2.2-2.el7.x86_64.rpm                                                                                  |  39 kB  00:00:00
(7/30): libICE-1.0.9-2.el7.x86_64.rpm                                                                                 |  65 kB  00:00:00
(8/30): libX11-common-1.6.3-3.el7.noarch.rpm                                                                          | 162 kB  00:00:00
(9/30): libXau-1.0.8-2.1.el7.x86_64.rpm                                                                               |  29 kB  00:00:00
(10/30): libXext-1.3.3-3.el7.x86_64.rpm                                                                               |  39 kB  00:00:00
(11/30): libX11-1.6.3-3.el7.x86_64.rpm                                                                                | 606 kB  00:00:00
(12/30): libXi-1.7.4-2.el7.x86_64.rpm                                                                                 |  40 kB  00:00:00
(13/30): libXrender-0.9.8-2.1.el7.x86_64.rpm                                                                          |  25 kB  00:00:00
(14/30): libXtst-1.2.2-2.1.el7.x86_64.rpm                                                                             |  20 kB  00:00:00
(15/30): libfontenc-1.1.2-3.el7.x86_64.rpm                                                                            |  30 kB  00:00:00
(16/30): libXfont-1.5.1-2.el7.x86_64.rpm                                                                              | 150 kB  00:00:00
(17/30): libXcomposite-0.4.4-4.1.el7.x86_64.rpm                                                                       |  22 kB  00:00:00
(18/30): libpng-1.5.13-7.el7_2.x86_64.rpm                                                                             | 213 kB  00:00:00
(19/30): libxcb-1.11-4.el7.x86_64.rpm                                                                                 | 189 kB  00:00:00
(20/30): libxslt-1.1.28-5.el7.x86_64.rpm                                                                              | 242 kB  00:00:00
(21/30): lksctp-tools-1.0.17-2.el7.x86_64.rpm                                                                         |  88 kB  00:00:00
(22/30): python-javapackages-3.4.1-11.el7.noarch.rpm                                                                  |  31 kB  00:00:00
(23/30): libjpeg-turbo-1.2.90-5.el7.x86_64.rpm                                                                        | 134 kB  00:00:00
(24/30): ttmkfdir-3.0.9-42.el7.x86_64.rpm                                                                             |  48 kB  00:00:00
(25/30): fontconfig-2.10.95-10.el7.x86_64.rpm                                                                         | 229 kB  00:00:00
(26/30): xorg-x11-font-utils-7.5-20.el7.x86_64.rpm                                                                    |  87 kB  00:00:00
(27/30): tzdata-java-2017b-1.el7.noarch.rpm                                                                           | 183 kB  00:00:00
(28/30): python-lxml-3.2.1-4.el7.x86_64.rpm                                                                           | 758 kB  00:00:00
(29/30): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm                                                                    | 521 kB  00:00:00
(30/30): java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64.rpm                                                 |  31 MB  00:00:12
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                        2.9 MB/s |  36 MB  00:00:12
exiting because "Download Only" specified

[[email protected] ~]# ls /home/java/ -al
total 36604
drwxr-xr-x. 2 root root     4096 Apr  6 12:11 .
drwxr-xr-x. 4 root root       28 Apr  6 12:11 ..
-rw-r--r--. 1 root root    14344 Nov 21 01:26 copy-jdk-configs-1.2-1.el7.noarch.rpm
-rw-r--r--. 1 root root   234644 Nov 21 01:44 fontconfig-2.10.95-10.el7.x86_64.rpm
-rw-r--r--. 1 root root    10116 Jul  4  2014 fontpackages-filesystem-1.44-8.el7.noarch.rpm
-rw-r--r--. 1 root root    40964 Jul  4  2014 giflib-4.1.6-9.el7.x86_64.rpm
-rw-r--r--. 1 root root   237780 Jan 21 23:40 java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64.rpm
-rw-r--r--. 1 root root 32869056 Jan 21 23:41 java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64.rpm
-rw-r--r--. 1 root root    74556 Nov 25  2015 javapackages-tools-3.4.1-11.el7.noarch.rpm
-rw-r--r--. 1 root root    30908 Nov 25  2015 libfontenc-1.1.2-3.el7.x86_64.rpm
-rw-r--r--. 1 root root    66412 Nov 25  2015 libICE-1.0.9-2.el7.x86_64.rpm
-rw-r--r--. 1 root root   137244 Jul  4  2014 libjpeg-turbo-1.2.90-5.el7.x86_64.rpm
-rw-r--r--. 1 root root   217608 Dec 10  2015 libpng-1.5.13-7.el7_2.x86_64.rpm
-rw-r--r--. 1 root root    40160 Nov 25  2015 libSM-1.2.2-2.el7.x86_64.rpm
-rw-r--r--. 1 root root   620248 Nov 21 03:20 libX11-1.6.3-3.el7.x86_64.rpm
-rw-r--r--. 1 root root   165848 Nov 21 03:20 libX11-common-1.6.3-3.el7.noarch.rpm
-rw-r--r--. 1 root root    29784 Jul  4  2014 libXau-1.0.8-2.1.el7.x86_64.rpm
-rw-r--r--. 1 root root   193704 Nov 25  2015 libxcb-1.11-4.el7.x86_64.rpm
-rw-r--r--. 1 root root    22792 Jul  4  2014 libXcomposite-0.4.4-4.1.el7.x86_64.rpm
-rw-r--r--. 1 root root    39572 Nov 25  2015 libXext-1.3.3-3.el7.x86_64.rpm
-rw-r--r--. 1 root root   153884 Nov 25  2015 libXfont-1.5.1-2.el7.x86_64.rpm
-rw-r--r--. 1 root root    40604 Nov 25  2015 libXi-1.7.4-2.el7.x86_64.rpm
-rw-r--r--. 1 root root    26076 Jul  4  2014 libXrender-0.9.8-2.1.el7.x86_64.rpm
-rw-r--r--. 1 root root   247484 Jul  4  2014 libxslt-1.1.28-5.el7.x86_64.rpm
-rw-r--r--. 1 root root    20556 Jul  4  2014 libXtst-1.2.2-2.1.el7.x86_64.rpm
-rw-r--r--. 1 root root    89660 Nov 21 03:21 lksctp-tools-1.0.17-2.el7.x86_64.rpm
-rw-r--r--. 1 root root    31836 Nov 25  2015 python-javapackages-3.4.1-11.el7.noarch.rpm
-rw-r--r--. 1 root root   776320 Jul  4  2014 python-lxml-3.2.1-4.el7.x86_64.rpm
-rw-r--r--. 1 root root    48676 Nov 26  2015 ttmkfdir-3.0.9-42.el7.x86_64.rpm
-rw-r--r--. 1 root root   187080 Mar 28 23:40 tzdata-java-2017b-1.el7.noarch.rpm
-rw-r--r--. 1 root root   533720 Jul  4  2014 xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm
-rw-r--r--. 1 root root    89400 Nov 26  2015 xorg-x11-font-utils-7.5-20.el7.x86_64.rpm

从download的过程来看,30个rpm需要按照,其中有3个为updates;

我们将update单独列出,这里需要在java目录新建update目录,然后将三个update类型rpm移动过去,最终形成文件树如下:

[[email protected] java]# tree
.
├── copy-jdk-configs-1.2-1.el7.noarch.rpm
├── fontconfig-2.10.95-10.el7.x86_64.rpm
├── fontpackages-filesystem-1.44-8.el7.noarch.rpm
├── giflib-4.1.6-9.el7.x86_64.rpm
├── install.sh
├── javapackages-tools-3.4.1-11.el7.noarch.rpm
├── libfontenc-1.1.2-3.el7.x86_64.rpm
├── libICE-1.0.9-2.el7.x86_64.rpm
├── libjpeg-turbo-1.2.90-5.el7.x86_64.rpm
├── libpng-1.5.13-7.el7_2.x86_64.rpm
├── libSM-1.2.2-2.el7.x86_64.rpm
├── libX11-1.6.3-3.el7.x86_64.rpm
├── libX11-common-1.6.3-3.el7.noarch.rpm
├── libXau-1.0.8-2.1.el7.x86_64.rpm
├── libxcb-1.11-4.el7.x86_64.rpm
├── libXcomposite-0.4.4-4.1.el7.x86_64.rpm
├── libXext-1.3.3-3.el7.x86_64.rpm
├── libXfont-1.5.1-2.el7.x86_64.rpm
├── libXi-1.7.4-2.el7.x86_64.rpm
├── libXrender-0.9.8-2.1.el7.x86_64.rpm
├── libxslt-1.1.28-5.el7.x86_64.rpm
├── libXtst-1.2.2-2.1.el7.x86_64.rpm
├── lksctp-tools-1.0.17-2.el7.x86_64.rpm
├── python-javapackages-3.4.1-11.el7.noarch.rpm
├── python-lxml-3.2.1-4.el7.x86_64.rpm
├── ttmkfdir-3.0.9-42.el7.x86_64.rpm
├── update
│   ├── java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64.rpm
│   ├── java-1.8.0-openjdk-headless-1.8.0.121-0.b13.el7_3.x86_64.rpm
│   └── tzdata-java-2017b-1.el7.noarch.rpm
├── xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm
└── xorg-x11-font-utils-7.5-20.el7.x86_64.rpm

在同层目录,创建install.sh

[[email protected] java]# cat install.sh
#author    : wangbaobao
#release   : 2017-4-6
#company   : YZ Co., LTD  

rpm -ivh *.rpm
rpm -Uvh update/*.rpm

测试:

[[email protected] java]# chmod 750 install.sh
[[email protected] java]# sh install.sh
Preparing...                          ################################# [100%]
Updating / installing...
   1:libxslt-1.1.28-5.el7             ################################# [  4%]
   2:libICE-1.0.9-2.el7               ################################# [  7%]
   3:libfontenc-1.1.2-3.el7           ################################# [ 11%]
   4:libXfont-1.5.1-2.el7             ################################# [ 15%]
   5:xorg-x11-font-utils-1:7.5-20.el7 ################################# [ 19%]
   6:libSM-1.2.2-2.el7                ################################# [ 22%]
   7:python-lxml-3.2.1-4.el7          ################################# [ 26%]
   8:python-javapackages-3.4.1-11.el7 ################################# [ 30%]
   9:ttmkfdir-3.0.9-42.el7            ################################# [ 33%]
  10:libXau-1.0.8-2.1.el7             ################################# [ 37%]
  11:libxcb-1.11-4.el7                ################################# [ 41%]
  12:libX11-common-1.6.3-3.el7        ################################# [ 44%]
  13:libX11-1.6.3-3.el7               ################################# [ 48%]
  14:libXext-1.3.3-3.el7              ################################# [ 52%]
  15:libXi-1.7.4-2.el7                ################################# [ 56%]
  16:fontpackages-filesystem-1.44-8.el################################# [ 59%]
  17:fontconfig-2.10.95-10.el7        ################################# [ 63%]
  18:xorg-x11-fonts-Type1-7.5-9.el7   ################################# [ 67%]
  19:libXtst-1.2.2-2.1.el7            ################################# [ 70%]
  20:giflib-4.1.6-9.el7               ################################# [ 74%]
  21:libXcomposite-0.4.4-4.1.el7      ################################# [ 78%]
  22:libXrender-0.9.8-2.1.el7         ################################# [ 81%]
  23:javapackages-tools-3.4.1-11.el7  ################################# [ 85%]
  24:lksctp-tools-1.0.17-2.el7        ################################# [ 89%]
  25:libpng-2:1.5.13-7.el7_2          ################################# [ 93%]
  26:libjpeg-turbo-1.2.90-5.el7       ################################# [ 96%]
  27:copy-jdk-configs-1.2-1.el7       ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:tzdata-java-2017b-1.el7          ################################# [ 33%]
   2:java-1.8.0-openjdk-headless-1:1.8################################# [ 67%]
   3:java-1.8.0-openjdk-1:1.8.0.121-0.################################# [100%]
[[email protected] java]# java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

综上所述,可以通过预先下载依赖,快速完成1.8.0_121版本java的离线安装。

有个小问题,install.sh中rpm是先执行安装base还是updates?

===> 从目前来看,如果主文件为base则先安装updates,如果主文件为updates则先安装base。java主文件为update,所以shell中先执行base安装。

bye

2017-4-6

时间: 2024-10-01 07:51:52

【CentOS】yum install --downloadonly 下载依赖包研究的相关文章

18、通过yum命令只下载rpm包不安装

18.1.说明: 经常遇到服务器没有网络的情况下部署环境,或者创建自己的 yum 仓库等,这时就需要下载 rpm 包. 18.2.方法一,yumdownloader(推荐): 如果只想通过 yum 下载软件包,但是不需要进行安装的话,可以使用 yumdownloader 命令, yumdownloader 命令在软件包 yum-utils 里面. 1.安装 yum-utils 软件包: yum install yum-utils -y 参数说明: --destdir:指定下载的软件包存放路径,不

centos yum install redis

centos yum install redis linux下yum安装redis以及使用 1.yum install redis      --查看是否有redis   yum 源 [[email protected] ~]# yum install redis 已加载插件:fastestmirror base | 3.6 kB 00:00 docker-ce-edge | 2.9 kB 00:00 docker-ce-stable | 2.9 kB 00:00 extras | 3.4 kB

用Yumdownloader将YUM安装包及其依赖包下载到本地

我们可以通过 yum 命令的 Yumdownloader 插件下载 RPM 软件包及其所有依赖包. 安装yum-utils 以通过–destdir 来指定位置,软件包和依赖的软件将被下载到此目录 命令格式:yumdownloader --resolve(可选,意为下依赖包) --destdir=软件存放位置 (可选) +软件包名 原文地址:https://www.cnblogs.com/zhangshuaihui/p/12336868.html

【转载】使用yum框架流畅安装依赖包

http://blog.chinaunix.net/uid-14504139-id-3852208.html 安装linux的rpm包经常遇到要安装一堆依赖包的问题,使用yum可以顺利安装,但是如果无法连接到网络的情况下,也希望使用yum来流畅安装rpm. 1.先从系统盘中安装以下3个rpm包deltarpm.python-deltarpm.createrepo [[email protected] Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git

[linux]centos7下解决yum install mysql-server没有可用包

1.下载mysql的repo源 [[email protected] ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2.安装mysql-community-release-el7-5.noarch.rpm包 [[email protected] ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm 3.查看安装的MySQ源 [[email pro

使用Maven下载依赖包及使用Nexus搭建私服

在项目的搭建过程中,所以很多时候我们需要上网去一个一个找项目的依赖包.这个过程确实是一个效率很低而且很让人恼火的事情. 很多时候能找到对应的官网下载固然是好,但是大部分时候我们都只能在一些第三方网站上下载未知的版本. 所以我们需要一个Maven. Maven使用 Maven核心自带的远程仓库,包括了绝大部分开源构件.我们可以很方便通过Maven提供的坐标机制便捷的下载到你心仪的依赖包. Maven下载.安装 下载地址: http://maven.apache.org/download.html

centos7解决yum install mysql-server没有可用包?

第一步:安装从网上下载文件的wget命令 [[email protected] ~]# yum -y install wget 第二步:下载mysql的repo源 [[email protected] ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 第三步:安装mysql-community-release-el7-5.noarch.rpm包 [[email protected] ~]# rpm -i

SBT 无法下载依赖包

之前做过一个项目是用  sbt 管理依赖的,被坑得不要不要的.. 拉取依赖时总是提示无法连接,但用浏览器可以访问相应的网站(typesafe, jcenter) 提示的错误为: Server access Error: Connection timed out url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.8/ivys/ivy.xml 捣鼓了半天终于找到了解决的方法——将依赖包的地址改成htt

centos yum命令找不到包

https://blog.csdn.net/joe_le/article/details/80107832 yum  install epel-release  //扩展包更新包 yum  update //更新yum源 原文地址:https://www.cnblogs.com/newrohlzy/p/10004629.html