码迷,mamicode.com
首页 > 其他好文 > 详细

制作OpenStack云平台centos6.5镜像

时间:2019-01-19 20:09:33      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:rhel6   cow   ota   shu   roc   shutdown   active   disk   var   

创建虚拟镜像

# 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镜像

标签:rhel6   cow   ota   shu   roc   shutdown   active   disk   var   

原文地址:https://www.cnblogs.com/djlsunshine/p/10292916.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!