1 ISO file copy
Copy the 64-bit version 12.04 Ubuntu system to the production machine 10.240.0.133
2 Soft link Making
Making QEMU soft links in the/usr/bin directory
3 Creating a blank image file
Create a 8GB size "hard disk" (Qcow2 format):
sudo qemu-img create-f qcow2 ubuntu.img 8G
4 Populating the image file
Using Ubuntu's "Setup Disk" and the "hard drive" you just created to boot the system, use KVM virtual technology here for simplicity. The-vnc parameter indicates that VNC access is turned on so that it can be installed remotely with another machine to the boot interface:
sudo qemu-m 1024-cdrom ubuntu-12.04.4-desktop-amd64.iso-drive file=ubuntu.img-boot d-nographic-vnc:10
Vncserver:http://www.cnblogs.com/lanxuezaipiao/p/3724958.html
sudo vncserver Open the root user session
Vncserver open a session for an ordinary user
The vncserver:1 represents the use of 5801 ports, incrementing
5 VNC Remote System installation
Follow the onscreen prompts to complete the installation of Ubuntu (as with the Ubuntu process on your computer) by 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, do not create multiple partitions and do not create swap areas
sudo vncviewer localhost:10
6 Image Customization
Exit after installation (kill the QEMU process if necessary), and follow the command below to launch the virtual machine image ubuntu.img that you just installed. Install some 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 qemu-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
Persistent-net.rules will automatically add additional network interfaces and need to remove this file to avoid automatically adding interfaces other than eth0. After deletion, the system is basically ready to shut down the virtual machine:
sudo rm-rf/etc/udev/rules.d/70-persistent-net.rules
sudo shutdown-h now
7 Glance adding an OpenStack image
Add the image you just created to OpenStack with the glance command
Glance image-create--name ubuntu_12.04_64--file ubuntu.img--min-ram 1024x768--min-disk 10–is-public True--container-form At Bare--disk-format qcow2–progress
8 Nova Add OpenStack instance
Use the Nova command to create an instance of the image
Nova boot ubuntu_test--image ubuntu_12.04_64--flavor m1.small--nic net-id=04cf3786-ad5b-4890-b008-b74e6f952337
The production of OpenStack image based on Rhel