How to Create Kali Linux Image in QCOW2 format for OpenStack?

Updated on September 2, 2017

If you ever wanted to try Kali Linux in OpenStack, then you have landed on the right page. In this tutorial, I’ll show how to create a Kali Linux image in qcow2 format for OpenStack Mitaka. Kali Linux is one of the most advanced penetration testing distribution developed by Offensive security which is based on Debian and comes loaded with security analyzing and forensic tools. For one of my security project, I thought of trying Kali Linux on OpenStack – where I need an image in QCOW2 format. So here’s how I created one.

Prerequisites:

Before we create an image in QCOW2 format, let us install dependent libraries and commands.

Step 1: Install Qemu-kvm, libvirt and other dependent tools

# yum install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-goodies p7zip-full

Step 2: Download Kali Linux image

# wget https://images.offensive-security.com/virtual-images/Kali-Linux-2016.1-vm-amd64.7z

convert vmdk image to qcow

Step 3: Extract the download image.

# 7za x Kali-Linux-2016.1-vm-amd64.7z

Note: You must have 7-zip archiver installed. If not, click on this link to install it.

Step 4: Check out the list of VMDK files in the extracted folder.

# ls -l Kali-Linux-2016.1-vm-amd64
-rw-r--r--. 1 root root       8684 Feb  1  2016 Kali-Linux-2016.1-vm-amd64.nvram
-rw-r--r--. 1 root root 3843620864 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s001.vmdk
-rw-r--r--. 1 root root 2662793216 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s002.vmdk
-rw-r--r--. 1 root root  785776640 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s003.vmdk
-rw-r--r--. 1 root root 1399914496 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s004.vmdk
-rw-r--r--. 1 root root  553648128 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s005.vmdk
-rw-r--r--. 1 root root  785645568 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s006.vmdk
-rw-r--r--. 1 root root  728498176 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s007.vmdk
-rw-r--r--. 1 root root    2752512 Feb  1  2016 Kali-Linux-2016.1-vm-amd64-s008.vmdk
-rw-r--r--. 1 root root        965 Feb  1  2016 Kali-Linux-2016.1-vm-amd64.vmdk
-rw-r--r--. 1 root root          0 Feb  1  2016 Kali-Linux-2016.1-vm-amd64.vmsd
-rw-r--r--. 1 root root       2693 Feb  1  2016 Kali-Linux-2016.1-vm-amd64.vmx
-rw-r--r--. 1 root root        281 Feb  1  2016 Kali-Linux-2016.1-vm-amd64.vmxf

Step 5: Let us now convert all VMDK files into a single QCOW2 format.

# qemu-img convert -O qcow2 Kali-Linux-2016.1-vm-amd64/Kali-Linux-2016.1-vm-amd64-s00*.vmdk kali-for-stack.qcow2

Step 6: Verify the converted image.

# file kali-for-stack.qcow2
kali-for-stack.qcow2: QEMU QCOW Image (v3), 32212254720 bytes

That’s it!. Now this image can be uploaded to OpenStack Glance as shown below:

# glance image-create --name "Kali-Linux" --disk-format qcow2 --container-format bare --file kali-for-stack.qcow2
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | 17cfa81326d31eeb644815e89c5abbdf     |
| container_format | bare                                 |
| created_at       | 2016-09-01T08:53:26Z                 |
| disk_format      | qcow2                                |
| id               | 835d640e-7b6b-4fd4-8ce3-b67e538f52a0 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | Kali-Linux                           |
| owner            | b04e66b42a9841ec947d5f68195980bc     |
| protected        | False                                |
| size             | 8250523648                           |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2016-09-01T08:53:54Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

For more information on OpenStack Glance, click here.

Thanks to Stackbees.

Was this article helpful?

Related Articles

Leave a Comment