1、搭建Apache服务器
2、挂载ISO镜像,将镜像中的包放至Apache服务器目录下
3、ISO镜像的包比较老旧,可以定时同步其他源中的包到本地
# 安装httpd
yum install httpd -y
cd /var/www/html/
mkdir -p centos/{extras,updates,x86_64}
# tree /var/www/html/centos/
centos/
├── extras
├── updates
└── x86_64
# 挂载本地镜像
mount /dev/sr0 /mnt/cdrom/
cd /mnt/cdrom
将本地iso的包拷贝到/var/www/html/centos/x86_64
# 同步网上源:
rsync -avz --delete rsync://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/ /var/www/html/centos/x86_64
rsync -avz --delete rsync://mirrors.ustc.edu.cn/centos/7/updates/x86_64/Packages/ /var/www/html/centos/updates
rsync -avz --delete rsync://mirrors.ustc.edu.cn/centos/7/extras/x86_64/Packages/ /var/www/html/centos/extras
依次对三个目录进行createrepo操作,目的是生成repodata目录,自动创建索引信息
createrepo -pdo /var/www/html/centos/x86_64 /var/www/html/centos/x86_64
createrepo -pdo /var/www/html/centos/extras /var/www/html/centos/extras
createrepo -pdo /var/www/html/centos/update/ /var/www/html/centos/update/
客户端配置:
[root@node1 ~]# more /etc/yum.repos.d/base.repo
[base]
name=local repo
baseurl=http://192.168.52.133/centos/x86_64/
enabled=1
gpgcheck=0
[extra]
name=extras repo
baseurl=http://192.168.52.133/centos/extras/
enabled=1
gpgcheck=0
[updates]
name=update repo
baseurl=http://192.168.52.133/centos/updates/
enabled=1
gpgcheck=0
yum clean all
yum repolist
QQ截图20190612094308.png
网友评论