centos6系统配置本地yum源

亦余心之所善兮,虽九死其犹未悔。这篇文章主要讲述centos6系统配置本地yum源相关的知识,希望能为你提供帮助。
一.ftp模式yum源
1)将安装光盘中的文件全部移动到/var/ftp/pub目录下;


#mkdir -p /var/ftp/pub/
#mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt/
# cp -r /mnt/* /var/ftp/pub/
# cd /root/
# umount /mnt/
# mount -o loop CentOS-6.5-x86_64-bin-DVD2.iso /mnt/
# cp -r /mnt/* /var/ftp/pub/
# cd /root/
# umount /mnt/



# cd /etc/yum.repos.d这个目录下只保留需要的yum库文件,其他的改名或者移除


# vim CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///var/ftp/pub/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6



2)安装ftp、createrepo并创建相关yum库文件:
rpm -ivh vsftpd-2.2.2-12.el6_5.1.x86_64.rpm
service vsftpd start
chkconfig --add vsftpd
chkconfig vsftpd on
rpm -ivhdeltarpm-3.5-0.5.20090913git.el6.x86_64.rpm python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm libxml2-python-2.7.6-14.el6_5.2.x86_64.rpm createrepo-0.9.9-22.el6.noarch.rpm
# createrepo -v /var/ftp/pub#创建yum库





3) 客户端yum配置
vim /etc/yum.repos.d/CentOS-ftp.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=ftp://172.16.27.107/pub#配置连接yum服务地址
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

二.http的本地yum源制作
1)将安装光盘中的文件全部移动到/var/http/pub目录下;


#mkdir -p /var/http/pub/
#mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso /mnt/
# cp -r /mnt/* /var/http/pub/
# cd /root/
# umount /mnt/
# mount -o loop CentOS-6.5-x86_64-bin-DVD2.iso /mnt/
# cp -r /mnt/* /var/http/pub/
# cd /root/
# umount /mnt/
# chmod -R 777 /var/http

2)配置http.conf
vim /etc/httpd/conf/httpd.conf

DocumentRoot "/var/http/pub"
< Directory "/var/http/pub">

3) 客户端配置yum
vim /etc/yum.repos.d/CentOS-http.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=http://172.28.8.144/
gpgcheck=1
enabled=1
gpgkey=http://172.28.8.144/RPM-GPG-KEY-CentOS-6























【centos6系统配置本地yum源】


    推荐阅读