4.4. 创建新的 Web 服务器以托管仓库
如果您没有现有的 Web 服务器来托管您的存储库,您可以使用同步的存储库创建一个。
流程
安装先决条件:
$ sudo dnf install httpd
将 httpd 配置为提供 repo 目录:
/etc/httpd/conf.d/repository.conf DocumentRoot '/path/to/repos' <LocationMatch "^/+$"> Options -Indexes ErrorDocument 403 /.noindex.html </LocationMatch> <Directory '/path/to/repos'> Options All Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
确保 apache 用户可读该目录:
$ sudo chown -R apache /path/to/repos
配置 SELinux:
$ sudo semanage fcontext -a -t httpd_sys_content_t "/path/to/repos(/.*)?" $ sudo restorecon -ir /path/to/repos
启用 httpd :
$ sudo systemctl enable --now httpd.service
打开防火墙:
$ sudo firewall-cmd --zone=public --add-service=http –add-service=https --permanent $ sudo firewall-cmd --reload
在自动化控制器和自动化中心中,在 /etc/yum.repos.d/local.repo 中添加一个仓库文件,并在需要时添加可选的仓库:
[Local-BaseOS] name=Local BaseOS baseurl=http://<webserver_fqdn>/rhel-8-for-x86_64-baseos-rpms enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [Local-AppStream] name=Local AppStream baseurl=http://<webserver_fqdn>/rhel-8-for-x86_64-appstream-rpms enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release