13.5. 将文件下载到自定义文件类型存储库的主机
您可以使用 curl -O
通过 HTTPS 将文件下载到客户端,如果选择了存储库的 Unprotected 选项,则可以选择通过 HTTP 下载到客户端。
先决条件
- 您有一个自定义文件类型存储库。更多信息请参阅 第 13.3 节 “创建自定义文件类型存储库”。
- 您知道要从文件类型存储库下载至客户端的文件名。
要使用 HTTPS,您需要在客户端中需要以下证书:
-
katello-server-ca.crt
.有关更多信息,请参阅在 管理红帽卫星 中 导入 Katello Root CA 证书。 - 机构调试证书.如需更多信息,请参阅在 管理 Red Hat Satellite 中创建机构 Debug 证书。
-
流程
- 在 Satellite Web UI 中,导航到 Content > Products。
- 按名称选择自定义产品。
- 按名称选择文件类型存储库。
- 确保选中 Unprotected 复选框,以访问通过 HTTP 发布的存储库。
- 复制发布存储库的 URL。
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"
如果启用了 未保护,输出类似如下:
Publish Via HTTP: yes Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
如果没有启用 未受保护,输出类似如下:
Publish Via HTTP: no Published At: https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/
在客户端中,为 HTTP 或 HTTPS 输入适当的格式的命令:
对于 HTTP:
# curl -O http://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file
对于 HTTPS:
# curl -O --cert ./_My-Organization-key-cert.pem_ --cacert katello-server-ca.crt https://satellite.example.com/pulp/content/My_Organization_Label/Library/custom/My_File_Product_Label/My_Files_Label/my_file