Tutorials Centos Vm Image

There are multiple ways to create a CentOS image compatible with OpenStack Glance image repository. You can:

circle-info

Note

The benefit of cloud-init is that it allows customization of virtual machines

circle-check

This tutorial describes how you can create a CentOS guest image from scratch and also optionally install cloud-init.

Step 1 - Download ISO

ISO images are available form CentOS and its mirrors https://www.centos.org/download/arrow-up-right

Assuming you have a CentOS/Ubuntu system with libvirt and all the dependencies installed (see here for details: http://virt-manager.org/arrow-up-right), go to /var/lib/libvirt/images and copy the downloaded iso.

cd /var/lib/libvirt/images
wget http://mirror.hmc.edu/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso

Step 2 - Create a Virtual Machine

Fire up your virt-manager and create a new virtual machine.

Pick the ISO you just downloaded.

Use OS type = Linux, Version= Red Hat Enterprise Linux 6

Pick the amount of CPU, Memory and Storage.

Step 3 - Install & Configure OS

Pick the options you like, I generally install minimal with just SSH. Depending upon how you want your consumers to logon to the virtual machine, you can configure the users, password and SSH configuration (no-password vs password logon). I suggest putting a specific admin user with a password/ssh key that can be used by your system administrators to logon. Platform9 (and OpenStack), will allow the owner of the virtual machine to pass a SSH key at boot time, but this specific admin user can be used exclusively by a system administrator as a powerful debugging tool.

Step 4 - (Optional) Install cloud-init

Once the OS is installed, reboot and log in; by default OS comes up with DHCP configured. Install epel repository to fetch cloud-init and then install cloud-init.

Step 6 - Power Off the Virtual Machine

Now go ahead and power-off the virtual machine. You are one step away from the setup.

Step 7 - Call virt-sysprep

Congratulations! Your image is ready, copy it to the "ImageLibrary" in Platform9 or any other glance installation and it is ready to go.

Last updated

Was this helpful?