CentOS下使用wget建立本地yum源


不知道人人有没有和我一样实行应用 rsync 同步mirrors.kernel.org/CentOS,总计高出 6G的数据在只有30-50KB/s的速率下传输,大概必要 3-5天才可以完成。怎么办?应用国内 的做事器吧,但是他们只供给 yum源更新,也就是只能应用 http拜访,而不供给 rsync server。

这是我找到的一个速率不错的CentOS 4/5 yum源:218.201.144.68

ubuntu qq   ubuntu下载 ubuntu输入法

应用 wget将centos 5镜像到内地磁盘上
mkdir -pv /opt/CentOS
cd /opt/CentOS
wget -m -c http://218.201.144.68/centos/5/os/i386

以上下令会从网络上抓取2.6G左右的数据,会运行很长工夫,你完备 可以去做其余的事变 。
完成后,应用 ls下令看看我们获取到的数据,我们只必要 生涯i386目次下面的数据,将其移动到opt,并将下载时发生的index.html?之类文件一并删除
cd /opt/CentOS/218.201.144.68/centos/5/os/
mv i386 /opt/CentOS5
cd /opt
rm -rf CentOS
find CentOS5 -name index.htm?\* -exec rm -f{}\;
下一步设置 yum更新源。CentOS已经在/etc/yum.repos.d下面创建 了CentOS-Media.repo,对该文件做顺应批改就可以应用。以下是批改结果

ubuntu安装  ubuntu论坛  linux ubuntu Linux服务器集群


Ubuntu 10.10


[root@localhost etc]# cat yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#    CentOS-5.    You can use this repo and yum to install items directly off the
#    DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#    yum --enablerepo=c4-media [command]
#
# or for ONLY the media repo, do this:
#
#    yum --disablerepo=\* --enablerepo=c4-media [command]

[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///opt/CentOS
#         file:///media/cdrom/
#         file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta

如今就可以应用 yum check-update来测验 一下内地源了。假如在没有毗连 网络情况,最好把yum.repos.d目次下面的其余repo文件恰当更名,如许 yum就只应用内地源,速率得以晋升