全文 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 为 和非 应用程序提供 RHEL 和 SLES 库存操作系统镜像。SAPSAP 要了解有关受支持的 SLES 版本的更多信息,请参阅 支持哪些版本的 AIX、IBM i 和 Linux?。
Linux 订阅功能操作系统文件全名以 Red Hat 或 SUSE 发行版名称 RHEL...
或 SLES...
开头。
如果打算使用自己的许可证,请选择后缀为 -BYOL
的操作系统映像。 在虚拟机供应页面上,这些映像列在客户提供的订阅部分下。
设置完整的 Linux 订阅
要为您的账户设置完整的 Linux 订阅,请完成以下步骤:
-
a. RHEL
b. SLES
步骤 1:配置云连接
确保在创建云连接时满足以下要求:使用以下参数创建云连接:
- 确保使用专用网络在 IBM® Power® Virtual Server 实例和 IBM Cloud classic 基础设施之间建立云连接。
- 每个地区和区域的 Power Virtual Server 必须有自己的云连接。
- 您可以获得该专用网络的详细信息,以便进一步配置。
有关创建云连接的更多信息,请参阅 管理云连接。
步骤 2:创建代理
完成以下步骤创建代理设置。 该代理设置在虚拟私有云 (VPC) 环境中。
-
根据要求部署代理实例。 更多信息,请参阅 启用代理协议。
-
通过导航至 IBM Cloud 面板 > VPC 基础架构 > 网络 > 安全组,打开 VPC 的安全组。 有关安全组的更多信息,请参阅 安全组。
-
选择附加到代理的安全组,然后添加这些端口号:443、8443、80 和 3128。 确保要求您指定的 IP 地址是 Power Virtual Server 实例专用网络的子网 CIDR。 要在 IBM Cloud 控制面板中查看子网 CIDR,请转到区域,单击子网,确定正在使用的子网,然后复制 CIDR。
-
创建代理后,登录代理实例并通过完成以下步骤找到子网 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 所述,以建立虚拟机到代理的连接。
步骤 3:创建和配置 Power 虚拟机 (PVM)
-
使用 Power Virtual instance GUI、CLI 或 API 创建 Power Virtual Server 实例(也称为 PVM 实例),并满足以下要求。
a. SSH 密钥
b. 公用网络
c. 您在 步骤 1 中创建的专用网络
-
在代理实例 CLI 中,在以下命令中使用 PVM 的外部 IP 地址,启动与 RHEL 或 SLES PVM 实例的 SSH 连接:
ssh root@<external IP address>
示例:ssh root@1.2.3.4
在配置虚拟服务器实例时,确保在专用子网中使用默认网关。
-
从 PVM 实例向 步骤 2 中配置的代理实例添加网络路由。
确保将虚拟机配置过程中使用的专用网络设置为默认网关,而不是公共子网。
-
运行
ip route
命令,通过 PVM 的专用网关添加代理的 CIDR 子网。- 代理的 CIDR 子网就是执行 步骤 2 后得到的值。
- 您可以在 PVM 的服务器详细信息中查看 PVM 的专用网关。
示例运行
ip route
命令,通过专用网关 IP 地址 5.9.7.1 添加 CIDR 子网 IP 地址 1.5.3.9/24。
如果重新启动虚拟机,这些 IP 路由将被移除,必须重新添加 IP 路由。
-
步骤 4:配置代理实例
完成以下步骤设置代理配置:
-
运行
ssh root@<public IP of proxy>
命令登录代理实例。 -
确保在代理实例中创建了另一条 IP 路由。 此 IP 路由允许您为虚拟机创建的私有 IP 网关范围内的 IP 地址。 IP 地址用于将虚拟机连接到代理网关。
-
代理与 PVM 的连接现已建立。 您可以同时在代理实例和 PVM 实例中 ping 连接,如下所示:
- 在代理实例中,可以使用
ping <private IP of powervs vm>
命令 ping PVM 的私有 IP。 - 在 PVM 实例中,可以使用
ping <private IP of proxy>
命令 ping 代理的私有 IP。
- 在代理实例中,可以使用
-
虚拟机上必须安装 squid(代理缓存服务器)。
-
完成以下步骤设置 squid:
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 端口 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:使用云启动脚本定制虚拟机(RHEL 和 SLES)
您可以通过运行 cloud-init 脚本自定义 RHEL 和 SLES 虚拟机。
-
使用
ssh root@<External IP”>
命令登录 RHEL 或 SLES 虚拟机。 -
在
/usr/share/powervs-fls/powervs-fls-readme.md
位置生成自述文件。 有关运行云启动脚本所需的变量的相关信息,请参阅自述文件。 -
运行位于
/usr/local/bin/
位置的 cloud-init 脚本。 _以根_用户身份运行脚本。 您可以使用sudo su 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
location)。-a = 激活密钥
-u = 您要注册的 RHEL 胶囊服务器的 URL
-p = "private_ip_of_powervs_vm":3128
-o = 与激活密钥相关联的组织
-t = 该虚拟机的部署类型(RHEL、RHEL-, RHEL- -NETWEAVER) SAPSAP
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 实例时选择 Full Linux Subscription (FLS) 启动映像时,您可以选择在首次启动运行时传递用户数据。
在用户数据中可以传递自定义内容,以便为特定实例自定义启动配置。
传递的用户数据应符合以下条件:
- 应该是未压缩的。
- 开头应为
#cloud-config
。 - 其大小不应超过 63 Kb。