centos常见问题

yum源更换为国内的阿里云源

1 备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum makecache生成缓存

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base dell-system-update_dependent dell-system-update_independent epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors

[root@localhost yum.repos.d]# yum makecache    //把yum源缓存到本地,加快软件的搜索好安装速度
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                 | 6.7 kB  00:00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.tongji.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                 | 3.6 kB  00:00:00     
dell-system-update_dependent                                         | 2.3 kB  00:00:00     
dell-system-update_independent                                       | 2.3 kB  00:00:00     
epel                                                                 | 4.7 kB  00:00:00     
extras                                                               | 3.4 kB  00:00:00     
updates                                                              | 3.4 kB  00:00:00     
(1/24): base/7/x86_64/group_gz                                       | 166 kB  00:00:00     
(2/24): base/7/x86_64/filelists_db                                   | 6.9 MB  00:00:03     
(3/24): base/7/x86_64/primary_db                                     | 5.9 MB  00:00:03     
(4/24): base/7/x86_64/other_db                                       | 2.5 MB  00:00:00     
(5/24): dell-system-update_dependent/7/x86_64/primary_db             |  33 kB  00:00:00     
(6/24): dell-system-update_dependent/7/x86_64/filelists_db           |  79 kB  00:00:00     
(7/24): dell-system-update_dependent/7/x86_64/other_db               | 7.0 kB  00:00:00     
(8/24): dell-system-update_independent/filelists_db                  |  63 kB  00:00:00     
(9/24): dell-system-update_independent/primary_db                    | 112 kB  00:00:01     
(10/24): dell-system-update_independent/other_db                     |  25 kB  00:00:00     
(11/24): epel/x86_64/group_gz                                        |  88 kB  00:00:25     
(12/24): epel/x86_64/filelists_db                                    |  10 MB  00:00:14     
(13/24): epel/x86_64/updateinfo                                      | 929 kB  00:00:00     
(14/24): epel/x86_64/prestodelta                                     | 1.2 kB  00:00:05     
(15/24): epel/x86_64/primary_db                                      | 6.4 MB  00:00:13     
(16/24): extras/7/x86_64/filelists_db                                | 517 kB  00:00:00     
(17/24): extras/7/x86_64/primary_db                                  | 143 kB  00:00:00     
(18/24): extras/7/x86_64/prestodelta                                 |  47 kB  00:00:00     
(19/24): updates/7/x86_64/prestodelta                                | 180 kB  00:00:00     
(20/24): extras/7/x86_64/other_db                                    |  91 kB  00:00:00     
(21/24): updates/7/x86_64/primary_db                                 | 1.2 MB  00:00:00     
(22/24): updates/7/x86_64/other_db                                   | 201 kB  00:00:00     
(23/24): updates/7/x86_64/filelists_db                               | 875 kB  00:00:00     
(24/24): epel/x86_64/other_db                                        | 3.1 MB  00:00:10     
Metadata Cache Created

[root@localhost yum.repos.d]# yum list        //查看包列表

参考:

1 https://blog.csdn.net/kangvcar/article/details/73477730


猜你喜欢

转载自blog.csdn.net/u011956172/article/details/79172709