部署openstack可參考:http://www.javashuo.com/article/p-dszayery-mn.html
配置虛擬機設置
導入環境變量shell
[root@controller ~]# vi admin-openrc export OS_PROJECT_DOMAIN_NAME=Default export OS_USER_DOMAIN_NAME=Default export OS_PROJECT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=openstack export OS_AUTH_URL=http://controller:5000/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2 [root@controller ~]# source admin-openrc
controller配置centos
[root@controller ~]# vi /etc/openstack-dashboard/local_settings OPENSTACK_HYPERVISOR_FEATURES = { 'can_set_mount_point': False, 'can_set_password': True, 'requires_keypair': False, } #重啓服務 [root@controller ~]# systemctl restart httpd.service memcached.service
computer配置安全
[root@computer ~]# vi /etc/nova/nova.conf [libvirt] inject_password = true inject_partition = -1 #重啓服務 [root@computer ~]# systemctl stop libvirtd.service openstack-nova-compute.service [root@computer ~]# systemctl start libvirtd.service openstack-nova-compute.service
下載CentOS-7-x86_64-GenericCloud-1907.qcow2鏡像包
下載地址:https://cloud.centos.org/centos/7/images/網絡
[root@controller ~]# openstack image create "Centos7" --file CentOS-7-x86_64-GenericCloud-1907.qcow2 --disk-format qcow2 --container-format bare --public
[root@controller ~]# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
建立provicer網絡架構
[root@controller ~]# openstack network create --share --external --provider-physical-network provider --provider-network-type flat provider
設置子網ssh
[root@controller ~]# openstack subnet create --network provider --allocation-pool start=192.168.31.100,end=192.168.31.120 --gateway 192.168.31.1 --subnet-range 192.168.31.0/24 provider
建立self-service網絡ide
[root@controller ~]# openstack network create selfservice
建立子網memcached
[root@controller ~]# openstack subnet create --network selfservice --gateway 172.16.1.1 --subnet-range 172.16.1.0/24 selfservice
建立並配置路由測試
[root@controller ~]# openstack router create router [root@controller ~]# neutron router-interface-add router selfservice [root@controller ~]# neutron router-gateway-set router provider
設置root密碼
綁定浮動IPui
[root@controller ~]# ping -c 5 192.168.31.101 PING 192.168.31.101 (192.168.31.101) 56(84) bytes of data. 64 bytes from 192.168.31.101: icmp_seq=1 ttl=63 time=2.37 ms 64 bytes from 192.168.31.101: icmp_seq=2 ttl=63 time=1.76 ms 64 bytes from 192.168.31.101: icmp_seq=3 ttl=63 time=2.63 ms 64 bytes from 192.168.31.101: icmp_seq=4 ttl=63 time=5.02 ms 64 bytes from 192.168.31.101: icmp_seq=5 ttl=63 time=1.89 ms --- 192.168.31.101 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4009ms rtt min/avg/max/mdev = 1.768/2.737/5.023/1.186 ms
[root@controller ~]# ssh centos@192.168.31.101 [centos@mycentos ~]$ ip a inet 172.16.1.3/24 brd 172.16.1.255 scope global dynamic eth0