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
复制代码
复制代码
[root@localhost ~]# 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移动过去,最终形成文件树如下:
复制代码
[root@localhost 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
复制代码
[root@localhost java]# cat install.sh
author : wangbaobao
release : 2017-4-6
company : YZ Co.,LTD
rpm -ivh *.rpm
rpm -Uvh update/*.rpm
复制代码
测试:
复制代码
[root@localhost java]# chmod 750 install.sh
[root@localhost 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%]
[root@localhost 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
http://www.cnblogs.com/wangbaobao/p/6674272.html,这是原文。
http://blog.itpub.net/29475508/viewspace-2081473/
这个使用yumloader
方法一:yum
yum命令本身就可以用来下载一个RPM包,标准的yum命令提供了–downloadonly(只下载)的选项来达到这个目的。
1.$ sudo yum install –downloadonly
默认情况下,一个下载的RPM包会保存在下面的目录中:
1./var/cache/yum/x86_64/[centos/fedora-version]/[repository]/packages
以上的[repository]表示下载包的来源仓库的名称(例如:base、fedora、updates)
如果你想要将一个包下载到一个指定的目录(如/tmp):
1.$ sudo yum install –downloadonly –downloaddir=/tmp
注意,如果下载的包包含了任何没有满足的依赖关系,yum将会把所有的依赖关系包下载,但是都不会被安装。
另外一个重要的事情是,在CentOS/RHEL 6或更早期的版本中,你需要安装一个单独yum插件(名称为 yum-plugin-downloadonly)才能使用–downloadonly命令选项:
1.$ sudo yum install yum-plugin-downloadonly
如果没有该插件,你会在使用yum时得到以下错误:
1.Command line error:no such option:–downloadonly
方法二: Yumdownloader
另外一个下载RPM包的方法就是通过一个专门的包下载工具–yumdownloader。 这个工具是yum工具包(包含了用来进行yum包管理的帮助工具套件)的子集。
1.$ sudo yum install yum-utils
下载一个RPM包:
1.$ sudo yumdownloader
下载的包会被保存在当前目录中。你需要使用root权限,因为yumdownloader会在下载过程中更新包索引文件。与yum命令不同的是,任何依赖包不会被下载。
CentOS中将DVD作为默认yum源的设置方法 http://www.linuxidc.com/Linux/2015-01/111266.htm
RedHat 6.2 Linux修改yum源免费使用CentOS源 http://www.linuxidc.com/Linux/2013-07/87383.htm
配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm
Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm
yum的配置文件说明 http://www.linuxidc.com/Linux/2013-04/83298.htm
RedHat 6.1下安装yum(图文) http://www.linuxidc.com/Linux/2013-06/86535.htm
YUM 安装及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm
CentOS 6.4上搭建yum本地源 http://www.linuxidc.com/Linux/2014-07/104533.htm