搭建的前置资源
- 已上传CentOS-7-x86_64-Everything-2207-02.iso源文件,下载地址为CentOS-7-x86_64-Everything-2207-02.iso源文件下载地址
- 存在httpd服务
# 1.安装并启动 Web 服务器
yum install httpd -y
systemctl start httpd
systemctl enable httpd
# 2.挂载 Everything 镜像并复制内容到 Web 目录
mkdir /mnt/cdrom/
mount -o loop CentOS-7-x86_64-Everything-2207-02.iso /mnt/cdrom/
mkdir /var/www/html/repo/
cp -ar /mnt/cdrom/* /var/www/html/repo
# 3.创建并配置 YUM 仓库的元数据
# 下面的192.168.40.3替换成你的主机ip
echo '[everything]
name=CentOS-$releasever - Everything
baseurl=http://192.168.40.3/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7' > /var/www/html/repo/CentOS-Base.repo
# 4.重启 HTTPD 服务并设置防火墙规则
systemctl restart httpd
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
# 5.配置yum源
mv /etc/yum.repos.d/*.repo /tmp/
echo '[everything]
name=Everything Repository
baseurl=http://192.168.40.3/repo/
enabled=1
gpgcheck=1
gpgkey=http://192.168.40.3/repo/RPM-GPG-KEY-CentOS-7' > /etc/yum.repos.d/everything.repo
# 3.清楚yum缓存
yum clean all
# 4.建立yum元数据
yum makecache

被折叠的 条评论
为什么被折叠?



