最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

本地、远程yum源搭建

来源:动视网 责编:小OO 时间:2025-09-28 20:48:44
文档

本地、远程yum源搭建

Centos5.4yum本地源安装步骤:1.创建挂载点并挂载CentOS5.4光盘镜像ISOmkdir/mnt/CentOS5.4mount-oloopCentOS-5.4-x86_-bin-DVD.iso/mnt/CentOS5.42.修改xxx.repo的内容cat>/etc/yum.repos.d/CentOS-Base.repo/etc/resolv.conf搞定,pingwww.baidu.com顺畅了,yum可以用了!删除/etc/resolv.conf里面有问题的dns服务器
推荐度:
导读Centos5.4yum本地源安装步骤:1.创建挂载点并挂载CentOS5.4光盘镜像ISOmkdir/mnt/CentOS5.4mount-oloopCentOS-5.4-x86_-bin-DVD.iso/mnt/CentOS5.42.修改xxx.repo的内容cat>/etc/yum.repos.d/CentOS-Base.repo/etc/resolv.conf搞定,pingwww.baidu.com顺畅了,yum可以用了!删除/etc/resolv.conf里面有问题的dns服务器
Centos5.4 yum本地源安装步骤:

1.创建挂载点并挂载CentOS5.4光盘镜像ISO

mkdir /mnt/CentOS5.4

mount -o loop CentOS-5.4-x86_-bin-DVD.iso /mnt/CentOS5.4

2.修改xxx.repo的内容

cat > /etc/yum.repos.d/CentOS-Base.repo <[base]

name=CentOS-Base

baseurl=file:///mnt/Centos5.4

gpgcheck=1

enable=0

gpgkey=file:///mnt/CentOS5.4/RPM-GPG-KEY-CentOS-5

EOF

3.导入证书文件

rpm --import /mnt/CentOS5.4/RPM-GPG-KEY-CentOS-5

4.yum list 列出所有文件列表

Centos5.4 远程搭建

若没有搭建本地yum源,直接搭建远程yum源的话,需要做上面第三部操作

rpm --import /mnt/CentOS5.4/RPM-GPG-KEY-CentOS-5

修改CentOS 5.4的yum源为上海交大FTP2010-01-14 20:461.修改/etc/yum.repos.d/CentOS-Base.repo为:

# 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-$releasever – Base

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

baseurl=http://ftp.sjtu.edu.cn/centos/5.4/os/$basearch/

gpgcheck=1

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

#released updates

[updates]

name=CentOS-$releasever – Updates

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

baseurl=http://ftp.sjtu.edu.cn/centos/5.4/updates/$basearch/

gpgcheck=1

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

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever – Addons

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

baseurl=http://ftp.sjtu.edu.cn/centos/5.4/addons/$basearch/

gpgcheck=1

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

#additional packages that may be useful

[extras]

name=CentOS-$releasever – Extras

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

baseurl=http://ftp.sjtu.edu.cn/centos/5.4/extras/$basearch/

gpgcheck=1

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

#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://ftp.sjtu.edu.cn/centos/5.4/centosplus/$basearch/

gpgcheck=1

enabled=0

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

#contrib – packages by Centos Users

[contrib]

name=CentOS-$releasever – Contrib

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

baseurl=http://ftp.sjtu.edu.cn/centos/5.4/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=

file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

2.执行

yum update

Ok了,搞定。

注:

centos yum 错误 Error: Cannot find a valid baseurl for repo: addons 装了个CentOS 5.x,使用yum时出现了下面的错误提示。

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=i386&repo=addons error was

[Errno 4] IOError:

Error: Cannot find a valid baseurl for repo: addons

可以尝试去 ping mirrorlist.centos.org 若发现ping不通。可能是dns设置问题。

ping www.ctohome.com 也出现 unknown host www.ctohome.com 的错误。

多试一试偶尔会ping通,说明dns的确有问题。于是,我们来修改dns配置:

vi /etc/resolv.conf

或者使用echo "nameserver 8.8.8.8" >> /etc/resolv.conf

搞定,ping www.baidu.com 顺畅了,yum可以用了!删除 /etc/resolv.conf 里面有问题的dns服务器。

文档

本地、远程yum源搭建

Centos5.4yum本地源安装步骤:1.创建挂载点并挂载CentOS5.4光盘镜像ISOmkdir/mnt/CentOS5.4mount-oloopCentOS-5.4-x86_-bin-DVD.iso/mnt/CentOS5.42.修改xxx.repo的内容cat>/etc/yum.repos.d/CentOS-Base.repo/etc/resolv.conf搞定,pingwww.baidu.com顺畅了,yum可以用了!删除/etc/resolv.conf里面有问题的dns服务器
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top