1.配置本地源挂载
/dev/sr0 10464680 10464680 0 100% /media/Rocky
2.设置dns使其能够上网
[root@cs4 yum.repos.d]# ping www.baidu.com
PING www.a.shifen.com (39.156.66.18) 56(84) bytes of data.
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=1 ttl=128 time=16.5 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=2 ttl=128 time=16.4 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=3 ttl=128 time=16.3 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=4 ttl=128 time=16.4 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=5 ttl=128 time=16.4 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=6 ttl=128 time=16.6 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=7 ttl=128 time=16.8 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=8 ttl=128 time=17.4 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=9 ttl=128 time=16.4 ms
64 bytes from 39.156.66.18 (39.156.66.18): icmp_seq=10 ttl=128 time=16.9 ms
3.直接下载epel源
[root@cs4 yum.repos.d]# ll
total 24
-rw-r--r--. 1 root root 1480 Jun 7 2021 epel-modular.repo
-rw-r--r--. 1 root root 1562 Jun 7 2021 epel-playground.repo
-rw-r--r--. 1 root root 1417 Jun 7 2021 epel.repo
-rw-r--r--. 1 root root 1579 Jun 7 2021 epel-testing-modular.repo
-rw-r--r--. 1 root root 1516 Jun 7 2021 epel-testing.repo
-rw-r--r--. 1 root root 680 Mar 17 21:50 media.repo
4.下载ansible包
dnf
--downloadonly only download packages
dnf -y install --downloadonly --downloaddir=/root ansible
or dnf install -y ansible
yum install -y ansible
Rocky Linux 8 - Media - BaseOS 313 kB/s | 3.9 kB 00:00
Rocky Linux 8 - Media - AppStream 264 kB/s | 4.3 kB 00:00
Dependencies resolved.
=======================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================
Installing:
ansible noarch 2.9.27-1.el8 epel 17 M
Installing dependencies:
libsodium x86_64 1.0.18-2.el8 epel 162 k
python3-babel noarch 2.5.1-7.el8 media-appstream 4.8 M
python3-bcrypt x86_64 3.1.6-2.el8.1 epel 44 k
python3-cffi x86_64 1.11.5-5.el8 media-baseos 237 k
python3-cryptography x86_64 3.2.1-5.el8 media-baseos 558 k
python3-jinja2 noarch 2.10.1-3.el8 media-appstream 537 k
python3-jmespath noarch 0.9.0-11.el8 media-appstream 44 k
python3-markupsafe x86_64 0.23-19.el8 media-appstream 38 k
python3-pip noarch 9.0.3-20.el8.rocky.0 media-appstream 19 k
python3-pyasn1 noarch 0.3.7-6.el8 media-appstream 125 k
python3-pycparser noarch 2.14-14.el8 media-baseos 108 k
python3-pynacl x86_64 1.3.0-5.el8 epel 100 k
python3-pytz noarch 2017.2-9.el8 media-appstream 53 k
python3-pyyaml x86_64 3.12-12.el8 media-baseos 192 k
python3-setuptools noarch 39.2.0-6.el8 media-baseos 162 k
python36 x86_64 3.6.8-38.module+el8.5.0+671+195e4563 media-appstream 18 k
sshpass x86_64 1.06-9.el8 epel 27 k
Installing weak dependencies:
python3-paramiko noarch 2.4.3-1.el8 epel 289 k
Enabling module streams:
python36 3.6
Transaction Summary
=======================================================================================================================================
Install 19 Packages
Total size: 24 M
Total download size: 18 M
Installed size: 127 M
Downloading Packages:
(1/6): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm 31 kB/s | 44 kB 00:01
(2/6): libsodium-1.0.18-2.el8.x86_64.rpm 61 kB/s | 162 kB 00:02
(3/6): python3-paramiko-2.4.3-1.el8.noarch.rpm 186 kB/s | 289 kB 00:01
(4/6): sshpass-1.06-9.el8.x86_64.rpm 42 kB/s | 27 kB 00:00
(5/6): python3-pynacl-1.3.0-5.el8.x86_64.rpm 54 kB/s | 100 kB 00:01
[MIRROR] ansible-2.9.27-1.el8.noarch.rpm: Curl error (28): Timeout was reached for http://mirrors.neusoft.edu.cn/epel/8/Everything/x86_64/Packages/a/ansible-2.9.27-1.el8.noarch.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(6/6): ansible-2.9.27-1.el8.noarch.rpm 250 kB/s | 17 MB 01:09
---------------------------------------------------------------------------------------------------------------------------------------
Total 252 kB/s | 18 MB 01:11
Extra Packages for Enterprise Linux 8 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x2F86D6A1:
Userid : "Fedora EPEL (8) <epel@fedoraproject.org>"
Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-jmespath-0.9.0-11.el8.noarch 1/19
Installing : python3-setuptools-39.2.0-6.el8.noarch 2/19
Installing : python3-pip-9.0.3-20.el8.rocky.0.noarch 3/19
Installing : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64 4/19
Running scriptlet: python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64 4/19
Installing : python3-pytz-2017.2-9.el8.noarch 5/19
Installing : python3-babel-2.5.1-7.el8.noarch 6/19
Installing : python3-pyasn1-0.3.7-6.el8.noarch 7/19
Installing : python3-markupsafe-0.23-19.el8.x86_64 8/19
Installing : python3-jinja2-2.10.1-3.el8.noarch 9/19
Installing : python3-pyyaml-3.12-12.el8.x86_64 10/19
Installing : python3-pycparser-2.14-14.el8.noarch 11/19
Installing : python3-cffi-1.11.5-5.el8.x86_64 12/19
Installing : python3-cryptography-3.2.1-5.el8.x86_64 13/19
Installing : python3-bcrypt-3.1.6-2.el8.1.x86_64 14/19
Installing : sshpass-1.06-9.el8.x86_64 15/19
Installing : libsodium-1.0.18-2.el8.x86_64 16/19
Installing : python3-pynacl-1.3.0-5.el8.x86_64 17/19
Installing : python3-paramiko-2.4.3-1.el8.noarch 18/19
Installing : ansible-2.9.27-1.el8.noarch 19/19
Running scriptlet: ansible-2.9.27-1.el8.noarch 19/19
Verifying : ansible-2.9.27-1.el8.noarch 1/19
Verifying : libsodium-1.0.18-2.el8.x86_64 2/19
Verifying : python3-bcrypt-3.1.6-2.el8.1.x86_64 3/19
Verifying : python3-paramiko-2.4.3-1.el8.noarch 4/19
Verifying : python3-pynacl-1.3.0-5.el8.x86_64 5/19
Verifying : sshpass-1.06-9.el8.x86_64 6/19
Verifying : python3-cffi-1.11.5-5.el8.x86_64 7/19
Verifying : python3-cryptography-3.2.1-5.el8.x86_64 8/19
Verifying : python3-pycparser-2.14-14.el8.noarch 9/19
Verifying : python3-pyyaml-3.12-12.el8.x86_64 10/19
Verifying : python3-setuptools-39.2.0-6.el8.noarch 11/19
Verifying : python3-babel-2.5.1-7.el8.noarch 12/19
Verifying : python3-jinja2-2.10.1-3.el8.noarch 13/19
Verifying : python3-jmespath-0.9.0-11.el8.noarch 14/19
Verifying : python3-markupsafe-0.23-19.el8.x86_64 15/19
Verifying : python3-pip-9.0.3-20.el8.rocky.0.noarch 16/19
Verifying : python3-pyasn1-0.3.7-6.el8.noarch 17/19
Verifying : python3-pytz-2017.2-9.el8.noarch 18/19
Verifying : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64 19/19
Installed:
ansible-2.9.27-1.el8.noarch libsodium-1.0.18-2.el8.x86_64 python3-babel-2.5.1-7.el8.noarch
python3-bcrypt-3.1.6-2.el8.1.x86_64 python3-cffi-1.11.5-5.el8.x86_64 python3-cryptography-3.2.1-5.el8.x86_64
python3-jinja2-2.10.1-3.el8.noarch python3-jmespath-0.9.0-11.el8.noarch python3-markupsafe-0.23-19.el8.x86_64
python3-paramiko-2.4.3-1.el8.noarch python3-pip-9.0.3-20.el8.rocky.0.noarch python3-pyasn1-0.3.7-6.el8.noarch
python3-pycparser-2.14-14.el8.noarch python3-pynacl-1.3.0-5.el8.x86_64 python3-pytz-2017.2-9.el8.noarch
python3-pyyaml-3.12-12.el8.x86_64 python3-setuptools-39.2.0-6.el8.noarch python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
sshpass-1.06-9.el8.x86_64
Complete!
Verifying : python3-pip-9.0.3-20.el8.rocky.0.noarch 16/19
Verifying : python3-pyasn1-0.3.7-6.el8.noarch 17/19
Verifying : python3-pytz-2017.2-9.el8.noarch 18/19
Verifying : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64 19/19
Installed:
ansible-2.9.27-1.el8.noarch libsodium-1.0.18-2.el8.x86_64 python3-babel-2.5.1-7.el8.noarch
python3-bcrypt-3.1.6-2.el8.1.x86_64 python3-cffi-1.11.5-5.el8.x86_64 python3-cryptography-3.2.1-5.el8.x86_64
python3-jinja2-2.10.1-3.el8.noarch python3-jmespath-0.9.0-11.el8.noarch python3-markupsafe-0.23-19.el8.x86_64
python3-paramiko-2.4.3-1.el8.noarch python3-pip-9.0.3-20.el8.rocky.0.noarch python3-pyasn1-0.3.7-6.el8.noarch
python3-pycparser-2.14-14.el8.noarch python3-pynacl-1.3.0-5.el8.x86_64 python3-pytz-2017.2-9.el8.noarch
python3-pyyaml-3.12-12.el8.x86_64 python3-setuptools-39.2.0-6.el8.noarch python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
sshpass-1.06-9.el8.x86_64
Complete!
查看版本
ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Nov 9 2021, 14:44:26) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
查看文件
ll
total 7024
-rw-------. 1 root root 1148 Mar 15 11:50 anaconda-ks.cfg
-rw-r--r--. 1 root root 680 Mar 15 18:23 media.repo
-r--r--r--. 1 root root 18722 Mar 17 22:18 python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64.rpm
-r--r--r--. 1 root root 5018064 Mar 17 22:18 python3-babel-2.5.1-7.el8.noarch.rpm
-r--r--r--. 1 root root 242436 Mar 17 22:18 python3-cffi-1.11.5-5.el8.x86_64.rpm
-r--r--r--. 1 root root 571244 Mar 17 22:18 python3-cryptography-3.2.1-5.el8.x86_64.rpm
-r--r--r--. 1 root root 549412 Mar 17 22:18 python3-jinja2-2.10.1-3.el8.noarch.rpm
-r--r--r--. 1 root root 44804 Mar 17 22:18 python3-jmespath-0.9.0-11.el8.noarch.rpm
-r--r--r--. 1 root root 38608 Mar 17 22:18 python3-markupsafe-0.23-19.el8.x86_64.rpm
-r--r--r--. 1 root root 19408 Mar 17 22:18 python3-pip-9.0.3-20.el8.rocky.0.noarch.rpm
-r--r--r--. 1 root root 128228 Mar 17 22:18 python3-pyasn1-0.3.7-6.el8.noarch.rpm
-r--r--r--. 1 root root 110516 Mar 17 22:18 python3-pycparser-2.14-14.el8.noarch.rpm
-r--r--r--. 1 root root 54216 Mar 17 22:18 python3-pytz-2017.2-9.el8.noarch.rpm
-r--r--r--. 1 root root 196500 Mar 17 22:18 python3-pyyaml-3.12-12.el8.x86_64.rpm
-r--r--r--. 1 root root 165408 Mar 17 22:18 python3-setuptools-39.2.0-6.el8.noarch.rpm
CRT:alt+p
sftp> lcd I:\
sftp> get *
Downloading anaconda-ks.cfg from /root/anaconda-ks.cfg
100% 1KB 1KB/s 00:00:00
/root/anaconda-ks.cfg: 1148 bytes transferred in 0 seconds (1148 bytes/s)
Downloading media.repo from /root/media.repo
100% 680 bytes 680 bytes/s 00:00:00
/root/media.repo: 680 bytes transferred in 0 seconds (680 bytes/s)
Downloading python3-babel-2.5.1-7.el8.noarch.rpm from /root/python3-babel-2.5.1-7.el8.noarch.rpm
100% 4900KB 4900KB/s 00:00:00
/root/python3-babel-2.5.1-7.el8.noarch.rpm: 5018064 bytes transferred in 0 seconds (4900 KB/s)
Downloading python3-cffi-1.11.5-5.el8.x86_64.rpm from /root/python3-cffi-1.11.5-5.el8.x86_64.rpm
100% 236KB 236KB/s 00:00:00
/root/python3-cffi-1.11.5-5.el8.x86_64.rpm: 242436 bytes transferred in 0 seconds (236 KB/s)
Downloading python3-cryptography-3.2.1-5.el8.x86_64.rpm from /root/python3-cryptography-3.2.1-5.el8.x86_64.rpm
100% 557KB 557KB/s 00:00:00
/root/python3-cryptography-3.2.1-5.el8.x86_64.rpm: 571244 bytes transferred in 0 seconds (557 KB/s)
Downloading python3-jinja2-2.10.1-3.el8.noarch.rpm from /root/python3-jinja2-2.10.1-3.el8.noarch.rpm
100% 536KB 536KB/s 00:00:00
/root/python3-jinja2-2.10.1-3.el8.noarch.rpm: 549412 bytes transferred in 0 seconds (536 KB/s)
Downloading python3-jmespath-0.9.0-11.el8.noarch.rpm from /root/python3-jmespath-0.9.0-11.el8.noarch.rpm
100% 43KB 43KB/s 00:00:00
/root/python3-jmespath-0.9.0-11.el8.noarch.rpm: 44804 bytes transferred in 0 seconds (43 KB/s)
Downloading python3-markupsafe-0.23-19.el8.x86_64.rpm from /root/python3-markupsafe-0.23-19.el8.x86_64.rpm
100% 37KB 37KB/s 00:00:00
/root/python3-markupsafe-0.23-19.el8.x86_64.rpm: 38608 bytes transferred in 0 seconds (37 KB/s)
Downloading python3-pip-9.0.3-20.el8.rocky.0.noarch.rpm from /root/python3-pip-9.0.3-20.el8.rocky.0.noarch.rpm
100% 18KB 18KB/s 00:00:00
/root/python3-pip-9.0.3-20.el8.rocky.0.noarch.rpm: 19408 bytes transferred in 0 seconds (18 KB/s)
Downloading python3-pyasn1-0.3.7-6.el8.noarch.rpm from /root/python3-pyasn1-0.3.7-6.el8.noarch.rpm
100% 125KB 125KB/s 00:00:00
/root/python3-pyasn1-0.3.7-6.el8.noarch.rpm: 128228 bytes transferred in 0 seconds (125 KB/s)
Downloading python3-pycparser-2.14-14.el8.noarch.rpm from /root/python3-pycparser-2.14-14.el8.noarch.rpm
100% 107KB 107KB/s 00:00:00
/root/python3-pycparser-2.14-14.el8.noarch.rpm: 110516 bytes transferred in 0 seconds (107 KB/s)
Downloading python3-pytz-2017.2-9.el8.noarch.rpm from /root/python3-pytz-2017.2-9.el8.noarch.rpm
100% 52KB 52KB/s 00:00:00
/root/python3-pytz-2017.2-9.el8.noarch.rpm: 54216 bytes transferred in 0 seconds (52 KB/s)
Downloading python3-pyyaml-3.12-12.el8.x86_64.rpm from /root/python3-pyyaml-3.12-12.el8.x86_64.rpm
100% 191KB 191KB/s 00:00:00
/root/python3-pyyaml-3.12-12.el8.x86_64.rpm: 196500 bytes transferred in 0 seconds (191 KB/s)
Downloading python3-setuptools-39.2.0-6.el8.noarch.rpm from /root/python3-setuptools-39.2.0-6.el8.noarch.rpm
100% 161KB 161KB/s 00:00:00
/root/python3-setuptools-39.2.0-6.el8.noarch.rpm: 165408 bytes transferred in 0 seconds (161 KB/s)
Downloading python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64.rpm from /root/python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64.rpm
100% 18KB 18KB/s 00:00:00
/root/python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64.rpm: 18722 bytes transferred in 0 seconds (18 KB/s)
sftp>
下载到本地
然后每次上传这个包,就可以直接安装了,就不用配置epel了。