vCenter Server Appliance 安装
简介
- vCenter Server Appliance 是基于 Linux 的预配置虚拟机,针对运行 vCenter Server 及关联服务进行了优化。
- vCenter Server Appliance 缩短了
vCenter Server及关联服务的部署时间,并提供了一种低成本方案用于替代基于 Windows 的 vCenter Server 安装。 - vCenter Server Appliance 软件包包含以下软件:
- Project Photon OS® 1.0
- Platform Services Controller 基础架构服务组
- vCenter Server 服务组
- PostgreSQL
- VMware vSphere Update Manager 扩展
- vCenter Server Appliance 版本 6.5 上部署了虚拟硬件版本 10,此虚拟硬件版本在 ESXi 中支持每个虚拟机具有 64 个虚拟 CPU。
- vCenter Server Appliance 使用 嵌入式 PostgreSQL 数据库,该数据库最多可扩展至 2,000 个主机和 35,000 个虚拟机。在部署期间,可以选择适合 vSphere 环境大小的 vCenter Server Appliance 大小以及满足数据库要求的存储大小。
- 从 vSphere 6.5 开始,vCenter Server 将使用 VMware vSphere Update Manager 扩展服务。
- vSphere 集中式自动修补程序和版本管理不再需要
Windows 上的外部 VMware Update Manager 实例。 - 有关 vCenter Server 和 Platform Services Controller 服务的信息,请参见vCenter Server 组件和服务。
- 从 vSphere 6.5 开始,vCenter Server Appliance 支持高可用性。有关在 vCenter High Availability 群集中配置 vCenter Server Appliance 的信息,请参见vSphere 可用性。
- 从 vSphere 6.5 开始,vCenter Server Appliance 和 Platform Services Controller 设备支持基于文件的备份和还原。
- 有关备份和还原的信息,请参见vCenter Server Appliance 的基于文件的备份和还原。
- 有关 vCenter Server Appliance 最高配置的信息,请参见《最高配置》文档。
vCenter Server 和 Platform Services Controller 部署类型
部署类型 | 描述 |
---|---|
具有嵌入式 Platform Services Controller 部署的 vCenter Server | 与 Platform Services Controller 捆绑在一起的所有服务与 vCenter Server 服务一起部署在同一虚拟机或物理服务器上。 |
Platform Services Controller | 只有与 Platform Services Controller 捆绑在一起的服务会部署在虚拟机或物理服务器上。 |
具有外部 Platform Services Controller 的 vCenter Server(需要外部 Platform Services Controller) |
只有 vCenter Server 服务会部署在虚拟机或物理服务器上。 必须向之前部署或安装的 Platform Services Controller 实例注册此类 vCenter Server 实例。 |
vCenter Server Appliance 安装程序的系统要求
- 可以从受支持版本的 Windows、Linux 或
Mac操作系统上运行的网络客户机运行 vCenter Server Appliance GUI 或 CLI 安装程序。 - 为确保 GUI 和 CLI 安装程序的最佳性能,请使用满足最低硬件要求的客户机。
操作系统 | 受支持的版本 | 确保最佳性能的最低硬件配置 |
---|---|---|
Windows | Windows 7、8、8.1、10 | 4 GB RAM、2 个 2.3 GHz 四核 CPU、32 GB 硬盘、1 个网卡 |
Windows 2012 x64 位 | ||
Windows 2012 R2 x64 位 | ||
Windows 2016 x64 位 | ||
Linux | SUSE 12 | 4 GB RAM、1 个 2.3 GHz 双核 CPU、16 GB 硬盘、1 个网卡 |
Ubuntu 14.04 |
- 注: CLI 安装程序要求 64 位操作系统
!vCenter Server Appliance 安装程序包含 GUI 和 CLI 部署的可执行文件,您可以交替地使用这些文件。
- GUI 部署过程分为两个阶段。
- 段是部署向导,该向导将在目标 ESXi 主机或 vCenter Server 实例上部署该设备的 OVA 文件。
- OVA 部署完成后,您应继续执行该过程的第二阶段,以设置并启动新部署设备的服务。
同步 vSphere 时钟
- 验证 vSphere 网络上所有组件的时钟是否均已同步。如果 vSphere 网络中的计算机上的时钟不同步,则可能无法在网络计算机之间的通信中将对时间敏感的 SSL 证书 识别为有效。
- 未同步的时钟可能会导致身份验证问题,从而使安装失败或使 vCenter Server Appliance vpxd 服务无法启动。
- 验证运行 vCenter Server 的任何 Windows 主机是否与网络时间协议 (Network Time Protocol, NTP) 服务器同步。请参见 知识库文章。
配置 ESXi 时钟同步
开启 NTPClient 端
1 2 3 4 5 6 7 8 |
# 使用具有管理特权的 用户 登陆到 SSH 服务端 # 要在内部 ESX 主机防火墙中打开 ntpClient 端口,请运行以下命令: esxcfg-firewall -q ntpClient # 查看 ntpClient 端口的状态 esxcfg-firewall -e ntpClien # 启用 ntpClient 端口 esxcfg-firewall -q ntpClien # 查看 ntpClient 端口的状态 |
配置 NTP 同步
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# 使用 -u 在防火墙之外和主机同步 ntpdate -u pool.ntp.org ntpdate -u cn.ntp.org.cn # 中国标准NTP ntpdate -u north-america.pool.ntp.org ntpdate -u 0.us.pool.ntp.org # 将 NTP 服务器指向本地域 AD 或者 OpenLDAP ntpdate -u ntp.yourdomain.com # 也可将 NTP 指向本机 ntpdate -u 127.0.0.1 |
!一些程序会对系统时间突然的巨大变化做出较差的反应。因此,仅按照以下所述(一些 ntpd 的首选)更新和重新启动 ntpd 将会使系统时钟更新缓慢。
将 ESX 主机配置为 ntp 客户端。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# 使用以下命令创建 /etc/ntp.conf 的备份副本: cp /etc/ntp.conf /etc/ntp.conf.bak.`date +%d%m%y` # 编辑 /etc/ntp.conf 配置文件 vim /etc/ntp/conf # 编辑 NTP 配置文件 restrict default kod nomodify notrap nopeer noquery restrict 127.0.0.1 # 本地时间源 server 192.168.1.25 # Windows AD 作为时间源 driftfile /etc/ntp.drift tos maxdist 30 # 可忽略 server north-america.pool.ntp.org # 外部时间源 server pool.ntp.org # 外部时间源 server cn.ntp.org.cn # 中国标准NTP fudge 127.127.1.0 stratum 10 # driftfile /var/lib/ntp/drift broadcastdelay 0.008 server 127.127.1.0 iburst prefer # 设置NTP服务器使用 127.127.1.0 主板BIOS上的时钟为时间源 # 如果公司防火墙已阻止对 Internet 的 ntp 访问 # 则在假定拥有单独具有 Internet ntp 访问权限的内部 ntp 服务器的情况下 # ntp.conf 文件应包含以下类似内容: restrict 127.0.0.1 server ntp.yourdomain.com server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 driftfile /var/lib/ntp/drift broadcastdelay 0.008 # 编辑 # 使用以下命令重新启动 ntpd 服务: service ntpd restart /etc/init.d/ntpd restart systemctl restart ntpd # 使用系统时钟的当前时间更新硬件时钟。 /sbin/hwclock --systohc |
部署 vCSA 和 PSC
- vCSA 是 vCenter Server Appliance 的缩写;PSC 是 Platform Services Controller 的缩写
- 可以使用 GUI 安装程序以交互方式部署具有嵌入式 Platform Services Controller 部署的 vCenter Server Appliance。必须从位于要部署设备的网络中的 Windows、Linux 或 Mac 计算机执行 GUI 部署。
- 也可以使用 CLI 安装程序以静默方式在 ESXi 主机或 vCenter Server 实例上部署 vCenter Server Appliance 或 Platform Services Controller 设备
! 对于具有外部 Platform Services Controller 实例的拓扑,必须按顺序部署复制的 Platform Services Controller 实例。成功部署域中的所有 Platform Services Controller 实例后,您可以针对指向共同的外部 Platform Services Controller 实例的多个 vCenter Server Appliance 执行并行部署。
将 OVA 文件部署为具有嵌入式 PSC 部署的 vCSA
- 在部署过程的第 1 阶段,您应将包含在 vCenter Server Appliance 安装程序中的 OVF 文件部署为具有嵌入式 Platform Services Controller 部署的 vCenter Server Appliance
为 CLI 部署准备 JSON 配置文件
- 运行 CLI 安装程序部署 vCenter Server Appliance 或 Platform Services Controller 设备之前,必须提供包含部署规范的配置参数及其值的 JSON 文件。
- vCenter Server Appliance 安装映像,包含所有部署类型的 JSON 模板
vCenter Server Appliance 和 Platform Services Controller 设备的 CLI 部署的 JSON 模板
- vCenter Server Appliance 安装程序包含 JSON 模板,这些模板位于 vcsa-cli-installer/templates 目录中。
- 在 install 子文件夹中,可以找到八个 JSON 模板,这些模板包含所有部署类型的最少配置参数。
vCenter Server Appliance 安装程序中包含的部署 JSON 模板
位置 | 模板名称 | 描述 |
---|---|---|
vcsa-cli-installer/templates/install | embedded_vCSA_on_ESXi.json | 在 ESXi 主机上部署嵌入式 Platform Services Controller 的和 vCenter Server Appliance |
embedded_vCSA_on_VC.json | 在 vCenter Server 实例上部署嵌入式 Platform Services Controller 的和 vCenter Server Appliance | |
embedded_vCSA_replication_on_ESXi.json | 在 ESXi 主机上部署具有嵌入式的 Platform Services Controller 作为另一个嵌入式 vCenter Server Appliance 复制合作伙伴的 vCenter Server Appliance |
|
embedded_vCSA_replication_on_VC.json | 在 vCenter Server 实例上部署具有嵌入式的 Platform Services Controller 作为另一个嵌入式 vCenter Server Appliance 复制合作伙伴的 vCenter Server Appliance |
|
PSC_first_instance_on_ESXi.json | 在 ESXi 主机上将 Platform Services Controller 设备部署为新的 vCenter Single Sign-On 域中的第一个实例 |
|
PSC_first_instance_on_VC.json | 在 vCenter Server 实例上将 Platform Services Controller 设备部署为新的 vCenter Single Sign-On 域中的第一个实例 |
|
PSC_replication_on_ESXi.json | 在 ESXi 主机上部署将加入现有 vCenter Single Sign-On 域的 Platform Services Controller 设备所需的最少配置参数 | |
PSC_replication_on_VC.json | 在 vCenter Server 实例上部署将加入现有 vCenter Single Sign-On 域的 Platform Services Controller 设备所需的最少配置参数。 | |
vCSA_on_ESXi.json | 在 ESXi 主机上部署具有外部 Platform Services Controller 的 vCenter Server Appliance | |
vCSA_on_VC.json | 在 vCenter Server 实例上部署具有外部 Platform Services Controller 的 vCenter Server Appliance |
JSON 部署配置参数
- 为 CLI 部署准备 JSON 配置文件时,必须设置参数和值,提供部署,下面仅对本次用户的参数做说明,具体详细配置参数,请参见 部署配置参数
配置域 | 配置参数 | 可接受的参数值 | 说明 |
---|---|---|---|
esxi | 连接配置 | ||
hostname | IP/FQDN | 用户登入 ESXi 主机的IP地址或者FQDN | |
username | root | 用于登入 ESXi 主机的用户名,此用户必须具有 root 权限 | |
password | 密码 | 用于登入 ESXi 主机的 root 用户密码 | |
deployment_network | ESXi 网络端口组 | 用于将 vCSA 设备部署在目标 ESXi 主机上的网络端口组中 | |
datastore | ESXi 主机的存储 | 用户将 vCSA 设备部署在目标 ESXi 主机上指定的存储设备中 | |
appliance | 配置 vCSA 设备 | ||
thin_disk_mode | true | false | 精简模式 : 指定是否将 vCSA 设备部署成磁盘精简模式 | |
deployment_option | tiny | small | medium | large | 部署大小:tiny small medium large,分别为 微、小、中、大 | |
name | vCSA 设备名称 | 用于为 vCenter Server Appliance 设备命名 | |
network | 配置 vCSA 网络 | ||
ip_family | IPv4 | IPv6 | 指为 vCSA 配置的IP地址类型,可以是IPv4或者IPv6 | |
mode | static | dhcp | 指为 vCSA 配置的IP地址模式,可以静态地址,或者动态DHCP | |
ip | IP Address | 指为 vCSA 配置的静态IP地址 | |
dns_servers | IP Address | 指为 vCSA 配置的 DNS 服务器地址 | |
prefix | 255.255.255.0 | 24 | 32 | 128 | 指为 vCSA 配置的 子网掩码 | |
gateway | IP Address | 指为 vCSA 配置的 网关地址 | |
system_name | System Name | FQDN | 指为 vCSA 配置的主机名称,在没有DNS服务器时可以使用IP地址,否则建议使用 FQDN | |
os | 设置 vCSA 用户名和密码 | ||
password | 密码 | 指为 vCSA root 用户设定登入密码 | |
ntp_servers | IP Address | FQDN | 指为 vCSA 设置 NTP 时钟同步 | |
ssh_enable | true | false | 指为 vCSA 配置是否启用 SSH 登入,建议在生产环境中禁用 SSH 登入,需要登入SSH才零时开启 | |
sso | vCSA 的配置单点登入域 | ||
password | 密码 | 配置 vCenter 的单点登入域 Single sign-on domain | |
domain_name | Domain | 配置 vCenter 的单点登入域 ,需要说明的是用一个网络中,不能存有相同的 域名名称 | |
ceip | 客户体检计划 | ||
ceip_enable | true | false | 是否启用 VMware 的客户体验计划 |
实例部署
DNS 服务器配置
Unbound DNS 服务器配置
- 本次部署采用全 Linux 平台,因此 DNS 服务器使用了 Linux 上一个微型的 DNS 软件 Unbound
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
yum install unbound # 安装 unbound # 直用 sed 配置 unbound 的配置文件 # 指定监听的接口地址 sed -i '42a\ interface: 127.0.0.1' /etc/unbound/unbound.conf sed -i '43a\ interface: 172.16.18.250' /etc/unbound/unbound.conf # 指定监听的 端口 条目 sed -i -e '/^[ \t]# port: 53/a\ \tport: 53' /etc/unbound/unbound.conf # 指定允许访问此 DNS 的子网 sed -i -e '186a\ access-control: 0.0.0.0/0 allow' /etc/unbound/unbound.conf # 指定运行此 unbound 服务的用户,清空账户,使用系统默认的账户 sed -i -e '/^[ \t]username: "unbound"/s#.*$# \tusername: ""#' /etc/unbound/unbound.conf |
验证 ‘unbound.conf‘ 配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 使用 sed 配置的文件应该与如下所示相同 server: verbosity: 1 interface: 127.0.0.1 interface: 172.16.18.250 port: 53 access-control: 0.0.0.0/0 allow chroot: "" username: "" directory: "/etc/unbound" pidfile: "/var/run/unbound/unbound.pid" trusted-keys-file: /etc/unbound/keys.d/*.key auto-trust-anchor-file: "/var/lib/unbound/root.key" include: /etc/unbound/local.d/*.conf ipsecmod-hook: "/usr/libexec/ipsec/_unbound-hook" python: remote-control: control-enable: yes server-key-file: "/etc/unbound/unbound_server.key" server-cert-file: "/etc/unbound/unbound_server.pem" control-key-file: "/etc/unbound/unbound_control.key" control-cert-file: "/etc/unbound/unbound_control.pem" include: /etc/unbound/conf.d/*.conf |
创建自定义的解析文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 'block-em.com.conf' 创建自定义解析文件 cat > /etc/unbound/local.d/block-em.com.conf <<EOF # 本地域配置如下 /etc/unbound/local.d/block-em.com.conf # entries in this file override toe global DNS # # Example blocking email going out to example.com # # local-data: "example.com. 3600 IN MX 5 127.0.0.1" # local-data: "example.com. 3600 IN A 127.0.0.1" local-zone: "em.local." static local-data: "em.local. MX 5 mail.local.com." local-data: "em.local. NS dns.local.com." local-data: "em.local. IN SOA dns.em.local roo.em.local. 1000 1000 500 4000 86400" local-data: "em.local. A 172.16.18.250" local-data: "ESXi-01. A 172.16.18.11" local-data: "ESXi-02. A 172.16.18.12" local-data: "ESXi-03. A 172.16.18.13" local-data: "ESXi-04. A 172.16.18.14" local-data: "vCSA. A 172.16.18.20" local-data: "ESXi-01.em.local. A 172.16.18.11" local-data: "ESXi-02.em.local. A 172.16.18.12" local-data: "ESXi-03.em.local. A 172.16.18.13" local-data: "ESXi-04.em.local. A 172.16.18.14" local-data: "vCSA.em.local. A 172.16.18.20" EOF |
启动 unbound 服务,以及 开放防火墙
1 2 3 4 5 6 7 8 |
unbound-checkconf # 检测 unbound 配置是否出错 systemctl enable unbound && systemctl restart unbound # 将 unbound 服务做开启启动,并启动服务 firewall-cmd --add-service=dns && firewall-cmd --add-service=dns --permanent # 开放 DNS 服务 firewall-cmd --add-port=53/{tcp,udp} && firewall-cmd --permanent --add-port=53/{tcp,udp} # 开放 53 的{tcp,udp}端口协议 |
部署具有嵌入式的 vCenter Server Appliance 和 Platform Services Controller
embedded_vCSA_on_ESXi.json 模板,在ESXi主机上部署具有嵌入式的 PSC 和 vCSA
1 2 3 4 5 6 7 |
# 挂载 VMware-VCSA 映像 mount /dev/sr0 /mnt/ # 将模板文件复制到当前用户的家目录下 cp /mnt/vcsa-cli-installer/templates/install/embedded_vCSA_on_ESXi.json ~ |
编辑 vCenter Server Appliance(vCSA) 的部署模板文件,
- 具体详细配置参数,请参见 部署配置参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 备注此模板为 js 格式的 JSON 文件,符号 (__comments 代表注释) cat > ~/embedded_vCSA_on_ESXi.json <<EOF { "__version": "2.13.0", "__comments": "Sample template to deploy a vCenter Server Appliance with an embedded Platform Services Controller on an ESXi host.", "new_vcsa": { "esxi": { "hostname": "ESXi-01.em.local", "__comments01": "# 指定将 vCSA 部署在目标 ESXi 主机的 FQDN 或者 IP地址", "username": "root", "__comments02": "# 指定目标 ESXi 主机的用户", "password": "VMware1!", "__comments03": "# 指定目标 ESXi 主机的密码", "deployment_network": "VM Network", "__comments04": "# 指定将 vCSA 部署在目标 ESXi 主机上的网络交换机,默认: VM Network", "datastore": "datastore1" }, "__comments05": "# 指定将 vCSA 部署在目标 ESXi 主机存储上,默认为:datastore1", "appliance": { "thin_disk_mode": true, "__comments06": "# 指定在部署 vCSA 时是否使用磁盘精简模式", "deployment_option": "Medium", "__comments07": "# 指定部署 vCSA 所使用的预定义配置硬件级别", "name": "vCSA" }, "__comments08": "# 指定 vCSA 的主机名称", "network": { "ip_family": "ipv4", "__comments09": "# 指定 vCSA 所使用的IP地址家族", "mode": "static", "__comments10": "# 指定 vCSA 静态地址", "ip": "172.16.18.20", "__comments11": "# 指定 vCSA 的IP地址", "dns_servers": [ "172.16.18.250" ], "__comments12": "# 指定 vCSA 的DNS", "prefix": "24", "__comments13": "# 指定 vCSA 的子网掩码地址", "gateway": "172.16.18.254", "__comments14": "# 指定 vCSA 的网关地址", "system_name": "vCSA.em.local" }, "__comments15": "# 指定 vCSA 的 FQDN", "os": { "password": "Admin@123", "__comments16": "# 指定 vCSA 主机的密码", "ntp_servers": "time.nist.gov", "__comments17": "# 指定 vCSA 的NTP服务器地址", "ssh_enable": true }, "__comments18": "# 指定是否启用 vCSA 的SSH服务", "sso": { "password": "Admin@123", "__comments19": "# 单点登入域(Single Sign On)的密码", "domain_name": "vsphere.local" } }, "__comments20": "# 单点登入域(Single Sign On)域名", "ceip": { "description": { }, "settings": { "ceip_enabled": false } } } EOF |
开始使用配置好的模板文件安装
1 2 3 4 5 6 7 8 9 10 11 12 |
# 开始安装 vCenter Server Appliance /mnt/vcsa-cli-installer/lin64/vcsa-deploy install -v --accept-eula --no-ssl-certificate-verification ./embedded_vCSA_on_ESXi.json # 配置参数解析说明 # install 安装 # -v 安装时显示详细的安装过程 # --accept-eula 安装时接受最终用户许可协议 # --no-ssl-certificate-verification 跳过 ESXi 连接的 SSL 验证 # 有关 CLI 部署命令的语法 请参阅 # https://docs.vmware.com/cn/VMware-vSphere/6.7/com.vmware.vcenter.install.doc/GUID-15F4F48B-44D9-4E3C-B9CF-5FFC71515F71.html |