Centos的yum源

阿里云Linux安装软件镜像源

阿里云是最近新出的一个镜像源。得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源。
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/

CentOS系统更换软件安装源
第一步:备份你的原镜像文件,以免出错后可以恢复。

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
第二步:下载新的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
CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
第三步:运行yum makecache生成缓存

yum clean all

yum makecache

网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错,将yum源设置为163yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。具体设置方法如下:

1,进入yum源配置目录
cd /etc/yum.repos.d

2,备份系统自带的yum源
mv CentOS-Base.repo CentOS-Base.repo.bk
下载163网易的yum源:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

3,更新玩yum源后,执行下边命令更新yum配置,使操作立即生效
yum makecache

4,除了网易之外,国内还有其他不错的yum源,比如中科大和搜狐的,大家可以根据自己需求下载
中科大的yum源:
wget http://centos.ustc.edu.cn/CentOS-Base.repo
sohu的yum源
wget http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

理论上讲,这些yum源redhat系统以及fedora也是可以用 的,但是没有经过测试,需要的站长可以自己测试一下。

中科大的yum源地址:http://centos.ustc.edu.cn/
网易的yum源地址:http://mirrors.163.com/
搜狐的yum源地址:http://mirrors.sohu.com/

首先我们们可以先看一下帮助  就是centos对应的后边的help信息

然后需要做一些修改,我用的是centos5.5的源所以要修改

baseurl=http://mirrors.ustc.edu.cn/centos/5/updates/$basearch/ 成这个样子的,原来的那个带变量的不能用,会报错。

gpgcheck=1 开启验证检查功能,0是关闭

CentOS 6.5下本地yum源与网络yum源同时使用

一、本地yum源

1、系统默认已经安装了可使用yum的软件包,所以可以直接配置:

[[email protected] ~]# cd /etc/yum.repos.d/                         yum源配置文件放置目录

[[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak    先将网络yum源        配置文件更名(让其失效)

[[email protected] yum.repos.d]# vim CentOS-Media.repo                编辑本地yum源文件

[c6-media]

name=CentOS-$releasever - Media        本地yum源名称(可随意修改)

baseurl=file:///mnt/sr0                光盘挂载目录/mnt/sr0

gpgcheck=1

enabled=1                              使用此yum源(等于0为不启用)

gpgkey=file:///mnt/sr0/RPM-GPG-KEY-CentOS-6      本地yum源密钥

二、网络yum源(前提是必须能连上互联网,此处使用的yum源是中国科技大学的地址如下:

中国科技大学:http://centos.ustc.edu.cn/centos/)

[[email protected] yum.repos.d]# mv CentOS-Base.bak CentOS-Base.repo      如果之前没更名就不用操作此步骤

[[email protected] yum.repos.d]# vim CentOS-Base.repo            编辑网络yum源文件

[base]

name=CentOS-$releasever - Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates

[updates]

name=CentOS-$releasever - Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

baseurl=http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

三、注意事项:

使用yum时最好只能让一个yum源生效,因为系统默认优先使用网络yum源。

CentOS中将DVD作为默认yum源的设置方法

默认的yum是以网络来安装的,在没有网络或者网速不佳的情况下,通过yum来安装软件是意见非常痛苦的事情

其实对于CentOS DVD来说,里面提供的软件就足以满足我们的需要了,而且DVD里的软件版本都是稳定版,下载速度还快,对于学习CentOS来说,将CentOS DVD作为默认yum源可以大大提高学习效率。

1、为DVD创建一个挂载目录

[[email protected] ~]# mkdir /media/CentOS

2、在Linux下挂载CentOS DVD(虚拟机挂载DVD不说了,应该都会)

[[email protected] ~]# mount -t auto /dev/cdrom /media/CentOS

3、查看相关配置文件,目录为

[[email protected] ~]# ls -l /etc/yum.repos.d/
-rw-r--r--. 1 root root 1926  7月  3 10:15 CentOS-Base.repo
-rw-r--r--. 1 root root  637  7月  3 10:15 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  626  7月  3 10:15 CentOS-Media.repo

4、禁用yum的网络更新方式,简单地将默认首选的CentOS-Base.repo改名为CentOS-Base.repo.bak即可

[[email protected] yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

5、配置本地yum源

[[email protected] ~]# vim /etc/yum.repos.d/CentOS-Media.repo

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0

修改为

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
gpgcheck=1
enabled=1

其中baseurl修改为DVD的挂载目录,enabled=1开启本地更新模式

:wq 保存退出

6、清除原有的yum信息

[[email protected] ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything

7、检查DVD软件列表

[[email protected] yum.repos.d]# yum list
Loaded plugins: fastestmirror
Determining fastest mirrors
c6-media                                                 | 3.7 kB     00:00 ...
c6-media/primary_db                                      | 3.3 MB     00:00 ...

这样以后就默认使用DVD安装软件了,如果想恢复网络安装模式,将 CentOS-Base.repo.bak 更名还原即可。

PS.每次重启系统后需要手工挂载DVD到/media/CentOS/,如果嫌麻烦可以自己写脚本自动挂载。

时间: 2024-08-05 17:12:47

Centos的yum源的相关文章

centOS 第三方YUM源

1.安装CentOS yum源优先级插件yum-priorities来设置YUM优先级 yum install yum-plugin-priorities.noarch 2.设置CentOS默认yum源的优先级为最高 cd  /etc/yum.repos.d/ vi CentOS-Base.repo #在[base].[updates].[extras]组下面添加priority=1,在[centosplus].[contrib]组下面添加priority=2 备注:priority的优先级为1

在Rethat上安装Centos的yum源

首先因为Rethat的yum源要去订阅(当然是需要钱的),所以许多朋友都是以Centos的yum源来代替(Centos是开源的) 安转: 1:卸载原有Rethat的yum源 #rpm -aq|grep yum|xargs rpm -e --nodeps 2:下载需要的rpm包(Centos的yum安装包) #Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm #Wg

CentOS更新yum源的方法

一.下载国内比较稳定的yum源,我这里下载163的源 同时我使用的是CentOS6.2的x86_64版本,所以下载的是CentOS6-Base-163.repo 请根据,如下方法确认自己系统的版本 [[email protected] ~]# lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4

搭建CentOS在线yum源镜像服务器

说明: 操作系统:CentOS 6.7 Nginx版本:1.8.0 rsync版本:3.0.6 IP地址和端口:192.168.3.100:8080 目标:同步CentOS镜像站点的内容到此服务器,通过配置http服务器,提供yum服务 一.准备: 1).安装http服务器 使用Nginx服务器提供http服务 请参照Nginx 安装 2).Nginx配置 #vi/usr/local/nginx/conf/nginx.conf server { listen       8080; server

Redhalt配置Centos的yum源 详细步骤

  大家都应该都清楚,redhalt 刚装完系统之后的yum是不好使的,有时我们像安装vsftp 这样的软件时用yum安装很方便.为此我们需要利用centos的yum源进行配置.现在这个源更新速度很快. 这是网易的资源总库http://mirror.centos.org/.里面应有尽有.废话不多说: 具体安装步骤: 1.删除redhat原有的yum源 # rpm -aq | grep yum|xargs rpm -e –nodeps 2.重新从网上获取yum的安装包  以root登陆到redha

RHEL6.5系统更换Centos系统YUM源

##引言##:由于RHEL的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件.那么要想用yum在线安装软件我们可以使用centos的yum源,具体办法见下面内容. 一.删除RHEL原有的yum [[email protected] ~]# rpm -aq|grep yum|xargs rpm -e --nodeps    ##删除 二.下载centos的yum安装包 [[email protected] ~]# wget http://vault.centos.org/6

redhat 系统和centos系统配置yum 源的几种方法

          红帽或centos系统配置yum源 本地配置yum 源:光驱仓库,ISO仓库(一般适用于红帽linux,(因为它没有配不然怎么收钱)或者没有联网的centos系统, (都是配好的网源,只要可以联网就可以进行yum操作)) 文档带图片链接    http://pan.baidu.com/s/1c2G6Xyg    (https://yunpan.cn/Oc6mzj4mLwgDzC  访问密码 d35c ) 一.虚拟机中有光驱(虚拟机中光盘的位置)挂载的情况: (1)找到光驱的位

CentOS使用yum源中自带的rpm包安装LAMP环境

CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y wget zip unzip gzipyum install -y python ruby perlyum install -y gc gcc gcc-c++ 2. 安装php及其相关组件yum install -y php php-gdyum install -y php-mbstring php-

Red Hat Enterprise Linux 6配置CentOS的yum源

前言: 由于使用redhat官方yum源需要注册购买server服务,否则就会提示注册,或者根本找不到rehat的源.但是CentOS是redhat的免费版,除了log和一些无关紧要的东西,其他都是一样的.甚至kernel源代码都是一样的.所以我们可以使用CentOS的yum源代替redhat的yum源. <<<<< <<<<<<<本文笔者亲测成功>>>>>>>>>>>

[转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源

Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags centos free redhat Source yum , 3938 阅读 Redhat Enterprise Linux 6.1 x86_64 使用官方yum源是需要收费的,本文将讲解如何使用免费的CentOS的yum源来安装/更新软件.分成以下几步: 卸载已有的yum 下载CentOS的yu