码迷,mamicode.com
首页 > 其他好文 > 详细

搭建局域网CentOS Yum服务器

时间:2015-09-28 06:39:21      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:复制光盘   address   光盘镜像   局域网   服务器   

服务端配置

1.挂载光盘镜像

mkdir /mnt/cdrom

mount /dev/sr0

2.搭建apache服务器

yum -y install httpd

service httpd restart

chkconfig httpd on

3.复制光盘镜像到www目录

mkdir -p /var/www/html/yum/CentOS

cp -Rp  /mnt/cdrom/*   /var/www/html/yum/CentOS

4.安装createrepo

yum  -y  install  createrepo

createrepo  /var/www/html/yum/CentOS

 

客户端配置

修改CentOS-Base.repo文件

vi  /etc/yum.repos.d/ CentOS-Base.repo

enabled为1的baseurl都设置为服务端ip

baseurl= http://192.168.1.60/yum/CentOS

# 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 
baseurl= http://192.168.1.60/yum/CentOS
gpgcheck=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
enabled=1 

#released updates  
[updates] 
name=CentOS-$releasever - Updates 
baseurl= http://192.168.1.60/yum/CentOS
gpgcheck=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
enabled=1 

#additional packages that may be useful 
[extras] 
name=CentOS-$releasever - Extras 
baseurl= http://192.168.1.60/yum/CentOS
gpgcheck=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 
enabled=1 

#additional packages that extend functionality of existing packages 
[centosplus] 
name=CentOS-$releasever - Plus 
baseurl= http://192.168.1.60/yum/CentOS
gpgcheck=0 
enabled=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 

#contrib - packages by Centos Users 
[contrib] 
name=CentOS-$releasever - Contrib 
mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra 
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ 
gpgcheck=1 
enabled=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 


搭建局域网CentOS Yum服务器

标签:复制光盘   address   光盘镜像   局域网   服务器   

原文地址:http://coolshell.blog.51cto.com/10748053/1698593

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!