1.cd /etc/yum.repos.d/
进入yum源存放目录,默认会带有官方的yum源
2.rm -rf *
因为这些地址都是国外的源,下载时候速度会慢很多,删掉,下面给它替换成阿里的源
3.wget http://mirrors.aliyun.com/repo/Centos-6.repo
下载阿里的yum源
4.yum clean all
清空一下yum的缓存
5.yum repolist
查看yum源的列表并自动下载一些相应的元数据存到本地
6.yum -y install 软件名称
[[email protected] ~]# cd /etc/yum.repos.d/ [[email protected] yum.repos.d]# ll total 24 -rw-r--r--. 1 root root 1991 May 19 2016 CentOS-Base.repo -rw-r--r--. 1 root root 647 May 19 2016 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 289 May 19 2016 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 May 19 2016 CentOS-Media.repo -rw-r--r--. 1 root root 6259 May 19 2016 CentOS-Vault.repo [root@centos yum.repos.d]# rm -rf * [[email protected] yum.repos.d]# ll total 0 [root@centos yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-6.repo --2020-03-22 15:30:38-- http://mirrors.aliyun.com/repo/Centos-6.repo Resolving mirrors.aliyun.com... 218.98.31.243, 153.99.248.242, 218.98.31.244, ... Connecting to mirrors.aliyun.com|218.98.31.243|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2523 (2.5K) [application/octet-stream] Saving to: “Centos-6.repo” 100%[==============================================================================================================================>] 2,523 --.-K/s in 0s 2020-03-22 15:30:39 (336 MB/s) - “Centos-6.repo” saved [2523/2523] [root@centos yum.repos.d]# ll total 4 -rw-r--r--. 1 root root 2523 Jun 16 2018 Centos-6.repo [root@centos yum.repos.d]# yum clean all Loaded plugins: fastestmirror, refresh-packagekit, security Cleaning repos: base extras updates Cleaning up Everything Cleaning up list of fastest mirrors [root@centos yum.repos.d]# yum repolist Loaded plugins: fastestmirror, refresh-packagekit, security Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:03 extras | 3.4 kB 00:00 extras/primary_db | 29 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 8.9 MB 00:08 repo id repo name status base CentOS-6 - Base - mirrors.aliyun.com 6,713 extras CentOS-6 - Extras - mirrors.aliyun.com 47 updates CentOS-6 - Updates - mirrors.aliyun.com 935 repolist: 7,695
原文地址:https://www.cnblogs.com/ddstudy/p/12547103.html
时间: 2024-11-09 10:02:27