这篇文章是按照陈沙克那篇博文的环境安装之后进行的

 

【准备工作】

 

本文制作的是centos 5.5的镜像

 

1.CentOS-5.5-x86_64-bin-DVD-1of2.iso

 

 准备好后,执行以下命令:

 

A: qemu-img create -f raw centos.img 10G

Formatting 'centos.img', fmt=raw size=10737418240

 

B: kvm -m 1024 -cdrom CentOS-5.4-x86_64-bin-DVD.iso -drive file=centos.img,if=virtio,index=1 -boot d -net nic -net user -nographic -vnc :2

 

这个时候去用vnc工具连接,端口5902,然后安装centos5.5,磁盘一个分区。最好是去了桌面包,安装开发包。之后清楚iptables规则,disable selinux。网卡配置设为dhcp模式。

 

C: reboot

 

D: halt

(kvm -m 1024 -drive file=centos.img,if=virtio,index=1 -boot d -net nic -net user -nographic -vnc :2这个可以安装后进去修改镜像内容)

如果不能退出可以杀进程。

 

这个时候就可以导入镜像了。

 

glance add name="CentOS 5.5 x86_64" is_public=true container_format=ovf disk_format=raw < /root/centos.img 

 

 

之后执行 glance index

root@essex1:~# glance index

ID                                   Name                           Disk Format          Container Format     Size          

------------------------------------ ------------------------------ -------------------- -------------------- --------------

6adc70b6-714f-4047-b479-df29a64a05e6 CentOS 5.5 x86_64              raw                  ovf                     10737418240

 

成功,启动instance是可以vnc看启动是否有问题

后面我会根据本人实际需求制作出不同的镜像