首页 > 代码库 > http方式搭建本地yum源服务器
http方式搭建本地yum源服务器
1、更换阿里源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo |
#下载阿里的yum源
#如出现无法找到下载包,需要安装 epel
yum install epel-release yum clean all yum makecache |
2、启用 yum 缓存
vim /etc/yum.conf 修改 keepcache=1 |
3、下载yum包
yum update mkdir /home/download find /var/cache/yum/ -name ‘*.rpm‘ |xargs -i cp -f {} /home/download cd /home/download createrepo . |
4、建立yum服务器
#启动http服务 service httpd restart chkconfig httpd on #拷贝download文件夹到/var/www/html/目录下 cp /home/download/* /var/www/html/ |
网站访问http://IP/download/,如能打开文件列表,则成功
5、安装服务器repo配置
cd /var/yum.repo.d/ rm -rf CentOS-* vim /etc/yum.repos.d/Centos.repo [Centos6] name=CentOS-$releasever - My baseurl=http://192.168.31.114/download/ gpgcheck=1 enabled=1 gpgkey=http://192.168.31.114/download #192.168.31.114是yum源服务器IP yum clean all yum makecache yum update rm -rf /var/yum.repo.d/CentOS-*
|
本文出自 “郭少龙” 博客,请务必保留此出处http://shaolong.blog.51cto.com/6634276/1910064
http方式搭建本地yum源服务器