制作OpenStack云平台centos6.5镜像
Posted 葡萄架
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了制作OpenStack云平台centos6.5镜像相关的知识,希望对你有一定的参考价值。
创建虚拟镜像
# qemu-img create -f raw Cloud_Centos6.5_64bit.img 10G
[root@localhost ~]# ll /opt/CentOS-6.5-x86_64-bin_DVD.iso -rw-r--r-- 1 root root 4471971840 Aug 21 2016 /opt/CentOS-6.5-x86_64-bin_DVD.iso [root@localhost ~]# [root@localhost ~]# cd /tmp/ [root@localhost tmp]# [root@localhost tmp]# qemu-img create -f raw Cloud_Centos6.5_64bit.img 10G Formatting \'Cloud_Centos6.5_64bit.img\', fmt=raw size=10737418240 [root@localhost tmp]# [root@localhost tmp]# ll Cloud_Centos6.5_64bit.img -rw-r--r-- 1 root root 10737418240 Jan 20 02:08 Cloud_Centos6.5_64bit.img [root@localhost tmp]#
创建KVM虚拟机,并启动
# virt-install --name Cloud_Centos6.5_64bit --ram 1024 --vcpus=1 --disk path=Cloud_Centos6.5_64bit.img --network network:default,model=virtio --arch=x86_64 --os-type=linux --os-variant=rhel6 --graphics vnc,port=5910 --cdrom /opt/CentOS-6.5-x86_64-bin_DVD.iso
[root@localhost tmp]# virt-install --name Cloud_Centos6.5_64bit --ram 1024 --vcpus=1 --disk path=Cloud_Centos6.5_64bit.img --network network:default,model=virtio --arch=x86_64 --os-type=linux --os-variant=rhel6 --graphics vnc,port=5910 --cdrom /opt/CentOS-6.5-x86_64-bin_DVD.iso Starting install... Creating domain... | 0 B 00:00 Cannot open display: Run \'virt-viewer --help\' to see a full list of available command line options Domain installation still in progress. You can reconnect to the console to complete the installation process. [root@localhost tmp]#
[root@localhost tmp]# virsh list --all Id Name State ---------------------------------------------------- - centos7 shut off - Cloud_Centos6.5_64bit shut off - Cloud_win7_64bit shut off [root@localhost tmp]# [root@localhost tmp]# virsh start Cloud_Centos6.5_64bit Domain Cloud_Centos6.5_64bit started [root@localhost tmp]# [root@localhost tmp]# virsh list --all Id Name State ---------------------------------------------------- 2 Cloud_Centos6.5_64bit running - centos7 shut off - Cloud_win7_64bit shut off [root@localhost tmp]#
修改centos6.5虚拟机的网卡,并重启
查看IP地址
关机shutdown
转换格式
# qemu-img convert -f raw -O qcow2 Cloud_Centos6.5_64bit.img Cloud_Centos6.5_64bit.qcow2
[root@localhost tmp]# ll total 21296264 -rw-r--r-- 1 root root 10737418240 Jan 20 02:40 Cloud_Centos6.5_64bit.img -rw-r--r-- 1 root root 3028287488 Jan 20 02:44 Cloud_Centos6.5_64bit.qcow2
上传到OpenStack中
# glance image-create --name Cloud_Centos6.5_64 --disk-format qcow2 --container-format bare --is-public true --progress < /tmp/Cloud_Centos6.5_64bit.qcow2
[root@controller ~]# glance image-create --name Cloud_Centos6.5_64 --disk-format qcow2 --container-format bare --is-public true --progress < /tmp/Cloud_Centos6.5_64bit.qcow2 [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | d6e6a71c69f1996350970489f9513402 | | container_format | bare | | created_at | 2019-01-19T19:02:32 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | fa28fbc9-cd3f-45f7-bb94-8fc8a09fc95c | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | Cloud_Centos6.5_64 | | owner | 78f68e3b1a9a4e99818901638995aa36 | | protected | False | | size | 3028287488 | | status | active | | updated_at | 2019-01-19T19:03:56 | | virtual_size | None | +------------------+--------------------------------------+ [root@controller ~]#
完毕
以上是关于制作OpenStack云平台centos6.5镜像的主要内容,如果未能解决你的问题,请参考以下文章
OpenStack创建win7实例遇到的问题(尚未解决,求帮助)