欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Centos 6 安装阿里yum源和epel源 阿里云 淘宝 西部数码推荐 配置源 源配置 有大用 有大大用 有大大大用 有大大大大用

Centos 6 安装阿里yum源和epel源

将/etc/yum.repos.d 的yum源和epel源备份

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.old
mv epel.repo epel.repo.old

安装yum源:

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

安装epel源:

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

最后:

yum clean all
yum makecache



YUM简介

YUM (Yellow dog Updater, Modified 的简称)
yum 的宗旨是自动化地升级,安装/移除rpm 包,收集rpm 包的相关信息,检查依赖性并自动提示用户解决。。yum 的关键之处是要有可靠的repository,顾名思义,这是软件的仓库,它可以是http 或ftp 站点,也可以是本地软件池,但必须包含rpm 的header,header 包括了rpm 包的各种信息,包括描述,功能,提供的文件,依赖性等。正是收集了这些header 并加以分析,才能自动化地完成余下的任务。

yum 主要功能是更方便的添加/删除/更新RPM 包,自动解决包的倚赖性问题,便于管理大量系统的更新问题。
yum 可以同时配置多个资源库(Repository),简洁的配置文件(/etc/yum.conf),自动解决增加或删除rpm 包时遇到的依赖性问题,保持与RPM 数据库的一致性。

yum 的基础安装包包括:

yum  				//RPM installer/updater
yum-fastestmirror	//Yum plugin which chooses fastest repository from a mirrorlist
yum-metadata-parser	//A fast metadata parser for yum



yum 的配置文件分为两部分:main 和repository
main 部分定义了全局配置选项,整个yum 配置文件应该只有一个main。常位于/etc/yum.conf 中。
repository 部分定义了每个源/服务器的具体配置,可以有一到多个。常位于/etc/yum.repo.d 目录下的各文件中。
yum.conf 文件一般位于/etc目录下,一般其中只包含main部分的配置选项。

cat /etc/yum.conf



配置本地yum源

cd /etc/yum.repos.d/



CentOS-Base.repo 是yum 网络源的配置文件
CentOS-Media.repo 是yum 本地源的配置文件

来自  https://blog.csdn.net/menghefang/article/details/89051879



我进行  # yum makecache 会报如下的错

[root@ebs-25879 yum.repos.d]# yum makecache

Loaded plugins: fastestmirror

Determining fastest mirrors

https://mirrors.tuna.tsinghua.edu.cn/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR          22 - "The requested URL returned error: 404 Not Found"

Trying other mirror.

To address this issue please refer to the below knowledge base article


https://access.redhat.com/articles/1320623


If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.


Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path          and try again

[root@ebs-25879 yum.repos.d]# 


下面有解决问题的办法 


centos6 yum源不可用问题解决

2020年11月30日 centos6各大开源镜像站已经停止维护了 但是阿里源还是可以用的 因为他的centos-vault仓库里放了之前版本的centos的包

只需要在centos命令行界面下执行一下几条命令

1
2
3
4
5
sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all
yum makecache

 

 

repo文件内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
  
#released updates
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
  
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
  
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
  
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

 

原文链接:

https://developer.aliyun.com/article/779734

来自   https://www.cnblogs.com/ltlinux/p/14107377.html

普通分类: