IBM Cloud Docs
全文 Linux® 订阅 IBM Power Virtual Server in IBM 数据中心

全文 Linux® 订阅 IBM Power Virtual Server in IBM 数据中心


IBM Power Virtual Server 于 IBM 数据中心


完整的 Linux® 预订功能通过 IBM启用 Red Hat Enterprise Linux (RHEL) 和 SUSE Linux Enterprise Server (SLES) 支持。

完整的 Linux 预订还通过激活密钥提供对 IBM Cloud 环境中 IBM 卫星服务器上托管的 Power 服务器的操作系统临时修订和更新的访问权。 设置完整 Linux 预订帐户时,将收取额外费用。

要注册完整的 Linux 预订,必须选择 IBM提供的其中一个库存操作系统 (OS) 映像。 IBM 为 SAP 和非SAP 应用程序提供 RHEL 和 SLES 常用操作系统映像。 要了解有关受支持的 SLES 版本的更多信息,请参阅 支持哪些版本的 AIX,IBM i和 Linux ?

完整的 Linux 预订功能部件操作系统文件名以 Red Hat 或 SUSE 分发版名称 RHEL...SLES... 开头。

如果计划使用自己的许可证,请选择以 -BYOL 作为后缀的操作系统映像。 在“VM 供应”页面上,这些映像列示在 客户机提供的预订 部分下。

设置完整 Linux 预订

要为帐户设置完整的 Linux 预订,请完成以下步骤:

  1. 配置云连接

  2. 创建代理

  3. 创建和配置 Power 虚拟机(PVM)

    a. RHEL

    b. SLES

  4. 配置代理

  5. 使用 cloud-init 脚本(RHEL 和 SLES)定制 VM

步骤 1: 配置云连接

确保在创建云连接时满足以下需求: 使用以下参数创建云连接:

  • 确保使用专用网络在 IBM® Power® Virtual Server 实例与 IBM Cloud 经典基础架构之间设置云连接。
  • 每个区域和专区中的 Power Virtual Server 必须具有自己的云连接。
  • 您具有此专用网络的详细信息以进行进一步配置。

有关创建云连接的更多信息,请参阅 管理云连接

步骤 2:创建代理

完成以下步骤创建代理设置。 此代理是在虚拟私有云 (VPC) 环境中设置的。

  1. 根据您的需求部署代理实例。 有关更多信息,请参阅 启用代理协议

  2. 通过导航至 IBM Cloud 仪表板> VPC 基础结构> 网络> 安全组,打开 VPC 的安全组。 有关安全组的更多信息,请参阅 安全组

  3. 选择连接到代理的安全组,并添加以下端口号: 443,8443,80 和 3128。 确保要求您指定的 IP 地址是 Power Virtual Server 实例的专用网络的子网 CIDR。 要在 IBM Cloud 仪表板中查看子网 CIDR,请转至专区,单击 子网,确定正在使用的子网,然后复制 CIDR。

  4. 创建代理后,登录到代理实例并通过完成以下步骤找到子网 CIDR:

    a. 打开命令行界面 (CLI) 并运行 ssh root@<public IP of proxy> 命令。

    b. 运行 route -n 命令以标识子网。 代理实例的子网列示在命令输出中的专用网关之后。 示例子网为: 10.240.65.0,10.209.155.192。

    c. 要获取 CIDR,请运行 ip route 命令。 示例 CIDR 为: 10.240.65.0/24,10.209.155.192/26。

    d. 请根据需要记录 CIDR 编号,如 步骤 3 中所述,以建立从 VM 到代理的连接。

步骤 3: 创建和配置 Power 虚拟机 (PVM)

  1. 使用具有以下需求的 Power Virtual 实例 GUI,CLI 或 API 来创建 Power Virtual Server 实例 (也称为 PVM 实例)。

    a. SSH 密钥

    b. 公用网络

    c. 在 步骤 1 中创建的专用网络

  2. 在代理实例 CLI 中,通过在以下命令中使用 PVM 的外部 IP 地址来启动与 RHEL 或 SLES PVM 实例的 SSH 连接:

    ssh root@<external IP address>

    示例 :ssh root@1.2.3.4

    确保在供应虚拟服务器实例时使用专用子网中的缺省网关。

  3. 将网络路由从 PVM 实例添加到您在 步骤 2 中配置的代理实例。

    确保在 VM 供应期间使用的专用网络设置为缺省网关,而不是公共子网。

    • 运行 ip route 命令并通过 PVM 的专用网关添加代理的 CIDR 子网。

      • 代理的 CIDR 子网是执行 步骤 2 后获取的值。
      • 您可以在 PVM 的服务器详细信息中查看 PVM 的专用网关。

      示例: 运行 ip route 命令并通过专用网关 IP 地址 5.9.7.1添加 CIDR 子网 IP 地址 1.5.3.9/24。

    如果重新启动 VM,那么将除去这些 IP 路由,并且必须再次添加这些 IP 路由。

步骤 4: 配置代理实例

通过完成以下步骤来设置代理配置:

  1. 通过运行 ssh root@<public IP of proxy> 命令登录到代理实例。

  2. 请确保在代理实例中创建了另一个 IP 路由。 此 IP 路由允许您为 VM 创建的专用 IP 网关范围内的 IP 地址。 IP 地址用于将 VM 连接到代理网关。

    • 运行 ip route 命令,并通过代理网关添加在步骤 1 中派生的专用网络的 CIDR 号。

      • 您可以在 IBM Cloud Web 站点中查看专用 VM 网关。 选择在 步骤 3 中创建的 PowerVS VM,然后转至连接的专用网络。 CIDR 编号列示为最后一个变量。
      • 运行 route -n 命令以查看代理的网关。
  3. 现在已与代理和 PVM 建立连接。 您可以在代理实例和 PVM 实例中对连接执行 ping 操作,如下所示:

    • 在代理实例中,可以使用 ping <private IP of powervs vm> 命令对 PVM 的专用 IP 执行 ping 操作。
    • 在 PVM 实例中,可以使用 ping <private IP of proxy> 命令对代理的专用 IP 执行 ping 操作。
  4. 必须在 VM 上安装 squid (代理高速缓存服务器)。

  5. 通过完成以下步骤来设置鱿鱼:

    a. 运行以下命令安装 squid 基础:

    • sudo yum update -y
    • sudo yum install epel-release
    • sudo yum install squid

    您必须拥有 root 权限才能运行这些命令。 安装完成后,squid 配置文件存储在 /etc/squid/squid.conf 位置。

    b. 使用以下示例中提供的配置以供您参考。 示例配置中表示的值表示以下内容:

    • Acl localnet src 192.168.0.0/16: 代理接受的 IBM 专用网络的 IP 范围。
    • Acl ibmprivate dst 161.26.0.0/16 和 Acl ibmprivate dst 166.8.0.0/14: 此代理将转至 RHEL 卫星服务器和 SLES RMT 服务器的此位置的 IBM 网络的 IP 范围。
    • Acl SSL_ports port 443 8443: 用于与 RHEL 卫星服务器和 SLES RMT 服务器通信的端口。
    • http_port 3128: 侦听 squid 的端口。 这用作从 Power Virtual Server VM 到 squid 代理的通信端口。
    # Recommended minimum configuration:
    #
    
    # Example rule allowing access from your local networks.
    # Adapt to list your (internal) IP networks from where browsing
    # should be allowed
    acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
    acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
    acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
    acl localnet src fc00::/7       # RFC 4193 local private network range
    acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
    acl localnet src all
    acl ibmprivate dst 161.26.0.0/16
    acl ibmprivate dst 166.8.0.0/14
    acl FTP_ports port 21 20 1025-65535
    acl SSL_ports port 443 8443
    acl Safe_ports port 80          # http
    acl Safe_ports port 21          # ftp
    acl Safe_ports port 443         # https
    acl Safe_ports port 22
    acl Safe_ports port 8443
    acl Safe_ports port 70          # gopher
    acl Safe_ports port 210         # wais
    acl Safe_ports port 1025-65535  # unregistered ports
    acl Safe_ports port 280         # http-mgmt
    acl Safe_ports port 488         # gss-http
    acl Safe_ports port 591         # filemaker
    acl Safe_ports port 777         # multiling http
    acl CONNECT method CONNECT
    
    #
    # Recommended minimum Access Permission configuration:
    #
    # Deny requests to certain unsafe ports
    http_access deny !Safe_ports
    
    # Deny CONNECT to other than secure SSL ports
    http_access deny CONNECT !SSL_ports
    
    # Only allow cachemgr access from localhost
    http_access allow localhost manager
    http_access deny manager
    
    # We strongly recommend the following be uncommented to protect innocent
    # web applications running on the proxy server who think the only
    # one who can access services on "localhost" is a local user
    #http_access deny to_localhost
    
    # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
    ## Example rule allowing access from your local networks.
    
    # Adapt localnet in the ACL section to list your (internal) IP networks
    # from where browsing should be allowed
    http_access allow localnet
    http_access allow localhost
    
    # And finally deny all other access to this proxy
    # http_access deny all
    
    # Squid normally listens to port 3128
    #http_port 10.220.54.36:3128
    http_port 3128
    
    # Uncomment and adjust the following to add a disk cache directory.
    #cache_dir ufs /var/spool/squid 100 16 256
    
    # Leave coredumps in the first cache dir
    coredump_dir /var/spool/squid
    
    #
    # Add any of your own refresh_pattern entries above these.
    #
    refresh_pattern ^ftp:           1440    20%     10080
    refresh_pattern ^gopher:        1440    0%      1440
    refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
    refresh_pattern .                 0     20%     4320
    

    c. 保存 squid 配置文件并使用 sudo systemctl start squid 命令启动 squid。

    d. 您可以使用 sudo systemctl stop squid 命令来停止 squid。

    e. 您可以使用 sudo systemctl restart squid 命令来重新启动 squid。

步骤 5: 使用 cloud-init 脚本 (RHEL 和 SLES) 来定制 VM

您可以通过运行 cloud-init 脚本来定制 RHEL 和 SLES VM。

  1. 使用 ssh root@<External IP”> 命令登录到 RHEL 或 SLES VM。

  2. 将在 /usr/share/powervs-fls/powervs-fls-readme.md 位置生成自述文件。 有关运行 cloud-init 脚本所需的变量的相关信息,请参阅自述文件。

  3. 运行位于 /usr/local/bin/ 位置的 cloud-init 脚本。 _以根_用户身份运行脚本。 您可以使用 sudo su root 命令将用户切换到 root

    a. 对于 RHEL,请运行以下命令:

    . /usr/local/bin/rhel-cloud-init.sh -a Activation_Key -u Capsule_server_url -p Proxy_IP_and_port -o Org -t Deployment type

    有关 cloud-init 脚本选项和值的信息,请参阅步骤 2 (/usr/share/powervs-fls/powervs-fls-readme.md 位置) 中生成的自述文件。

    -a = 激活密钥

    • -u = 您要注册的 RHEL 胶囊服务器的 URL

    -p =“private_ip_of_powervs_vm”:3128

    -o = 与激活密钥关联的组织

    -t = 此虚拟机的部署类型(RHEL、RHEL-SAP, RHEL-SAP-织网)

    b. 对于 SLES,请运行以下命令:

    . /usr/local/bin/sles-cloud-init.sh -s RMT_Server_address -p private_ip_of_proxy_vm:3128

    • -s = 用于注册的 SLES 资源库镜像工具 (RMT) 服务器的 URL

    -p =“private_ip_of_powervs_vm”:3128

    如果系统已注册,那么需要先通过运行以下两个命令来注销系统,然后再重新注册: SUSEConnect --de-register

    SUSEConnect –cleanup

    如果注册失败,并且日志中显示以下注释:

    Could not register with SLES RMT servers, Please verify connection to the proxy server. If proxy is verified, it may be an issue with SLES RMT servers undergoing maintenance. If so, please try executing the command again within a few minutes

    然后,这可能是网络问题,您应该稍后再次尝试注册。

传递用户定义的脚本

在供应 Power Virtual Server 实例时选择完整 Linux 预订 (FLS) 引导映像时,您将获得在首次引导运行时传入用户数据的选项。

在用户数据中,可以传递允许您定制特定实例的启动配置的定制内容。

您传递的用户数据应遵循以下条件:

  • 它应该是未压缩的。
  • 开头应为 #cloud-config
  • 其大小不应超过 63 Kb。