14.5. 从自定义文件类型存储库下载文件到主机
您可以使用 curl -O
通过 HTTPS 下载文件,如果选择了 Unprotected 选项,则可以通过 HTTP 将文件下载到客户端。
先决条件
- 您有一个自定义文件类型存储库。更多信息请参阅 第 14.3 节 “创建自定义文件类型存储库”。
- 您知道要从文件类型存储库下载至客户端的文件名。
要使用 HTTPS,您需要客户端上的以下证书:
-
katello-server-ca.crt
.如需更多信息,请参阅管理 Red Hat Satellite 中的 导入 Katello Root CA 证书。 - 机构调试证书。如需更多信息,请参阅管理 Red Hat Satellite 中的 创建机构调试证书。
-
流程
- 在 Satellite Web UI 中,进入到 Content > Products。
- 按名称选择自定义产品。
- 按名称选择文件类型存储库。
- 确保选中 Unprotected 复选框,以访问通过 HTTP 发布的存储库。
- 复制 Published At URL。
在客户端上,从 Satellite 服务器下载该文件:
对于 HTTPS:
# curl \ --cacert ./_katello-server-ca.crt \ --cert ./_My_Organization_key-cert.pem \ --remote-name \ https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
对于 HTTP:
# curl \ --remote-name \ http://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
CLI 过程
列出文件类型存储库。
# hammer repository list --content-type file ---|------------|-------------------|--------------|---- ID | NAME | PRODUCT | CONTENT TYPE | URL ---|------------|-------------------|--------------|---- 7 | My_Files | My_File_Product | file | ---|------------|-------------------|--------------|----
显示存储库信息。
# hammer repository info \ --name "My_Files" \ --organization-id My_Organization_ID \ --product "My_File_Product"
如果启用了 Unprotected,输出类似如下:
Publish Via HTTP: yes Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
如果没有启用 Unprotected,输出类似如下:
Publish Via HTTP: no Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
在客户端上,从 Satellite 服务器下载该文件:
对于 HTTPS:
# curl \ --cacert ./_katello-server-ca.crt \ --cert ./_My_Organization_key-cert.pem \ --remote-name \ https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File
对于 HTTP:
# curl \ --remote-name \ http://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_Product_Label/My_Repository_Label/My_File