Prepare Clean GNU/Linux Images

Retrieve an installation disk, e.g. Centos 6.4:

$ wget

Create an empty image:

$ IMG_NAME=centos-6.4-i386
$ qemu-img create -f qcow2 ${IMG_NAME}.qcow2 12G

Boot with kvm. Note that you should mention virtio for best performance. Replace the latter :50 for VNC with any free VNC display number:

$ qemu-kvm -drive file=${IMG_NAME}.qcow2,if=virtio -net nic -net user -cdrom CentOS-6.4-x86_64-minimal.iso -m 1G -boot d -vnc

To see busy VNC display numbers you can run:

$ ps aux | grep vnc | sed -r 's/.*vnc [0-9.]+:([0-9]+).*/\1/' | sort -n

If you are running the instance on remote computer, use a VNC client such as Vinagre and connect to it.

Follow installation instructions. Create single partition and do not pay attention to “no swap partition” complains.

That’s better to configure network during installation. You should use DHCP and agree to connect automatically. However, network can be tuned after installation.

Confirm to reboot after installation.

Login as root. Tune the network (that’s important that configs do not refer to MAC addresses):

# cat > /etc/sysconfig/network-scripts/ifcfg-eth0
# /etc/init.d/network restart

and check the network:

# ifconfig eth0

eth0 should have an IP.

Now do

# yum clean all
# yum update -y

Perform some small changes:

# sed --follow-symlinks -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
# echo > /etc/sysconfig/iptables
# rm -f /etc/udev/rules.d/*-persistent-*

and halt the system.


I recommend to use Ubuntu for Cloud (

Login as user you have created during installation. Issue

$ sudo bash

Set a sample password with the `passwd` command.

Upgrade the system.

# apt-get upgrade

Perform some small changes:

# rm -f /etc/udev/rules.d/*-persistent-*

and halt the system.

If you are not satisfied by image real size, you can recompress it. This procedure can reduce image size a bit.

$ mv ${IMG_NAME}.qcow2{,.bak}
$ qemu-img convert -O qcow2 ${IMG_NAME}.qcow2.bak ${IMG_NAME}.qcow2

Leave a Reply

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

You are commenting using your 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