配置阿里yum源

配置阿里yum源

#查看阿里的repo源
 http://mirrors.aliyun.com/repo/

#配置perl源
[root@docker ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/epel-7.repo

#配置阿里Centos7的yum源
[root@docker ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo2 http://mirrors.aliyun.com/repo/Centos-7.repo

#整个到一个yum的配置文件CentOS-Base.repo
[root@docker ~]# cat /etc/yum.repos.d/CentOS-Base.repo2 >> /etc/yum.repos.d/CentOS-Base.repo
[root@docker ~]# yum clean all && yum makecache

 安装ansible

#yum安装
[root@ms1 ~]# python install ansible -y

#检查版本,表示安装成功
[root@ms1 ~]# ansible --version
ansible 2.9.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

配置阿里云加速器

#阿里的ECS,如下配置; 不配置有些镜像pull时提示 "Error response from daemon: ...connection reset by peer"
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://3u4izbfu.mirror.aliyuncs.com"]
  #"https://3u4i....mirror.aliyuncs.com"此地址为本人的镜像加速器地址,查看地址 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

 

posted @ 2021-04-30 12:07  江曹  阅读(414)  评论(0)    收藏  举报