1. Create a 10GB size "hard disk" (Qcow2 format):
A) sudo kvm-img create-f qcow2 ubuntu.img 10G
2. Use Ubuntu's "Setup Disk" and the "hard drive" you just created to boot the system, for the sake of simplicity, use KVM virtual technology here. The-vnc parameter indicates that VNC access is turned on so that it can be installed remotely with another machine to the boot interface:
A) sudo kvm-m 1024-cdrom ubuntu-12.04.3-desktop-amd64.iso-drive file=ubuntu.img-boot d-nographic-vnc:10
3. Follow the onscreen prompts to complete the installation of Ubuntu (as with the Ubuntu process on your computer) after logging in to the boot interface with Vncviewer. It is important to note that all 10GB hard disks are partitioned into one EXT4 root partition during the partitioning phase, and do not create multiple partitions or swap zones:
A) sudo vncviewer localhost:10
4. After installing and exiting (Kill the KVM process if necessary), follow the command below to launch the virtual machine image ubuntu.img that you just installed. Install some of the necessary tools (because this image will be a template, so it's best to keep it minimal and don't mess things up):
A) sudo kvm-m 1024-drive file=ubuntu_img/ubuntu.img-boot c-nographic-vnc:10
b) sudo vncviewer localhost:10
c) Apt-get Update
d) Apt-get Upgrade
e) apt-get Install Openssh-server Cloud-init
5.70-persistent-net.rules will automatically add additional network interfaces, you need to delete this file to avoid automatically adding interfaces other than eth0. After deletion, the system is basically ready to shut down the virtual machine:
A) # sudo rm-rf/etc/udev/rules.d/70-persistent-net.rules
b) # sudo shutdown-h now
6. Add the image you just created to OpenStack using the glance command
A) glance add Name= "ubuntu_12.04_img" Is_public=true container_format=ovf disk_format=qcow2 < ubuntu.img
7. Refresh this interface to see the image you just added.
8. Click the Launch button to set the appropriate parameters to generate an instance of the image.
9. Go to the interface shown and click the name of the instance you just created to access the instance management interface.
10. In the instance management interface, click VNC to access the appropriate virtual machine remotely.
Making Ubuntu 12.04 system images for OpenStack