This document will explain how to build an Ubuntu Server 20.04 LTS ova with vAPP properties enabled.
Requirement:
- VM Deployment access required in vCenter environment.
- We have used the vCenter Server 6.7 and ESXi 6.5 while documented the below steps
1. Install a ubuntu server 20.04 lts vm with minimal cpu, ram and HDD(as needed). Make your own partition.
2. Use apt-get to upgrade all the packages along with the additional packages that required to install in the vm:
$ sudo apt-get update && apt-get upgrade -y
3. Make sure that 'open-vm-tools' and 'ifupdown' package is installed in the vm:
$ sudo apt-get install open-vm-tools -y
$ sudo apt-get install ifupdown -y
4. Take the console of the vm and stop, disable and mask the Network Manager service:
$ systemctl stop NetworkManager.service
$ systemctl disable NetworkManager.service
$ systemctl mask NetworkManager.service
5. Delete the Network Manager config file:
$ sudo rm -rf /etc/netplan/01-network-manager-all.yaml
6. Let's assume that we need to have two network interfaces:
- Network Interface1: Management Network
- Network Interface2: Firewall Network
Based on the above requirement we have to create a systemd daemon and a shell script to receive and use the vAPP properties. Make '/usr/local/bin/netconfig.sh' file and load the below content:
7. Create '/lib/systemd/system/netconfig.service' file and add the following systemd command details:
8. Change the permission of '/usr/local/bin/netconfig.sh' file and enable the 'netconfig.service' to load automatically across reboot:
$ sudo chmod 755 /usr/local/bin/netconfig.sh
$ sudo systemctl enable netconfig.service
9. Now shutdown the vm, edit the vm's setting and change the network interface to 'VM Network' for both the interfaces:
10. Its time to edit the vAPP properties to receive the IP details in guest OS. Go to Configure -> Settings -> vApp and click on Edit:
11. Enable the vAPP properties and select the ovf environment along with the IPv4 type IP protocol:
12. Go to OVF details and select the VMware Tools:
13. Once OVF properties enabled, edit the properties section with correct Key, Label, Category, Type as mentioned below:
14. After completing all the entries, it should look like below:
15. Now export the vm as OVF Template. You should be able to receive 3 files if the VM is running on ESXi 6.5. On ESXi 6.7 and higher, it will download one .nvram file but backward compatibility is not there. So while packing your OVA, make sure to remove that.
16. Once the download will complete, check the size of .vmdk file using the 'ls -lh <ProvisionServer-Ubuntu-20.04-1.vmdk>' command and add it with the marked entry in ProvisionServer-Ubuntu-20.04.ovf file:
17. Now collect the sha256sum of the .ovf file and update .mf file and then use the below command to build the .ova file:
NOTE: Make sure to use the correct sequence as mentioned above while making the OVA. Else the OVA wont work.
Comments
Post a Comment