We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Create CentOS|Ubuntu|Debian VM Templates on OpenNebula

Learn how to – Create CentOS|Ubuntu|Debian VM Templates on OpenNebula.

How can I create Ubuntu / CentOS / Debian and any other Linux distribution VM Template in OpenNebula?. In OpenNebula, Virtual Machines cannot be created without defined VM Templates. The VM Template Pool allows OpenNebula administrators and users to register Virtual Machine definitions in the system, to be instantiated later as Virtual Machine instances.

The VM Templates can be instantiated several times, and also shared with other users in OpenNebula cloud platform. The Templates are stored in the system and they’re easy to browse and instantiate VMs from them. We will show one example of defining VM templates on OpenNebula and the same process can be applied for any other template.

Before you proceed, an OS image is required in OpenNebula, refer to guide below for how-to:

Create CentOS|Ubuntu|Debian VM Templates on OpenNebula

A Virtual Machine created on OpenNebula system will consist of:

  • A capacity in terms of memory and CPU
  • A set of NICs attached to one or more virtual networks
  • A set of disk images
  • Optional attributes like VNC graphics, the booting order, context information, etc.

Step 1: Initiate VM Template Creation

Login to OpenNebula Sunstone Web console and navigate to “Templates” > “VMs

Hit the “+” button and choose “Create

Step 2: Fill the required information for Template creation

Under the “General” section input:

  • Template Name
  • Template Description
  • Choose Hypervisor
  • Template Logo
  • Memory and CPU details

Under the “Storage” section input:

  • Choose VM image added previously

Under the “Network” section input:

  • Default network for the VM template
  • Any other network option that applies for your template

Under “OS & CPU” set options you want to use.

  • Boot
  • Kernel
  • Ramdisk
  • Features
  • CPU Model

I’ve added below two options which disables IPv6 and change naming of network interfaces:

 net.ifnames=0 ipv6.disable=1

See below screenshot.

Under “Input/Output” you can set Graphics and PCI options

A default SSH key can be added under “Context” > “Configuration” section. Same for text of script to be executed when the machine starts up.

You can play with other settings in the “Scheduling” and “Hybrid” sections. When done hit the “Create” button.

The template should appear in the list of available OpenNebula VM Templates.

Clicking on the name displays more information about the template:

Step 3: Test by Creating VM from the Template

We can test our template by provisioning a VM instance from it. This is done from “Instances” > “VMs” > “+ > “Create

Choose VM template to create a VM from.

Give the VM a name, instance count to create, and customize resources allocation if need be.

And all other parameters that you want to set.

Once you choose “Create” the VM will be in Pending state.

Once ready for use it will be in “RUNNING” state.

You can get VM details such as IP Address by clicking the instance name.

Test connectivity by pinging the IP Address:

$ ping -c 1 172.20.20.100
PING 172.20.20.100 (172.20.20.100) 56(84) bytes of data.
64 bytes from 172.20.20.100: icmp_seq=1 ttl=64 time=0.611 ms

--- 172.20.20.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.611/0.611/0.611/0.000 ms

Do the same for SSH

$ ssh  centos@172.20.20.100
The authenticity of host '172.20.20.100 (172.20.20.100)' can't be established.
ECDSA key fingerprint is SHA256:/k4pJX5pZiQHPMgnkPLAjtwqbBmNbuY6QP+5BiTEmHA.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.20.20.100' (ECDSA) to the list of known hosts.
Enter passphrase for key '/home/josphat/.ssh/id_rsa':
Activate the web console with: systemctl enable --now cockpit.socket

[centos@ip-172-20-20-100 ~]$

Confirm interface naming changed as configured through kernel parameters:

$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 02:00:ac:14:14:64 brd ff:ff:ff:ff:ff:ff
    inet 172.20.20.100/24 brd 172.20.20.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::acff:fe14:1464/64 scope link
       valid_lft forever preferred_lft forever

We’ve confirmed the VM was created successfully from the template. We were also able to ssh into the instance.

References:

Other guides on OpenNebula:

2
290.584,90

Cart