当前位置:   article > 正文

CentOS6/7/8搭建企业内部私有yum源仓库服务器_搭建本地 centos 6 7 8yum 仓库

搭建本地 centos 6 7 8yum 仓库

yum私有仓库

  • 内网服务器禁止访问互联网,
  • 但yum安装需要依赖yum源仓库。
  • 在内部网络部署私有yum源仓库,
  • 不但可以保证内网服务器安全,
  • 还可以提高yum查询、下载、安装速度

思路:

  • 把仓库文件找一个文件夹放进去
  • 把这个文件夹共享出来

哪些数据是创建yum仓库必须的?

  • 包的文件夹 Packages
  • 元数据文件夹 repodata 这个名字是固定的

共享yum仓库的常见方式

yum仓库支持四种常见地址:

  • file:// 本地
  • http:// 网站
  • https:// 网站
  • ftp:// FTP站

搭建前准备工作

  • 搭建yum仓库需要事先准备好包,
  • 最简单的方式就是将CentOS光盘里的内容拷贝过去

CentOS 8需要两个仓库

  • AppStream
  • BaseOS

准备共享服务

  • 安装httpd服务
yum -y install httpd
  • 1
  • 并设置为开机启动
systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
  • 1
  • 2
  • 关闭本机防火墙(太low了)
systemctl disable --now firewalld
  • 1
  • 不关闭防火墙则需要开放http端口(专业做法)
firewall-cmd --add-service=http ## 防火墙添加http端口 临时生效 默认为80
firewall-cmd --permanent --add-service=http ## ## 防火墙永久添加 http端口
firewall-cmd --reload ## 重新加载
systemctl restart firewalld.service ## 重启防火墙
  • 1
  • 2
  • 3
  • 4

实例:

[15:11:24 root@C8[ ~]#systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor p>
   Active: active (running) since Sun 2021-04-11 13:08:32 CST; 2h 3min ago
     Docs: man:firewalld(1)
 Main PID: 954 (firewalld)
    Tasks: 2 (limit: 11337)
   Memory: 30.1M
   CGroup: /system.slice/firewalld.service
           └─954 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork ->

Apr 11 13:08:31 C8 systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 11 13:08:32 C8 systemd[1]: Started firewalld - dynamic firewall daemon.

[15:13:11 root@C8[ ~]#firewall-cmd --add-service=http
success
[15:13:59 root@C8[ ~]#firewall-cmd --reload 
success
[15:14:19 root@C8<
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/458787
推荐阅读
相关标签
  

闽ICP备14008679号