教你优化yum源。配置阿里云的yum镜像源(base和epel)

摘要:
1、 Centos7的基本源代码配置阿里云的yum源代码:1.备份旧的yum源目录下的所有文件[root@ELK-chaofeng07yum.repos.d]#mkdir../yum.repos.d.bak;Mv./*./yum.repos.d.bak2.下载基本文件#Download CentOS5wget-O/etc/yum.repo.d/CentOS-base。对应于每个系统版本的repo文件的repoh

一、Centos7的base源配置阿里云的yum源:

1、备份旧的yum源目录下的所有文件

[root@ELK-chaofeng07 yum.repos.d]# mkdir ../yum.repos.d.bak ; mv ./* ../yum.repos.d.bak

2、下载base文件

#各系统版本repo文件对应的下载操作
CentOS 5
wget -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
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、清空缓存

yum clean all

4、构建新的缓存

yum makecache

5、查看基本yum源

[root@ELK-chaofeng07 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id                                                            repo name                                                                                         status
base/7/x86_64                                                      CentOS-7 - Base - mirrors.aliyun.com                                                              10,019
*epel/x86_64                                                       Extra Packages for Enterprise Linux 7 - x86_64                                                    12,906
extras/7/x86_64                                                    CentOS-7 - Extras - mirrors.aliyun.com                                                               371
updates/7/x86_64                                                   CentOS-7 - Updates - mirrors.aliyun.com                                                            1,158
repolist: 24,454

二、配置阿里云的epel源

1、下载阿里云的epel源。我们到官网:http://mirrors.aliyun.com

教你优化yum源。配置阿里云的yum镜像源(base和epel)第1张

2、开始备份旧的epel-release源

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

3、下载新的阿里云的epel源

epel(RHEL 7)

    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
epel(RHEL 6)

    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
epel(RHEL 5)

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

4、清空缓存

[root@ELK-chaofeng07 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base 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

4、构建新的缓存

[root@ELK-chaofeng07 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base                                                            | 3.6 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/18): base/7/x86_64/group_gz                                  | 166 kB  00:00:00     
(2/18): base/7/x86_64/primary_db                                | 6.0 MB  00:00:01     
(3/18): base/7/x86_64/filelists_db                              | 7.1 MB  00:00:01     
(4/18): epel/x86_64/group_gz                                    |  88 kB  00:00:00     
(5/18): base/7/x86_64/other_db                                  | 2.6 MB  00:00:00     
(6/18): epel/x86_64/updateinfo                                  | 953 kB  00:00:00     
(7/18): epel/x86_64/prestodelta                                 |  11 kB  00:00:00     
(8/18): epel/x86_64/primary_db                                  | 6.6 MB  00:00:01     
(9/18): epel/x86_64/filelists_db                                |  11 MB  00:00:02     
(10/18): extras/7/x86_64/prestodelta                            |  47 kB  00:00:00     
(11/18): extras/7/x86_64/filelists_db                           | 231 kB  00:00:00     
(12/18): epel/x86_64/other_db                                   | 3.2 MB  00:00:00     
(13/18): extras/7/x86_64/primary_db                             | 180 kB  00:00:00     
(14/18): extras/7/x86_64/other_db                               | 118 kB  00:00:00     
(15/18): updates/7/x86_64/prestodelta                           | 357 kB  00:00:00     
(16/18): updates/7/x86_64/filelists_db                          | 2.2 MB  00:00:00     
(17/18): updates/7/x86_64/other_db                              | 349 kB  00:00:00     
(18/18): updates/7/x86_64/primary_db                            | 2.5 MB  00:00:00     
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Metadata Cache Created

5、查看yum源

[root@ELK-chaofeng07 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base                                                            | 3.6 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/18): base/7/x86_64/group_gz                                  | 166 kB  00:00:00     
(2/18): base/7/x86_64/primary_db                                | 6.0 MB  00:00:01     
(3/18): base/7/x86_64/filelists_db                              | 7.1 MB  00:00:01     
(4/18): epel/x86_64/group_gz                                    |  88 kB  00:00:00     
(5/18): base/7/x86_64/other_db                                  | 2.6 MB  00:00:00     
(6/18): epel/x86_64/updateinfo                                  | 953 kB  00:00:00     
(7/18): epel/x86_64/prestodelta                                 |  11 kB  00:00:00     
(8/18): epel/x86_64/primary_db                                  | 6.6 MB  00:00:01     
(9/18): epel/x86_64/filelists_db                                |  11 MB  00:00:02     
(10/18): extras/7/x86_64/prestodelta                            |  47 kB  00:00:00     
(11/18): extras/7/x86_64/filelists_db                           | 231 kB  00:00:00     
(12/18): epel/x86_64/other_db                                   | 3.2 MB  00:00:00     
(13/18): extras/7/x86_64/primary_db                             | 180 kB  00:00:00     
(14/18): extras/7/x86_64/other_db                               | 118 kB  00:00:00     
(15/18): updates/7/x86_64/prestodelta                           | 357 kB  00:00:00     
(16/18): updates/7/x86_64/filelists_db                          | 2.2 MB  00:00:00     
(17/18): updates/7/x86_64/other_db                              | 349 kB  00:00:00     
(18/18): updates/7/x86_64/primary_db                            | 2.5 MB  00:00:00     
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Metadata Cache Created

此时再次下载东西你会发现非常快。不懂请点击

免责声明:文章转载自《教你优化yum源。配置阿里云的yum镜像源(base和epel)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇opstack 笔记 (一) 概念redis查找大key下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Centos安装shellcheck的方法

shellcheck shellcheck是用来检查shell脚本的工具。 采用haskell语言开发。 在ubuntu中,可以直接采用apt install shellcheck安装完成 但是在Centos,yum是没有shellcheck的包的,因此,需要另一种方法安装 Centos安装shellcheck 由于shellcheck是haskell语...

LDAP-openldap服务部署和测试(YUM安装)

  1. 概述2. 服务端部署过程2.1 软件包说明2.2 部署过程2.3 配置过程3. 测试4. 生成LDIF格式文件4.1 安装migrationtools工具4.2 用migrationtools生成ldif文件4.3 添加ldif到ldap数据库5. 日志配置5.1 openldap的日志级别5.2 配置日志功能6. 客户端配置6.1 基础环境准...

CentOS 7系统KVM虚拟机安装过程详解

什么是 KVM ? KVM 在标准的 Linux 内核中增加了虚拟技术,从而我们可以通过优化的内核来使用虚拟技术。在 KVM 模型中,每一个虚拟机都是一个由 Linux 调度程序管理的标准进程,你可以在用户空间启动客户机操作系统。一个普通的 Linux 进程有两种运行模式:内核和用户。 KVM 增加了第三种模式:客户模式(有自己的内核和用户模式)。 一个典...

CentOS下的账户管理

在Linux中,每个文件都分3类权限:账户本身的权限,账户所在群组的权限和其它权限。账户和群组是多对多的关系,即一个账户可以属于多个群组,一个群组可以包含多个账户。但是,对于每一个已登录的账户,只能存在一个当前生效的群组(初始群组)。 账户管理相关配置文件如下:账户信息文件是/etc/passwd、账户密码文件是/etc/shadow、群组信息文件是/e...

Centos 7 搭建蓝鲸V4.1.16社区版

第一次搭建蓝鲸平台,参考了蓝鲸社区的官方搭建文档。 友情链接:蓝鲸智云社区版V4.1.16用户手册 在本地用VMware模拟了三台主机, 准备至少3台 CentOS 7 以上操作系统的机器 最低配置:2核4G 建议配置: 4核12G 以上 192.168.1.12(主控机) 192.168.1.18 192.168.1.19 获取安装包 蓝鲸社区版包含...

CentOS下使用LVM进行分区(转)

说明:为什么抄,因为这篇文章图文并茂,所有测试都在CentOS 6和7测试过。 许多Linux使用者安装操作系统时都会遇到这样的困境:如何精确评估和分配各个硬盘分区的容量,如果当初评估不准确,一旦系统分区不够用时可能不得不备份、删除相关数据,甚至被迫重新规划分区并重装操作系统,以满足应用系统的需要。 LVM是Linux环境中对磁盘分区进行管理的一种机制,是...