Create a Good OpenStack Image

Create a Good OpenStack Image

This post will describe how to construct a good OpenStack image. After VM started, cloud-init will overwrite VM’s settings (Network, Service, User and so on), so we can configure our image file for better user experience.

Environment Preparation

We use Ubuntu 16.04 for demo, you can decide use which Linux distribution by yourself. Install following package in your Image build machine.

  • qemu-utils
  • virtinst
  • virt-manager
  • libguestfs-tools

Create Image disk

Here is my custom create script, take a look or use following command:

Warning: If your image build machine is Ubuntu 14.04, then os-variant=ubuntu16.04 is not supported, use ubuntu14.04 instead.

And you can find Ubuntu base image on the Internet.

Install and operate VM by virt-viewer

Go to Application and search virt-viewer to start virt manager console.

Virt Viewer

If you were stuck in /dev/vda1: clean, 60739/589824 files, 367171/2359040 blocks, you can find the way to solve in Virt-Manager said ‘/dev/vda1: clean, files, blocks’ can’t start up error.

Install Prerequisite Package

  • cloud-init(Install when your vm is done)
  • vim
  • dhcpcd5
  • openssh-server

VM Configuration

dhcpcd configuration

Delete network interface dhcp config from:


and start service: sudo service dhcpcd start

sudo without password

Use sudo visudo to edit sudoer file as following:

ssh with no delay

Add UseDNS no in /etc/ssh/sshd_config.

Clean & Compress VM image

Leave a Reply

Your email address will not be published. Required fields are marked *