CSS Corp Open Source Services

Bundling CentOS Image with VNC access for OpenStack

leave a comment »

This article explains how to create a CentOS 6 image with VNC access on KVM for uploading it to the image store on OpenStack Diablo.  I have used KVM running on Ubuntu 11.10 64-bit server for creation of the image.

The first step would be to create a qcow2 image. This will represent the main HDD of the virtual machine, so make sure to give it as much space as you will need.

kvm-img create -f qcow2 centos.img 5G

Boot Virtual Machine from the CD.

kvm -m 1024 -cdrom CentOS-6.0-i386-bin-DVD.iso -drive file=centos.img,if=virtio,index=0 -boot d -net nic -net user -nographic -vnc :1

Connect to the Virtual Machine through VNC (use display number :1).For Example, where is the IP address of the host machine.

vncviewer :1

Boot the Virtual Machine

kvm -m 1024 -drive file=centos.img,if=virtio,index=0,boot=on -boot c -net nic -net user -nographic -vnc :1

Install VNC server and perform the following steps.

yum install vnc-server
chkconfig vncserver off
service vncserver stop
yum install xinetd

Edit /etc/gdm/custom.conf and add the following lines


Edit the file /etc/services and comment the following lines

vnc-server 5900/tcp # VNC Server
vnc-server 5900/udp # VNC Server

and add the following line

vnc1024 5900/tcp # VNC and GDM

create a file /etc/xinetd.d/vnc1024 and add the following lines

service vnc1024
disable = no

socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1024×768 -depth 16 -once -fp
/usr/share/X11/fonts/misc -securitytypes=none

Run the following command to check whether VNC is accessible.

service xinetd restart

Shutdown the Virtual Machine. Upload the image to OpenStack using the following command

cloud-publish-image amd64 centos.img centosbucket

The following output shows that the image has been successfully uploaded.

ami-00000001 centosbucket/centos.img.manifest.xml

Verify whether the instance boots from the uploaded image.

euca-run-instances ami-00000001 -k mykey -t m1.small

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: