为VMware vSphere创建Ubuntu 18.04 Terraform模板
为VMware vSphere创建Ubuntu 18.04 Terraform模板
Terraform是HashiCorp创建的自动化工具。它专注于以自动方式部署云基础架构。它支持许多云提供商,例如AWS,DigitalOcean,Google Cloud Platform,OpenStack,VMware vSphere等。Terraform是用GoLang开发的,这使得安装真正易于执行,并支持许多操作系统。
在本实验中,我们将看到如何为VMware vSphere创建Ubuntu 18.04 Terraform模板。
创建一个VMware vSphere虚拟机
1-创建一个新的虚拟机。
2-为您的虚拟机模板选择一个名称。
3-为虚拟机选择一个临时计算资源。
4-选择虚拟机的数据存储。
5-选择虚拟机的vSphere兼容性。
6-选择“ Ubuntu Linux(64位)”作为虚拟机的来宾OS。
7-将SCSI控制器的类型更改为“ VMware Paravirtual”。
8-为虚拟机选择一个临时网络。
9-将Ubuntu 18.04 ISO添加到虚拟机的CD / DVD驱动器。
10-在启动时连接CD / DVD驱动器。
11-完成虚拟机的硬件定制。
12-验证虚拟机的创建。
13-启动虚拟机。
14-启动vSphere Web控制台。
安装Ubuntu 18.04
1-选择Ubuntu安装程序的语言。
2-选择Ubuntu安装的键盘布局。
3-开始Ubuntu安装。
4-使用临时配置配置虚拟机的网卡。
5-配置代理(如果使用的话)。
6-选择磁盘的分区布局。
7-选择安装盘。
8-为虚拟机配置用户。
9-重新启动虚拟机。
10- SSH到新的Ubuntu虚拟机。
$ ssh sguyennet@10.10.40.253
11-升级Ubuntu软件包。
$ sudo apt-get update
$ sudo apt-get upgrade
安装VMware工具
1-在笔记本电脑上下载VMware工具(如果您还没有帐户,则必须创建一个帐户)。
2-解压缩档案。
$ tar xvzf VMware-Tools-core-10.3.5-10430147.tar.gz
3-将VMware工具ISO复制到模板虚拟机。
$ scp vmtools/linux.iso sguyennet@10.10.40.253:/tmp
4- SSH到模板虚拟机。
$ ssh sguyennet@10.10.40.253
5-安装VMware工具ISO。
$ sudo mount -o loop /tmp/linux.iso /mnt
6-解压缩VMware Tools安装程序。
$ tar xvzf /mnt/VMwareTools-10.3.5-10430147.tar.gz -C /tmp
7-卸载VMware工具ISO。
$ sudo umount /mnt
8-删除open-vm-tools软件包。
$ sudo apt-get remove --purge open-vm-tools
9-安装VMware工具(默认情况下保留所有选项)。
$ cd /tmp/vmware-tools-distrib
$ sudo ./vmware-install.pl
10-重新启动机器。
$ sudo reboot
清理虚拟机配置
1-删除临时网络配置。
$ sudo rm /etc/netplan/50-cloud-init.yaml
2-阻止云配置保留主机名。
$ sudo vim /etc/cloud/cloud.cfg
...
preserve_hostname: true
...
3-关闭Ubuntu虚拟机。
$ sudo shutdown now
4-编辑虚拟机的设置。
5-将网卡设置回“ VM Network”。
6-将CD / DVD驱动器重新设置为“客户端设备”。
7-验证修改。
创建VMware vSphere模板
1-将虚拟机转换为vSphere模板。
https://blog.inkubate.io/ghosthttps:/start.fedoraproject.org/
测试VMware vSphere模板
安装Terraform
这是有关如何在Linux桌面上安装Terraform的示例。Terraform也可用于Mac OSX和Windows。
1-下载Terraform。
$ wget https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip
2-解压缩档案。
$ unzip -e terraform_0.11.14_linux_amd64.zip
3-将二进制文件复制到您的路径中。
$ sudo cp terraform /usr/bin
根据模板启动新的虚拟机
1-克隆Terraform脚本存储库。
$ git clone https://github.com/sguyennet/terraform-vsphere-standalone.git
2-初始化Terraform。
$ cd terraform-vsphere-standalone
$ terraform init
3-配置部署(进行相应修改)。
$ vim terraform.tfvars
#===============================================================================
# VMware vSphere configuration
#===============================================================================
# vCenter IP or FQDN #
vsphere_vcenter = "vcsa.inkubate.io"
# vSphere username used to deploy the infrastructure #
vsphere_user = "administrator@vsphere.local"
# Skip the verification of the vCenter SSL certificate (true/false) #
vsphere_unverified_ssl = "true"
# vSphere datacenter name where the infrastructure will be deployed #
vsphere_datacenter = "inkubate-lab"
# vSphere cluster name where the infrastructure will be deployed #
vsphere_cluster = "Compute-01"
#=============================================================================== # Virtual machine parameters #=============================================================================== # The name of the virtual machine # vm_name = "ubuntu-standalone" # The datastore name used to store the files of the virtual machine # vm_datastore = "Datastore-02" # The vSphere network name used by the virtual machine # vm_network = "pg-inkubate-production-static" # The netmask used to configure the network card of the virtual machine (example: 24) # vm_netmask = "24" # The network gateway used by the virtual machine # vm_gateway = "10.10.40.1" # The DNS server used by the virtual machine # vm_dns = "10.10.40.1" # The domain name used by the virtual machine # vm_domain = "inkubate.io" # The vSphere template the virtual machine is based on # vm_template = "ubuntu-18.04-terraform-template" # Use linked clone (true/false) vm_linked_clone = "false" # The number of vCPU allocated to the virtual machine # vm_cpu = "1" # The amount of RAM allocated to the virtual machine # vm_ram = "1024" # The IP address of the virtual machine # vm_ip = "10.10.40.254"
4-部署虚拟机。
$ terraform apply
5-测试访问虚拟机。
$ ssh sguyennet@10.10.40.254
6-销毁虚拟机。
$ terraform destroy
恭喜你!现在,您可以使用此Ubuntu 18.04模板通过Terraform部署vSphere虚拟机。
转自:https://blog.inkubate.io/create-a-ubuntu-18-04-terraform-template-for-vmware-vsphere/
为VMware vSphere创建Ubuntu 18.04 Terraform模板相关推荐
- 为VMware vSphere创建Ubuntu 16.04 Terraform模板
为VMware vSphere创建Ubuntu 16.04 Terraform模板 Terraform是HashiCorp创建的自动化工具.它专注于以自动方式部署云基础架构.它支持许多云提供商,例如A ...
- VMWare 15中Ubuntu 18.04安装VMWare Tools
VMWare 15中Ubuntu 18.04安装VMWare Tools 这篇文章写给以后的自己看,因为怕以后忘了. 1.先点击"虚拟机"之后点击"安装VMWare To ...
- 【Defects4J一气呵成】在VMWare上新建Ubuntu 18.04 虚拟机,并安装JDK 8,复现Defects4J最新版本(818个bug,version 2.0.0)
文章目录 前言 1.1 创建Ubuntu虚拟机 1.1.1下载VMWare 1.1.2 下载Ubuntu系统镜像 1.1.3 新建虚拟机 1.1.4 更换apt源 1.1.5 [可选]使用xshell ...
- VMware 15Pro安装ubuntu 18.04
首先需要下载安装VMware Workstation Pro 15Pro 虚拟机. 然后下载ubuntu18.04镜像.下载地址为: 官方下载地址(由于官方地址现在更新为20.04版本,不推荐在官方地 ...
- Win 10 + VMware Workstation Pro15 + Ubuntu 18.04 虚拟机安装教程
一 .官网下载VMware Workstation Pro 15安装包和ubuntu iso映像文件 1 VMware Workstation Pro 15安装 (1)网址:https://ww ...
- MIT Mini Cheetah Ubuntu 18.04 环境配置
VMware 16 : Ubuntu 18.04 LTS : qt5.10.0: 链接:https://pan.baidu.com/s/1fpUK77fc_sDT1qdNiuqEZA 提取码:vr5 ...
- VMware安装Ubuntu 18.04虚拟机(镜像下载、硬盘分区、创建虚拟机、安装系统、桥接模式网络配置)
1. VMware安装 安装VMware,Player免费,而且功能足够个人开发使用.(Pro的主要区别在于可以同时运行多个虚拟机,而Player只能同时运行一个) VMware Workstatio ...
- VMware Pro 14 安装 Ubuntu 18.04 详细教程
目录 ● 安装步骤 1.下载安装 VMware Workstation Pro 14 2.下载 Ubuntu 18.04 系统 3.在 VMware 中创建虚拟机 4.在虚拟机上安装 Ubuntu 系 ...
- 如何在Ubuntu 18.04 LTS上安装VMware Workstation
背景: 阅读新闻 [日期:2018-11-10] 来源:Linux公社 作者:醉落红尘 [字体:大 中 小] VMware Workstation是由VMware公司开发的虚拟化软件,成立于1998年 ...
最新文章
- 巨大冲击!AlphaFold2再登Nature,从业者都懵了:人类98.5%的蛋白质,全都被预测了一遍...
- Boost:bind绑定和数据成员以及高级用途的测试程序
- 搜索技巧——持续更新
- angular之两种路由
- Educational Codeforces Round 80 (Rated for Div. 2) E. Messenger Simulator 思维 + 树状数组
- python第七章_python 第七章 模块
- Apple Cached Service 导致 iPhone app store无法下载程序
- 网络安全与渗透测试工具集合
- status的状态码
- C语言sql参数化查询,使用LIKE的sql参数化查询
- EasyUI treegrid 获取编辑状态中某字段的值 [getEditor方法获取不到editor]
- couchdb 视图操作_CouchDB 教程
- Python3 - 深入学习Docker容器管理
- OpenXml编程--修正Word目录页码错误
- vue3 + vite +ts 引入静态图片
- 计算机查询成绩微信公众号,怎么在微信公众号上设置查询成绩?
- AutoLeaders控制组——51单片机学习笔记(LED点阵屏、DS1302时钟芯片)
- 电信资费七宗罪,终端的故事
- Freemarker模板---引擎学习
- 央行再次降息降准,利好股市,估计2800点附近反弹一两天,人民币贬值预期加强
热门文章
- 探索 Zynq MPSoC:配套 PYNQ 和机器学习应用一起使用 - 序言鸣谢目录20211231
- 当今十大备份应用软件
- android如何实现用户注册功能,Android 实现简单的登录注册功能(SharedPreferences和SQLite)...
- [软考]软考教程+历年真题
- Linux DTS中和中断相关属性的解释和用法
- C++内存模型以及寄存器指针rsp和rbp
- 西南交通大学计算机考研资料汇总
- 面试常问集锦——Java基础部分
- spark数据处理-RDD
- 停车场管理系统(C++)