Linux-RHEL7.0配置aliyun
作者:互联网
RHEL7.0配置aliyun
1、创建一个目录,用于存放原来的yum信息。我这里没有yum,就不创建目录了。
[root@master ~]# cd /etc/yum.repos.d/
[root@master yum.repos.d]# ls
[root@master yum.repos.d]#
2、下载镜像源
[root@master yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
--2020-06-03 07:23:24-- https://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 36.249.75.120, 116.153.35.248, 116.153.35.246, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|36.249.75.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’
100%[==============================>] 2,523 --.-K/s in 0s
2020-06-03 07:23:25 (136 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
[root@master yum.repos.d]# ls
CentOS-Base.repo
[root@master yum.repos.d]#
3、生成缓存
[root@master yum.repos.d]# yum makecache
已加载插件:langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
正在尝试其它镜像。
http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30195 milliseconds')
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的名称或服务"
正在尝试其它镜像。
http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7Server/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30044 milliseconds')
正在尝试其它镜像。
报错!!!!就要解决报错!!!百度一波!!!
最终repo
文件如下:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
http://mirrors.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
再来:
# 清除原先的yum
[root@master yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything
# 重新生成缓存
[root@master yum.repos.d]# yum makecache
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/10): base/x86_64/group_gz | 153 kB 00:00
(2/10): base/x86_64/filelists_db | 7.1 MB 00:20
(3/10): base/x86_64/other_db | 2.6 MB 00:06
(4/10): extras/x86_64/primary_db | 194 kB 00:06
(5/10): extras/x86_64/other_db | 122 kB 00:00
(6/10): extras/x86_64/filelists_db | 205 kB 00:08
(7/10): base/x86_64/primary_db | 6.1 MB 00:30
(8/10): updates/x86_64/filelists_db | 997 kB 00:06
(9/10): updates/x86_64/other_db | 192 kB 00:01
(10/10): updates/x86_64/primary_db | 1.3 MB 00:08
Metadata Cache Created
看了好多篇网上的教程终于自己搞成功了!!!
标签:00,http,centos,mirrors,RHEL7.0,aliyun,Linux,com 来源: https://blog.csdn.net/weixin_36522099/article/details/106503069