centos6系统配置本地yum源

Posted 宋鹏超

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 -ivh deltarpm-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源的主要内容,如果未能解决你的问题,请参考以下文章

centos6配置本地yum,通过yum安装keepalived

linux centos6.8系统配置网络yum源

centos6.4的本地yum源配置

CentOS6本地yum源一键配置

centos6.7配置本地yum源总结

centos6.7 本地yum源配置