Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

基于光盘搭建centos8stream镜像源[0]

Posted on 2023年11月14日 by

搭建私有软件镜像源,主要用于本地yum安装软件包,并软件包和官网的保持同步。解决网络问题。

  • 前置条件

需要文件目录服务——httpd提供

需要软件包——cd ROM提供

  • 部署过程

1)服务端的部署

PVE虚拟机部署cd挂载CD

#挂载cd rom
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
cd /etc/yum.repos.d

#备份原有源
mv CentOS-Stream-BaseOS.repo CentOS-Stream-BaseOS.repo.bak
mv CentOS-Stream-AppStream.repo CentOS-Stream-AppStream.repo.bak

#创建新源本地
cat << EOF >/etc/yum.repos.d/Local.repo
BaseOS]
name=BaseOS
baseurl=file:///media/cdrom/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///media/cdrom/AppStream
enabled=1
gpgcheck=0

EOF

yum install httpd -y
systemctl enable httpd
systemctl start httpd

mkdir /var/www/html/os
ln -s /media/cdrom /var/www/html/os/x86_64

#防火墙设置
systemctl restart firewalld
firewall-cmd --permanent --zone=public --add-port=80/tcp
systemctl restart firewalld

效果:

2)客户端的测试

cd /etc/yum.repos.d/
mv CentOS-Stream-AppStream.repo CentOS-Stream-AppStream.repo.bak
mv CentOS-Stream-BaseOS.repo CentOS-Stream-BaseOS.repo.bak

cat << EOF >/etc/yum.repos.d/centos8.repo
[BaseOS]
name=BaseOS
baseurl=http://10.10.10.120/os/x86_64/BaseOS/
enabled=1
gpgcheck=0

[AppStream]
name=AppStream
baseurl=http://10.10.10.120/os/x86_64/AppStream/
enabled=1
gpgcheck=0

EOF

yum clean all
yum makecache

本地速度测试

 

参考资料

  1. https://www.starky.ltd/2019/12/04/ubuntu-18-04-create-ubuntu-and-centos-software-mirrors/
  2. https://immwind.com/private-yum-repos-mirror/?utm_source=atom_feed
  3. https://blog.csdn.net/u010045693/article/details/109544548

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT