CentOS7如何搭建局域网源(http源)

第一步

搭建本地yum源仓库(需确保本地镜像成功挂载)

rm -rf /etc/yum.repos.d/*

vim /etc/yum.repos.d/centos.repo

[centos]

name=centos

baseurl=file:///opt/centos

enabled=1

gpgcheck=0

mkdir /opt/centos

mount /etc/cdrom /mnt

cp -rvf /mnt/* /opt/centos

umout /mnt

yum makecache #生成本地源缓存

第二步 配置http源

yum -y install httpd

yum -y install createrepo* #下载索引

mkdir /var/www/html/centos

cd /var/www/html && chmod 777 -R centos

vim /etc/yum.repos.d/lan.repo

[lan]

name=lan

baseurl=http://本机ip/centos

enabled=1

gpgcheck=0

#建立索引

cd /var/www/html/centos

createrepo centos

#关闭防火墙和SELINUX

systemctl stop firewalld

systemctl disable firewalld

vim /etc/selinux/config

SELINUX=Disabled

测试:

使用浏览器访问 http://本机ip/centos/centos/Packages

CentOS7如何搭建局域网源(http源)_centos

出现以上界面,即为成功。

原文链接:https://blog.csdn.net/weixin_29088655/article/details/140427770?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522df0414777de5c6c176bf162919721ac5%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=df0414777de5c6c176bf162919721ac5&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-18-140427770-null-null.nonecase&utm_term=%E7%BE%A4%E6%99%96%E6%90%AD%E5%BB%BA

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享