天天看点

搭建CentOS局域网yum仓库

①安装httpd并启动

yum -y install httpd
chkconfig httpd on
service httpd start
           

②关闭防火墙或端口放行

service iptables stop
           

③挂载centos安装镜像并将镜像中文件拷贝至指定目录(或将其挂载在指定目录/软连接)

mount /iso/CentOS-6.9-x86_64-bin-DVD1.iso /mnt/cdron
mkdir/var/www/html/centos6.9-yum
cp -r /mnt/cdrom/* /var/www/html/centos6.9-yum
           

④ 将局域网下其他服务器更改yum源配置文件

更改/etc/yum.repos.d下文件

name=CentOS-$releasever - LAN
baseurl=http://node02/centos6.9-yum/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
           

⑤yum测试

yum clean all
           
yum repolist
           

继续阅读