内部linux服务器上不了外网,但又需要安装某些软件包,坑爹的是linux中的软件包安装依赖有比较多。或者说有时就是需要使用yum去下载rpm,但是又不想在服务器安装该软件包。总之为了满足这种奇葩需求,试试下面操作吧
CentOS 或 RHEL环境下包管理工具yum可以很好的解决linux下的软件包安装依赖问题,下面就演示如何使用yum命令去下载docker的安装介质,但是不做安装操作:
[root@DevOps docker]# yum install --downloaddir=/tmp/tmp_docker/ --downloadonly docker-engine
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:17.05.0.ce-1.el7.centos will be installed
--> Processing Dependency: selinux-policy >= 3.13.1-23 for package: docker-engine-17.05.0.ce-1.el7.centos.x86_64
--> Running transaction check
---> Package selinux-policy.noarch 0:3.13.1-166.el7_4.9 will be installed
--> Processing Dependency: policycoreutils >= 2.5 for package: selinux-policy-3.13.1-166.el7_4.9.noarch
--> Running transaction check
---> Package policycoreutils.x86_64 0:2.5-17.1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================
Installing:
docker-engine x86_64 17.05.0.ce-1.el7.centos dockerrepo 19 M
Installing for dependencies:
policycoreutils x86_64 2.5-17.1.el7 base 858 k
selinux-policy noarch 3.13.1-166.el7_4.9 updates 437 k
Transaction Summary
=============================================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total size: 21 M
Installed size: 75 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@DevOps docker]#
只下载包到指定目录中,但不执行安装操作。