在linux-node1節點上:
[root@linux-node1 ~]# yum install -y openstack-nova-compute [root@linux-node1 ~]# yum install -y libvirt qemu-kvm [root@linux-node1 ~]# systemctl start libvirtd [root@linux-node1 ~]# systemctl enable libvirtd [root@linux-node1 ~]# vim /etc/nova/nova.conf 增加novncproxy的地址: novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html [root@linux-node1 ~]# systemctl start openstack-nova-compute [root@linux-node1 ~]# systemctl enable openstack-nova-compute [root@linux-node1 ~]# source admin-openstack [root@linux-node1 ~]# nova service-list
當需要刪除該節點時,只能從命令行進行刪除:nova service-delete ID。在horizon界面上是只能關閉服務,無法進行刪除。
創建openstack鏡像的過程:
(1)創建一個虛擬機硬盤,格式qcow2,大小為10G
[root@linux-node1 ~]# qemu-img create -f qcow2 /tmp/centos.qcow2 10G Formatting '/tmp/centos.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
(2)創建虛擬機
[root@linux-node1 ~]# virt-install --virt-type kvm --name centos --ram 1024 \ --disk /tmp/centos.qcow2,format=qcow2 \ --network network=default \ --graphics vnc,listen=0.0.0.0 --noautoconsole \ --os-type=linux --os-variant=centos7.0 \ --location=/tmp/CentOS-7-x86_64-Minimal-1511.iso [root@linux-node1 ~]# virsh list --all Id 名稱 狀態 ---------------------------------------------------- - centos 關閉 [root@linux-node1 ~]# virsh start centos
(3)TightVNC鏈接192.168.56.11進入系統安裝
只分根分區,私有雲不分swap分區
(4)啟動虛擬機
[root@linux-node1 ~]# virsh start centos
(5)在虛擬機內安裝默認的軟件,或基礎優化
yum install net-tools tree screen wget git vim
(6)openstack上傳鏡像
[root@linux-node1 ~]# openstack image create "Centos-7-x86_64" --file=/tmp/centos.qcow2 --disk-format qcow2 --container-format bare --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | 4ac6fb14f7e5bb3c9889df4bda71474a | | container_format | bare | | created_at | 2017-12-07T08:06:55Z | | disk_format | qcow2 | | file | /v2/images/5aa6e9a1-4aea-467c-a684-51080c326887/file | | id | 5aa6e9a1-4aea-467c-a684-51080c326887 | | min_disk | 0 | | min_ram | 0 | | name | Centos-7-x86_64 | | owner | 21a45d59913d4c05b46ad3ec92e61656 | | protected | False | | schema | /v2/schemas/image | | size | 1145896960 | | status | active | | tags | | | updated_at | 2017-12-07T08:08:42Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+ [root@linux-node1 ~]# openstack image list +--------------------------------------+-----------------+--------+ | ID | Name | Status | +--------------------------------------+-----------------+--------+ | 5aa6e9a1-4aea-467c-a684-51080c326887 | Centos-7-x86_64 | active | | 51e1e125-dbe3-49c6-a3d5-55c89f195f55 | cirros | active | +--------------------------------------+-----------------+--------+
(7)通過上傳的鏡像創建centos7雲主機
使用admin賬戶創建雲主機類型,后使用demo用戶進行創建雲主機