RHEL7.9激活(可省略)
# 注册
subscription-manager register --username=your_username --password=your_password --auto-attach
# 查看订阅状态
subscription-manager list
# 将 “enabled=1” 改为 “enabled=0”
vi /etc/yum/pluginconf.d/subscription-manager.conf
配置阿里云yum源
cd /etc/yum.repo.d
# 备份原repo
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/*.repo.bak
# 下载新repo,可下载后上传: “http://mirrors.aliyun.com/repo/Centos-7.repo”
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 修改配置
sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
配置阿里云epel源
# 可下载后上传: “https://mirrors.aliyun.com/repo/epel-7.repo”
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
ansible依赖打包至离线环境并安装
# 利用yum的yum-downloadonly插件将所有的依赖下载下来
yum install -y ansible --downloadonly --downloaddir=/root/ansible
# 打包并上传到目标环境
tar zcvf ansible.tar.gz ~/ansible
# 解压安装包并进入安装包
tar zxvf ansible.tar.gz && cd ansible
# 安装ansible
yum localinstall *.rpm
# 检测是否安装成功
ansible --version