1. 首先找到一台能上网的机器配置网络yum源 --配置阿里yum源
wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo
修改yum.conf参数,yum安装后把所有依赖下载到ansible文件夹下
红框表示cachedir表明安装包存储位置,keepcache表明允许保存
把base extras updates三个文件夹里的packegs的rpm包统一保存到自己的文件夹里,我保存的是/ansible
然后把ansible文件打包保存ansible.tar.gz下载
再到要安装的不能上网的机器进行操作,
首先在不能上网的机器上安装creatrepo服务,这个是为了创建本地repo源。
然后创建本地repo源,我创建的是ansible源
然后执行createrepo /data/ansible/ 创建repo文件
yum clean all
yum repolist
yum makecache
yum install -y ansible
这样就安装成功了
原文:https://www.cnblogs.com/qq521/p/11684457.html