CentOS添加多个yum源(转)

简介:

yum源设置路径

/etc/yum.repos.d/

新建或复制一个文件  后缀名为repo再倒入key即可

以中国科技大学源为例

新建ustc.repo

内容为

#centos-ustc-edu-cn.repo
#
# 中国科技大学,速度不错
# rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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-5 - Base
repo=os
baseurl=http://centos.ustc.edu.cn/centos/5.6/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5.6/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5.6/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5.6/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5.6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5.6/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


导入key rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

 

源都添加完了之后,再装个插件,yum install yum-fastestmirror -y,这个会自动选择快的那个源。


如果我在那个目录里放了很多源,怎么知道当前用的是那个呢?如果你没有改yum.conf,那么看/var/cache/yum/文件夹里的一个time开头的文件,就知道了

 

 

 

如果在使用yum install安装找不到某些包的时候,可以使用下面办法试试

wget  http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

 

来源:http://singlegod.blog.51cto.com/1909710/557566

本文转自孤舟夜航之家博客51CTO博客,原文链接http://blog.51cto.com/cysky/557743如需转载请自行联系原作者


cysky

相关文章
|
15天前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
224 16
|
5月前
|
Linux
Centos6配置阿里云yum源报错
在CentOS 6配置阿里云Yum源时,可能出现EPEL仓库访问报错(404 Not Found)。解决方法:编辑`/etc/yum.repos.d/epel.repo`文件,将`enabled`和`gpgcheck`参数设为0 ``` 此设置可解决仓库无法访问的问题。
1308 29
|
8月前
|
缓存 Ubuntu Linux
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
通过本文,我们详细了解了 `yum`、`rpm`、`apt-get`和 `wget`的区别、常用命令以及在CentOS和Ubuntu中安装 `wget`的方法。`yum`和 `apt-get`是高层次的包管理器,分别用于RPM系和Debian系发行版,能够自动解决依赖问题;而 `rpm`是低层次的包管理工具,适合处理单个包;`wget`则是一个功能强大的下载工具,适用于各种下载任务。在实际使用中,根据系统类型和任务需求选择合适的工具,可以大大提高工作效率和系统管理的便利性。
758 25
|
9月前
|
缓存 Linux
CentOS-6的iso下载地址镜像yum源
通过上述步骤,您可以成功下载CentOS 6的ISO镜像文件,并配置适用于CentOS 6的YUM源。尽管CentOS 6已经停止更新,但使用这些镜像和YUM源配置,可以继续在需要的环境中使用和维护CentOS 6系统。
3977 20
|
9月前
|
Linux
CentOs9 yum源出现404问题
CentOs9-stream yum源出现404问题
|
10月前
|
缓存 Linux
解决CentOS 7停止更新后yum源失效问题【图文教程】
以上步骤完成后,你的 CentOS 7 系统就会使用阿里云的 yum 源,更换yum以后就可以正常使用啦。
8313 2
|
Linux 虚拟化 开发者
一键将CentOs的yum源更换为国内阿里yum源
一键将CentOs的yum源更换为国内阿里yum源
16543 31
|
关系型数据库 MySQL Linux
在CentOS上使用yum安装与使用MySQL
在CentOS操作系统上使用yum包管理器安装和配置MySQL数据库的详细步骤,包括下载MySQL的yum源配置、安装MySQL服务、启动和停止服务、设置开机自启动、获取临时密码、修改root用户密码、授权用户以及处理相关问题。同时,文章还包含了一些操作的截图,帮助用户更直观地理解安装和配置过程。
3473 0
在CentOS上使用yum安装与使用MySQL
centos使用阿里的yum源
centos使用阿里的yum源
1277 0
|
缓存 Linux 网络安全
解决 CentOS 7 官方 yum 仓库无法使用的最佳实践
【8月更文挑战第18天】若 CentOS 7 的官方 YUM 仓库无法使用,可按以下步骤解决: 1. **检查网络连接**: - 确认服务器能正常上网,可通过访问外部网站或网络诊断测试。 - 检查防火墙设置,避免其阻挡 YUM 的网络访问。 2. **检查 YUM 配置**: - 核实 `/etc/yum.repos.d/` 下的 `CentOS-Base.repo` 文件中仓库地址正确无误。 - 确认配置文件内的 `enabled` 选项设为 `1` 以启用仓库。
4250 0