yum下载依赖包到本地但不安装

开局一个命令

yum install --downloadonly --downloaddir=<directory> <package-name>

备注:下载的安装包在打包的这台机器上没有安装过,也没有卸载过

操作案例一

[root@bogon ~]# yum install --downloadonly --downloaddir=/root/docker docker
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package docker.x86_64 2:1.13.1-162.git64e9980.el7.centos will be installed
--> Processing Dependency: docker-common = 2:1.13.1-162.git64e9980.el7.centos for package: 2:docker-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: docker-client = 2:1.13.1-162.git64e9980.el7.centos for package: 2:docker-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: subscription-manager-rhsm-certificates for package: 2:docker-1.13.1-162.git64e9980.el7.centos.x86_64
--> Running transaction check
---> Package docker-client.x86_64 2:1.13.1-162.git64e9980.el7.centos will be installed
---> Package docker-common.x86_64 2:1.13.1-162.git64e9980.el7.centos will be installed
--> Processing Dependency: skopeo-containers >= 1:0.1.26-2 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: oci-umount >= 2:2.3.3-3 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: oci-systemd-hook >= 1:0.1.4-9 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: oci-register-machine >= 1:0-5.13 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: container-storage-setup >= 0.9.0-1 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: container-selinux >= 2:2.51-1 for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
--> Processing Dependency: atomic-registries for package: 2:docker-common-1.13.1-162.git64e9980.el7.centos.x86_64
---> Package subscription-manager-rhsm-certificates.x86_64 0:1.24.26-3.el7.centos will be installed
--> Running transaction check
---> Package atomic-registries.x86_64 1:1.22.1-33.gitb507039.el7_8 will be installed
--> Processing Dependency: python-yaml for package: 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64
--> Processing Dependency: python-setuptools for package: 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64
--> Processing Dependency: python-pytoml for package: 1:atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7 will be installed
---> Package containers-common.x86_64 1:0.1.40-11.el7_8 will be installed
--> Processing Dependency: subscription-manager for package: 1:containers-common-0.1.40-11.el7_8.x86_64
--> Processing Dependency: slirp4netns for package: 1:containers-common-0.1.40-11.el7_8.x86_64
--> Processing Dependency: fuse-overlayfs for package: 1:containers-common-0.1.40-11.el7_8.x86_64
---> Package oci-register-machine.x86_64 1:0-6.git2b44233.el7 will be installed
---> Package oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6 will be installed
--> Processing Dependency: libyajl.so.2()(64bit) for package: 1:oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64
---> Package oci-umount.x86_64 2:2.5-3.el7 will be installed
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: policycoreutils = 2.5-34.el7 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
---> Package python-pytoml.noarch 0:0.1.14-1.git7dea353.el7 will be installed
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
---> Package subscription-manager.x86_64 0:1.24.26-3.el7.centos will be installed
--> Processing Dependency: subscription-manager-rhsm = 1.24.26 for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-dmidecode >= 3.12.2-2 for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: usermode for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-syspurpose for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-six for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-inotify for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-ethtool for package: subscription-manager-1.24.26-3.el7.centos.x86_64
--> Processing Dependency: python-dateutil for package: subscription-manager-1.24.26-3.el7.centos.x86_64
---> Package yajl.x86_64 0:2.0.4-4.el7 will be installed
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
--> Processing Dependency: audit-libs(x86-64) = 2.8.5-4.el7 for package: audit-libs-python-2.8.5-4.el7.x86_64
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package policycoreutils.x86_64 0:2.5-29.el7 will be updated
---> Package policycoreutils.x86_64 0:2.5-34.el7 will be an update
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
---> Package python-dateutil.noarch 0:1.5-7.el7 will be installed
---> Package python-dmidecode.x86_64 0:3.12.2-4.el7 will be installed
--> Processing Dependency: libxml2-python for package: python-dmidecode-3.12.2-4.el7.x86_64
--> Processing Dependency: libxml2mod.so()(64bit) for package: python-dmidecode-3.12.2-4.el7.x86_64
---> Package python-ethtool.x86_64 0:0.8-8.el7 will be installed
--> Processing Dependency: libnl.so.1()(64bit) for package: python-ethtool-0.8-8.el7.x86_64
---> Package python-inotify.noarch 0:0.9.4-4.el7 will be installed
---> Package python-six.noarch 0:1.9.0-2.el7 will be installed
---> Package python-syspurpose.x86_64 0:1.24.26-3.el7.centos will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
---> Package subscription-manager-rhsm.x86_64 0:1.24.26-3.el7.centos will be installed
---> Package usermode.x86_64 0:1.111-6.el7 will be installed
--> Running transaction check
---> Package audit-libs.x86_64 0:2.8.4-4.el7 will be updated
--> Processing Dependency: audit-libs(x86-64) = 2.8.4-4.el7 for package: audit-2.8.4-4.el7.x86_64
---> Package audit-libs.x86_64 0:2.8.5-4.el7 will be an update
---> Package libnl.x86_64 0:1.1.4-3.el7 will be installed
---> Package libxml2-python.x86_64 0:2.9.1-6.el7.4 will be installed
--> Processing Dependency: libxml2 = 2.9.1-6.el7.4 for package: libxml2-python-2.9.1-6.el7.4.x86_64
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Running transaction check
---> Package audit.x86_64 0:2.8.4-4.el7 will be updated
---> Package audit.x86_64 0:2.8.5-4.el7 will be an update
---> Package libxml2.x86_64 0:2.9.1-6.el7_2.3 will be updated
---> Package libxml2.x86_64 0:2.9.1-6.el7.4 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                               Arch                  Version                                            Repository              Size
=============================================================================================================================================================
Installing:
 docker                                                x86_64                2:1.13.1-162.git64e9980.el7.centos                 extras                  18 M
Installing for dependencies:
 PyYAML                                                x86_64                3.10-11.el7                                        base                   153 k
 atomic-registries                                     x86_64                1:1.22.1-33.gitb507039.el7_8                       extras                  36 k
 audit-libs-python                                     x86_64                2.8.5-4.el7                                        base                    76 k
 checkpolicy                                           x86_64                2.5-8.el7                                          base                   295 k
 container-selinux                                     noarch                2:2.119.2-1.911c772.el7_8                          extras                  40 k
 container-storage-setup                               noarch                0.11.0-2.git5eaf76c.el7                            extras                  35 k
 containers-common                                     x86_64                1:0.1.40-11.el7_8                                  extras                  43 k
 docker-client                                         x86_64                2:1.13.1-162.git64e9980.el7.centos                 extras                 3.9 M
 docker-common                                         x86_64                2:1.13.1-162.git64e9980.el7.centos                 extras                  99 k
 fuse-overlayfs                                        x86_64                0.7.2-6.el7_8                                      extras                  54 k
 fuse3-libs                                            x86_64                3.6.1-4.el7                                        extras                  82 k
 libcgroup                                             x86_64                0.41-21.el7                                        base                    66 k
 libnl                                                 x86_64                1.1.4-3.el7                                        base                   128 k
 libsemanage-python                                    x86_64                2.5-14.el7                                         base                   113 k
 libxml2-python                                        x86_64                2.9.1-6.el7.4                                      base                   247 k
 libyaml                                               x86_64                0.1.4-11.el7_0                                     base                    55 k
 oci-register-machine                                  x86_64                1:0-6.git2b44233.el7                               extras                 1.1 M
 oci-systemd-hook                                      x86_64                1:0.2.0-1.git05e6923.el7_6                         extras                  34 k
 oci-umount                                            x86_64                2:2.5-3.el7                                        extras                  33 k
 policycoreutils-python                                x86_64                2.5-34.el7                                         base                   457 k
 python-IPy                                            noarch                0.75-6.el7                                         base                    32 k
 python-backports                                      x86_64                1.0-8.el7                                          base                   5.8 k
 python-backports-ssl_match_hostname                   noarch                3.5.0.1-1.el7                                      base                    13 k
 python-dateutil                                       noarch                1.5-7.el7                                          base                    85 k
 python-dmidecode                                      x86_64                3.12.2-4.el7                                       base                    83 k
 python-ethtool                                        x86_64                0.8-8.el7                                          base                    34 k
 python-inotify                                        noarch                0.9.4-4.el7                                        base                    49 k
 python-ipaddress                                      noarch                1.0.16-2.el7                                       base                    34 k
 python-pytoml                                         noarch                0.1.14-1.git7dea353.el7                            extras                  18 k
 python-setuptools                                     noarch                0.9.8-7.el7                                        base                   397 k
 python-six                                            noarch                1.9.0-2.el7                                        base                    29 k
 python-syspurpose                                     x86_64                1.24.26-3.el7.centos                               updates                269 k
 setools-libs                                          x86_64                3.3.8-4.el7                                        base                   620 k
 slirp4netns                                           x86_64                0.4.3-4.el7_8                                      extras                  81 k
 subscription-manager                                  x86_64                1.24.26-3.el7.centos                               updates                1.1 M
 subscription-manager-rhsm                             x86_64                1.24.26-3.el7.centos                               updates                327 k
 subscription-manager-rhsm-certificates                x86_64                1.24.26-3.el7.centos                               updates                232 k
 usermode                                              x86_64                1.111-6.el7                                        base                   193 k
 yajl                                                  x86_64                2.0.4-4.el7                                        base                    39 k
Updating for dependencies:
 audit                                                 x86_64                2.8.5-4.el7                                        base                   256 k
 audit-libs                                            x86_64                2.8.5-4.el7                                        base                   102 k
 libxml2                                               x86_64                2.9.1-6.el7.4                                      base                   668 k
 policycoreutils                                       x86_64                2.5-34.el7                                         base                   917 k

Transaction Summary
=============================================================================================================================================================
Install  1 Package  (+39 Dependent packages)
Upgrade             (  4 Dependent packages)

Total download size: 30 M
Background downloading packages, then exiting:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /root/docker/audit-libs-python-2.8.5-4.el7.x86_64.rpm.7629.tmp: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for audit-libs-python-2.8.5-4.el7.x86_64.rpm.7629.tmp is not installed
(1/44): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                                      |  76 kB  00:00:00     
(2/44): PyYAML-3.10-11.el7.x86_64.rpm                                                                                                 | 153 kB  00:00:00     
(3/44): audit-2.8.5-4.el7.x86_64.rpm                                                                                                  | 256 kB  00:00:00     
(4/44): audit-libs-2.8.5-4.el7.x86_64.rpm                                                                                             | 102 kB  00:00:00     
Public key for container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm.7629.tmp is not installed                              ] 702 kB/s | 833 kB  00:00:42 ETA 
(5/44): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                          |  40 kB  00:00:00     
(6/44): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                              | 295 kB  00:00:00     
(7/44): container-storage-setup-0.11.0-2.git5eaf76c.el7.noarch.rpm                                                                    |  35 kB  00:00:00     
(8/44): containers-common-0.1.40-11.el7_8.x86_64.rpm                                                                                  |  43 kB  00:00:00     
(9/44): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                       |  54 kB  00:00:00     
(10/44): docker-common-1.13.1-162.git64e9980.el7.centos.x86_64.rpm                                                                    |  99 kB  00:00:00     
(11/44): atomic-registries-1.22.1-33.gitb507039.el7_8.x86_64.rpm                                                                      |  36 kB  00:00:01     
(12/44): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                            |  82 kB  00:00:00     
(13/44): libcgroup-0.41-21.el7.x86_64.rpm                                                                                             |  66 kB  00:00:00     
(14/44): libnl-1.1.4-3.el7.x86_64.rpm                                                                                                 | 128 kB  00:00:04     
(15/44): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                     | 113 kB  00:00:04     
(16/44): libxml2-python-2.9.1-6.el7.4.x86_64.rpm                                                                                      | 247 kB  00:00:02     
(17/44): libyaml-0.1.4-11.el7_0.x86_64.rpm                                                                                            |  55 kB  00:00:01     
(18/44): oci-systemd-hook-0.2.0-1.git05e6923.el7_6.x86_64.rpm                                                                         |  34 kB  00:00:00     
(19/44): oci-umount-2.5-3.el7.x86_64.rpm                                                                                              |  33 kB  00:00:00     
(20/44): libxml2-2.9.1-6.el7.4.x86_64.rpm                                                                                             | 668 kB  00:00:06     
(21/44): oci-register-machine-0-6.git2b44233.el7.x86_64.rpm                                                                           | 1.1 MB  00:00:03     
(22/44): python-IPy-0.75-6.el7.noarch.rpm                                                                                             |  32 kB  00:00:00     
(23/44): python-backports-1.0-8.el7.x86_64.rpm                                                                                        | 5.8 kB  00:00:00     
(24/44): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm                                                                 |  13 kB  00:00:00     
(25/44): policycoreutils-2.5-34.el7.x86_64.rpm                                                                                        | 917 kB  00:00:03     
(26/44): python-dateutil-1.5-7.el7.noarch.rpm                                                                                         |  85 kB  00:00:00     
(27/44): python-dmidecode-3.12.2-4.el7.x86_64.rpm                                                                                     |  83 kB  00:00:00     
(28/44): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                                 | 457 kB  00:00:03     
(29/44): python-ethtool-0.8-8.el7.x86_64.rpm                                                                                          |  34 kB  00:00:00     
(30/44): python-ipaddress-1.0.16-2.el7.noarch.rpm                                                                                     |  34 kB  00:00:00     
(31/44): python-pytoml-0.1.14-1.git7dea353.el7.noarch.rpm                                                                             |  18 kB  00:00:00     
(32/44): python-inotify-0.9.4-4.el7.noarch.rpm                                                                                        |  49 kB  00:00:00     
(33/44): python-six-1.9.0-2.el7.noarch.rpm                                                                                            |  29 kB  00:00:00     
Public key for python-syspurpose-1.24.26-3.el7.centos.x86_64.rpm.7629.tmp is not installed========                         ] 1.1 MB/s |  16 MB  00:00:12 ETA 
(34/44): python-syspurpose-1.24.26-3.el7.centos.x86_64.rpm                                                                            | 269 kB  00:00:02     
(35/44): python-setuptools-0.9.8-7.el7.noarch.rpm                                                                                     | 397 kB  00:00:02     
(36/44): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                         |  81 kB  00:00:00     
(37/44): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                          | 620 kB  00:00:07     
(38/44): subscription-manager-rhsm-1.24.26-3.el7.centos.x86_64.rpm                                                                    | 327 kB  00:00:08     
(39/44): subscription-manager-1.24.26-3.el7.centos.x86_64.rpm                                                                         | 1.1 MB  00:00:21     
(40/44): yajl-2.0.4-4.el7.x86_64.rpm                                                                                                  |  39 kB  00:00:00     
(41/44): usermode-1.111-6.el7.x86_64.rpm                                                                                              | 193 kB  00:00:14     
(42/44): docker-1.13.1-162.git64e9980.el7.centos.x86_64.rpm                                                                           |  18 MB  00:00:39     
(43/44): docker-client-1.13.1-162.git64e9980.el7.centos.x86_64.rpm                                                                    | 3.9 MB  00:00:41     
subscription-manager-rhsm-cert FAILED                                          ===========================================-] 4.4 kB/s |  30 MB  00:00:48 ETA 
http://centos.communilink.net/7.8.2003/updates/x86_64/Packages/subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.x86_64.rpm: [Errno 12] Timeout on http://centos.communilink.net/7.8.2003/updates/x86_64/Packages/subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(44/44): subscription-manager-rhsm-certificates-1.24.26-3.el7.centos.x86_64.rpm                                                       | 232 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        466 kB/s |  30 MB  00:01:06     
exiting because "Download Only" specified
[root@bogon ~]# ll
total 8
-rw-------. 1 root root 1405 Jun 28 16:03 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Aug  4 10:12 docker
[root@bogon ~]# cd docker/
[root@bogon docker]# ls |wc -l
44
[root@bogon docker]# 

部署&脚本

[root@server85 docker]# touch installdokcer.sh
[root@server85 docker]# vim installdokcer.sh

脚本

#!/bin/bash
# Revision: 1.0
# Date: 2019/06/03
# Author: gongshuaili
# Description: docker安装脚本
# Notes: 部署脚本
# 打印当前路径
home_dir=$(cd $(dirname $0); pwd)
# docker路径
pkgs_dir=$(cd "$home_dir/docker"; pwd)
echo "开始docker安装..." && sleep 2
docker --version >> /dev/null 2>&1 && echo "docker 已安装,将退出" && exit 1
cd ${pkgs_dir}
for RPM in $(ls);
do
    rpm -Uvh ${RPM} --force --nodeps
done
docker --version > /dev/null 2>&1 && echo "docekr1.13 安装成功..." || echo "docker安装失败 ..."#!/bin/bash

授权执行脚本

[root@server85 docker]# chmod +x installdokcer.sh
[root@server85 docker]# sh installdokcer.sh
[root@server85 docker]# service docker start
[root@server85 docker]# docker version

操作案例二

    4  history|grep ansible
[root@bogon ~]# yum install --downloadonly --downloaddir=/root/ansible ansible
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.huaweicloud.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ansible.noarch 0:2.9.10-1.el7 willanannanana--> Processing Dependency: PyYAML for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python-httplib2 for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python-jinja2 for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python-paramiko for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python-setuptools for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python-six for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python2-cryptography for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: python2-jmespath for package: ansible-2.9.10-1.el7.noarch
--> Processing Dependency: sshpass for package: ansible-2.9.10-1.el7.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package python-jinja2.noarch 0:2.7.2-4.el7 will be installed
--> Processing Dependency: python-babel >= 0.8 for package: python-jinja2-2.7.2-4.el7.noarch
--> Processing Dependency: python-markupsafe for package: python-jinja2-2.7.2-4.el7.noarch
---> Package python-paramiko.noarch 0:2.1.1-9.el7 will be installed
--> Processing Dependency: python2-pyasn1 for package: python-paramiko-2.1.1-9.el7.noarch
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package python-six.noarch 0:1.9.0-2.el7 will be installed
---> Package python2-cryptography.x86_64 0:1.7.2-2.el7 will be installed
--> Processing Dependency: python-idna >= 2.0 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-cffi >= 1.4.1 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-ipaddress for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-enum34 for package: python2-cryptography-1.7.2-2.el7.x86_64
---> Package python2-httplib2.noarch 0:0.18.1-3.el7 will be installed
---> Package python2-jmespath.noarch 0:0.9.4-2.el7 will be installed
---> Package sshpass.x86_64 0:1.06-2.el7 will be installed
--> Running transaction check
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package python-babel.noarch 0:0.9.6-8.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
---> Package python-cffi.x86_64 0:1.6.0-5.el7 will be installed
--> Processing Dependency: python-pycparser for package: python-cffi-1.6.0-5.el7.x86_64
---> Package python-enum34.noarch 0:1.0.4-1.el7 will be installed
---> Package python-idna.noarch 0:2.4-1.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
---> Package python-markupsafe.x86_64 0:0.11-10.el7 will be installed
---> Package python2-pyasn1.noarch 0:0.1.9-7.el7 will be installed
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-pycparser.noarch 0:2.14-1.el7 will be installed
--> Processing Dependency: python-ply for package: python-pycparser-2.14-1.el7.noarch
--> Running transaction check
---> Package python-ply.noarch 0:3.4-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                                  Arch                        Version                              Repository                   Size
=============================================================================================================================================================
Installing:
 ansible                                                  noarch                      2.9.10-1.el7                         epel                         17 M
Installing for dependencies:
 PyYAML                                                   x86_64                      3.10-11.el7                          base                        153 k
 libyaml                                                  x86_64                      0.1.4-11.el7_0                       base                         55 k
 python-babel                                             noarch                      0.9.6-8.el7                          base                        1.4 M
 python-backports                                         x86_64                      1.0-8.el7                            base                        5.8 k
 python-backports-ssl_match_hostname                      noarch                      3.5.0.1-1.el7                        base                         13 k
 python-cffi                                              x86_64                      1.6.0-5.el7                          base                        218 k
 python-enum34                                            noarch                      1.0.4-1.el7                          base                         52 k
 python-idna                                              noarch                      2.4-1.el7                            base                         94 k
 python-ipaddress                                         noarch                      1.0.16-2.el7                         base                         34 k
 python-jinja2                                            noarch                      2.7.2-4.el7                          base                        519 k
 python-markupsafe                                        x86_64                      0.11-10.el7                          base                         25 k
 python-paramiko                                          noarch                      2.1.1-9.el7                          base                        269 k
 python-ply                                               noarch                      3.4-11.el7                           base                        123 k
 python-pycparser                                         noarch                      2.14-1.el7                           base                        104 k
 python-setuptools                                        noarch                      0.9.8-7.el7                          base                        397 k
 python-six                                               noarch                      1.9.0-2.el7                          base                         29 k
 python2-cryptography                                     x86_64                      1.7.2-2.el7                          base                        502 k
 python2-httplib2                                         noarch                      0.18.1-3.el7                         epel                        125 k
 python2-jmespath                                         noarch                      0.9.4-2.el7                          epel                         41 k
 python2-pyasn1                                           noarch                      0.1.9-7.el7                          base                        100 k
 sshpass                                                  x86_64                      1.06-2.el7                           extras                       21 k

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

Total download size: 22 M
Installed size: 124 M
Background downloading packages, then exiting:
warning: /root/ansible/libyaml-0.1.4-11.el7_0.x86_64.rpm.7552.tmp: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for libyaml-0.1.4-11.el7_0.x86_64.rpm.7552.tmp is not installed
(1/22): libyaml-0.1.4-11.el7_0.x86_64.rpm                                                                                             |  55 kB  00:00:00     
(2/22): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm                                                                  |  13 kB  00:00:00     
(3/22): python-backports-1.0-8.el7.x86_64.rpm                                                                                         | 5.8 kB  00:00:00     
(4/22): python-enum34-1.0.4-1.el7.noarch.rpm                                                                                          |  52 kB  00:00:00     
(5/22): python-cffi-1.6.0-5.el7.x86_64.rpm                                                                                            | 218 kB  00:00:00     
(6/22): python-idna-2.4-1.el7.noarch.rpm                                                                                              |  94 kB  00:00:00     
(7/22): PyYAML-3.10-11.el7.x86_64.rpm                                                                                                 | 153 kB  00:00:01     
(8/22): python-ipaddress-1.0.16-2.el7.noarch.rpm                                                                                      |  34 kB  00:00:00     
(9/22): python-markupsafe-0.11-10.el7.x86_64.rpm                                                                                      |  25 kB  00:00:00     
(10/22): python-ply-3.4-11.el7.noarch.rpm                                                                                             | 123 kB  00:00:00     
(11/22): python-babel-0.9.6-8.el7.noarch.rpm                                                                                          | 1.4 MB  00:00:01     
(12/22): python-pycparser-2.14-1.el7.noarch.rpm                                                                                       | 104 kB  00:00:00     
(13/22): python-paramiko-2.1.1-9.el7.noarch.rpm                                                                                       | 269 kB  00:00:01     
(14/22): python-six-1.9.0-2.el7.noarch.rpm                                                                                            |  29 kB  00:00:00     
(15/22): python-setuptools-0.9.8-7.el7.noarch.rpm                                                                                     | 397 kB  00:00:01     
(16/22): python-jinja2-2.7.2-4.el7.noarch.rpm                                                                                         | 519 kB  00:00:02     
(17/22): python2-cryptography-1.7.2-2.el7.x86_64.rpm                                                                                  | 502 kB  00:00:01     
warning: /root/ansible/python2-httplib2-0.18.1-3.el7.noarch.rpm.7552.tmp: Header V4 RSA/SHA256 Signature, key ID 352c64e5: NOKEY MB/s | 5.8 MB  00:00:12 ETA 
Public key for python2-httplib2-0.18.1-3.el7.noarch.rpm.7552.tmp is not installed
(18/22): python2-httplib2-0.18.1-3.el7.noarch.rpm                                                                                     | 125 kB  00:00:01     
(19/22): python2-pyasn1-0.1.9-7.el7.noarch.rpm                                                                                        | 100 kB  00:00:00     
Public key for sshpass-1.06-2.el7.x86_64.rpm.7552.tmp is not installed===============                                      ] 1.3 MB/s | 6.5 MB  00:00:11 ETA 
(20/22): sshpass-1.06-2.el7.x86_64.rpm                                                                                                |  21 kB  00:00:00     
(21/22): python2-jmespath-0.9.4-2.el7.noarch.rpm                                                                                      |  41 kB  00:00:01     
(22/22): ansible-2.9.10-1.el7.noarch.rpm                                                                                              |  17 MB  00:00:14     
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        1.5 MB/s |  22 MB  00:00:14     
exiting because "Download Only" specified
[root@bogon ~]# ll
total 12
-rw-------. 1 root root 1405 Jun 28 16:03 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Aug  4 10:02 ansible
drwxr-xr-x. 2 root root 4096 Aug  4 09:54 docker
[root@bogon ~]# cd ansible/
[root@bogon ansible]# ll
total 22116
-rw-r--r--. 1 root root 18218983 Jun 19 13:08 ansible-2.9.10-1.el7.noarch.rpm
-rw-r--r--. 1 root root    56068 Jan 30  2015 libyaml-0.1.4-11.el7_0.x86_64.rpm
-rw-r--r--. 1 root root   514504 Apr 25  2018 python2-cryptography-1.7.2-2.el7.x86_64.rpm
-rw-r--r--. 1 root root   128003 Jun 20 05:14 python2-httplib2-0.18.1-3.el7.noarch.rpm
-rw-r--r--. 1 root root    42303 Apr 23 23:36 python2-jmespath-0.9.4-2.el7.noarch.rpm
-rw-r--r--. 1 root root   102132 Nov 21  2016 python2-pyasn1-0.1.9-7.el7.noarch.rpm
-rw-r--r--. 1 root root  1426348 Jul  4  2014 python-babel-0.9.6-8.el7.noarch.rpm
-rw-r--r--. 1 root root     5932 Mar 14  2015 python-backports-1.0-8.el7.x86_64.rpm
-rw-r--r--. 1 root root    12896 Apr 25  2018 python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm
-rw-r--r--. 1 root root   223012 Nov 21  2016 python-cffi-1.6.0-5.el7.x86_64.rpm
-rw-r--r--. 1 root root    53496 Nov 25  2015 python-enum34-1.0.4-1.el7.noarch.rpm
-rw-r--r--. 1 root root    95952 Aug 11  2017 python-idna-2.4-1.el7.noarch.rpm
-rw-r--r--. 1 root root    35176 Nov 21  2016 python-ipaddress-1.0.16-2.el7.noarch.rpm
-rw-r--r--. 1 root root   531040 Aug 23  2019 python-jinja2-2.7.2-4.el7.noarch.rpm
-rw-r--r--. 1 root root    25792 Jul  4  2014 python-markupsafe-0.11-10.el7.x86_64.rpm
-rw-r--r--. 1 root root   275112 Nov 21  2018 python-paramiko-2.1.1-9.el7.noarch.rpm
-rw-r--r--. 1 root root   125732 Aug 11  2017 python-ply-3.4-11.el7.noarch.rpm
-rw-r--r--. 1 root root   106984 Nov 25  2015 python-pycparser-2.14-1.el7.noarch.rpm
-rw-r--r--. 1 root root   406404 Aug 11  2017 python-setuptools-0.9.8-7.el7.noarch.rpm
-rw-r--r--. 1 root root    29404 Nov 25  2015 python-six-1.9.0-2.el7.noarch.rpm
-rw-r--r--. 1 root root   156952 Jul  4  2014 PyYAML-3.10-11.el7.x86_64.rpm
-rw-r--r--. 1 root root    21896 Sep  8  2017 sshpass-1.06-2.el7.x86_64.rpm
[root@bogon ansible]# ls |wc -l
22

脚本

#!/bin/bash
# Revision: 1.0
# Date: 2020/08/03
# Author: gongshuaili
# Description: ansible安装脚本
# Notes: 部署脚本
# 打印当前路径
home_dir=$(cd $(dirname $0); pwd)
# docker路径
pkgs_dir=$(cd "$home_dir/ansible"; pwd)
echo "开始ansible安装..." && sleep 2
ansible --version >> /dev/null 2>&1 && echo "ansible 已安装,将退出" && exit 1
cd ${pkgs_dir}
for RPM in $(ls);
do
    rpm -Uvh ${RPM} --force --nodeps
done
ansible --version > /dev/null 2>&1 && echo "ansible2.9.1 安装成功..." || echo "ansible安装失败 ..."#!/bin/bash

你可能感兴趣的:(centos,linux,docker,运维)