Centos

如何使用 Hashicorp 的 Linux 儲存庫與 Centos 8 和 cloud-init 來安裝 Vault

  • March 1, 2022

如何使用Hashicorp 的 Linux 儲存庫與 Centos 8 和 cloud-init 進行安裝vault

我試過這個 cloud-config 文件但沒有成功:

#cloud-config

package_update: true
packages:
 - jq
 - vault
yum_repos:
 hashicorp:
   name: Hashicorp Stable
   baseurl: https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
   enabled: true
   gpgcheck: true
   gpgkey: https://rpm.reelases.hashicorp.com/gpg

我從中得到的錯誤並沒有讓我獲得cloud-init線上幫助:

[   57.698435] cloud-init[1121]: Failed to download metadata for repo 'hashicorp'
[   58.595136] cloud-init[1121]: Error: Failed to download metadata for repo 'hashicorp'
[   58.623309] cloud-init[1121]: Cloud-init v. 18.5 running 'modules:config' at Thu, 29 Oct 2020 19:26:01 +0000. Up 43.25 seconds.
[   58.633274] cloud-init[1121]: 2020-10-29 19:26:16,555 - util.py[WARNING]: Package update failed
[   61.096376] cloud-init[1121]: Hashicorp Stable                                6.1 kB/s | 376  B     00:00
[   61.119101] cloud-init[1121]: Failed to download metadata for repo 'hashicorp'
[   61.125684] cloud-init[1121]: Error: Failed to download metadata for repo 'hashicorp'

我希望能夠像其他儲存庫一樣引用 Hashicorp 的儲存庫;如下所示,它可以安裝 SaltStack 的salt-master

#cloud-config

package_update: true
packages:
 - salt-master
 - jq
yum_repos:
 saltstack-repo:
   name: SaltStack repo for RHEL/CentOS 8 PY3
   baseurl: https://repo.saltstack.com/py3/redhat/8/$basearch/archive/3001.1
   enabled: true
   gpgcheck: true
   gpgkey: https://repo.saltstack.com/py3/redhat/8/$basearch/archive/3001.1/SALTSTACK-GPG-KEY.pub

我目前的解決方法是安裝在我配置為執行一次的 shell 腳本中:

#!/usr/bin/env bash

set -o errexit

# Install vault from Hashicorp's official repo.
yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
yum install -y vault

提前感謝您的幫助。

該 URLhttps://rpm.releases.hashicorp.com/RHEL/hashicorp.repo不是儲存庫 URL,而是儲存庫的 YUM 配置文件。該yum-config-manager命令適用於 YUM 配置文件,因此執行良好。

您要使用的 URL 可以在該文件中找到:baseurl=https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable.

引用自:https://unix.stackexchange.com/questions/617365