Hosts配置
修改/etc/hosts文件,增長wtcontroller、wtcompute一、wtcompute2:html
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.10.100 wtcontroller 172.16.10.101 wtcompute1 172.16.10.102 wtcompute2
修改本機hostname(以計算主機wtcompute1爲例)python
echo "wtcompute1"> /etc/hostname
本示例使用的時163的yum源:linux
CentOS7-Base-163.repo 將以上文件拷貝至/etc/yum.repos.d目錄下 備份該目錄下CentOS-Base.repo文件 修改CentOS7-Base-163.repo爲CentOS-Base.repo 執行如下命令: yum clean all #清除緩存 yum makecache #生成緩存 yum list #顯示全部已經安裝和能夠安裝的程序包
關閉該服務,否者yum clean會卡死,屬於系統bugios
systemctl stop initial-setup-text
systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld.service
setenforce 0 getenforce sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux grep SELINUX=disabled /etc/sysconfig/selinux
yum install chrony -y vim /etc/chrony.conf --參考網絡配置,確保如下配置打開: server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst 並修改如下配置,打開如下網段節點向控制節點校時: allow 172.16.10.0/24
重啓服務並設置服務自啓動 systemctl restart chronyd.service systemctl status chronyd.service systemctl enable chronyd.service systemctl list-unit-files |grep chronyd.service
修訂時區redis
timedatectl set-timezone Asia/Shanghai chronyc sources
yum install centos-release-openstack-rocky -y yum clean all yum makecache
yum install python-openstackclient openstack-selinux -y
yum install openstack-nova-compute python-openstackclient openstack-utils -y 快速修改配置文件(/etc/nova/nova.conf) openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.3.170 openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:wtoe@123456@wtcontroller openstack-config --set /etc/nova/nova.conf api auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://wtcontroller:5000/v3 openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers wtcontroller:11211 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova openstack-config --set /etc/nova/nova.conf keystone_authtoken password wtoe@123456 openstack-config --set /etc/nova/nova.conf vnc enabled True openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0 openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address '$my_ip' openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://wtcontroller:6080/vnc_auto.html openstack-config --set /etc/nova/nova.conf glance api_servers http://wtcontroller:9292 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp openstack-config --set /etc/nova/nova.conf placement region_name RegionOne openstack-config --set /etc/nova/nova.conf placement project_domain_name Default openstack-config --set /etc/nova/nova.conf placement project_name service openstack-config --set /etc/nova/nova.conf placement auth_type password openstack-config --set /etc/nova/nova.conf placement user_domain_name Default openstack-config --set /etc/nova/nova.conf placement auth_url http://wtcontroller:5000/v3 openstack-config --set /etc/nova/nova.conf placement username placement openstack-config --set /etc/nova/nova.conf placement password wtoe@123456
檢查修訂有效性數據庫
egrep -v "^#|^$" /etc/nova/nova.conf
配置文件 應以下(以節點ip爲172.16.10.101爲例):vim
[DEFAULT] my_ip = 172.16.10.101 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:wtoe@123456@wtcontroller instances_path=$state_path/instances [api] auth_strategy = keystone [api_database] [barbican] [cache] [cells] [cinder] [compute] [conductor] [console] [consoleauth] [cors] [database] [devices] [ephemeral_storage_encryption] [filter_scheduler] [glance] api_servers = http://wtcontroller:9292 [guestfs] [healthcheck] [hyperv] [ironic] [key_manager] [keystone] [keystone_authtoken] auth_url = http://wtcontroller:5000/v3 memcached_servers = wtcontroller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = wtoe@123456 [libvirt] inject_password = true inject_partition = -1 [matchmaker_redis] [metrics] [mks] [neutron] url = http://wtcontroller:9696 auth_url = http://wtcontroller:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = wtoe@123456 [notifications] [osapi_v21] [oslo_concurrency] lock_path = /var/lib/nova/tmp [oslo_messaging_amqp] [oslo_messaging_kafka] [oslo_messaging_notifications] [oslo_messaging_rabbit] [oslo_messaging_zmq] [oslo_middleware] [oslo_policy] [pci] [placement] region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://wtcontroller:5000/v3 username = placement password = wtoe@123456 [placement_database] [powervm] [profiler] [quota] [rdp] [remote_debug] [scheduler] [serial_console] [service_user] [spice] [upgrade_levels] [vault] [vendordata_dynamic_auth] [vmware] [vnc] enabled = True server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://wtcontroller:6080/vnc_auto.html [workarounds] [wsgi] [xenserver] [xvp] [zvm]
配置虛擬機的硬件加速centos
#首先肯定您的計算節點是否支持虛擬機的硬件加速。api
egrep -c '(vmx|svm)' /proc/cpuinfo
#若是返回位0,表示計算節點不支持硬件加速,須要配置libvirt使用QEMU方式管理虛擬機,使用如下命令:緩存
openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu egrep -v "^#|^$" /etc/nova/nova.conf|grep 'virt_type'
#若是返回爲其餘值,表示計算節點支持硬件加速且不須要額外的配置,使用如下命令:
openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm
若後續在計算節點支持硬件加速的狀況下依然出現建立實例報錯的狀況下,則須要進一步確認硬件加速是否被打開:
dmesg | grep kvm 若是有顯示[ 3.692481] kvm: disabled by bios 則須要在bios中打開虛擬化選項
啓動nova相關服務,並配置爲開機自啓動
#須要啓動2個服務
systemctl start libvirtd.service openstack-nova-compute.service systemctl status libvirtd.service openstack-nova-compute.service systemctl enable libvirtd.service openstack-nova-compute.service systemctl list-unit-files |grep libvirtd.service systemctl list-unit-files |grep openstack-nova-compute.service
登錄到控制節點進行配置
#如下命令在控制節點操做:
. admin-openrc
#檢查確認數據庫有新的計算節點
openstack compute service list --service nova-compute su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
#設置新建立節點自動註冊的任務(已經添加到配置文件中)
[scheduler] discover_hosts_in_cells_interval = 300
在控制節點中進行驗證
1)應用管理員環境變量腳本 . admin-openrc 2)列表查看安裝的nova服務組件 #驗證是否成功註冊並啓動了每一個進程 openstack compute service list 3)在身份認證服務中列出API端點以驗證其鏈接性 openstack catalog list 4)在鏡像服務中列出已有鏡像已檢查鏡像服務的鏈接性 openstack image list 5)檢查nova各組件的狀態 #檢查placement API和cell服務是否正常工做 nova-status upgrade check
yum install openstack-neutron-openvswitch ebtables ipset -y (計算節點) 快速配置/etc/neutron/neutron.conf openstack-config --set /etc/neutron/neutron.conf DEFAULT transport_url rabbit://openstack:wtoe@123456@wtcontroller openstack-config --set /etc/neutron/neutron.conf DEFAULT auth_strategy keystone openstack-config --set /etc/neutron/neutron.conf keystone_authtoken www_authenticate_uri http://wtcontroller:5000 openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_url http://wtcontroller:5000 openstack-config --set /etc/neutron/neutron.conf keystone_authtoken memcached_servers wtcontroller:11211 openstack-config --set /etc/neutron/neutron.conf keystone_authtoken auth_type password openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_domain_name default openstack-config --set /etc/neutron/neutron.conf keystone_authtoken user_domain_name default openstack-config --set /etc/neutron/neutron.conf keystone_authtoken project_name service openstack-config --set /etc/neutron/neutron.conf keystone_authtoken username neutron openstack-config --set /etc/neutron/neutron.conf keystone_authtoken password wtoe@123456 openstack-config --set /etc/neutron/neutron.conf oslo_concurrency lock_path /var/lib/neutron/tmp
查看生效的配置
egrep -v '(^$|^#)' /etc/neutron/neutron.conf
快速配置/etc/neutron/plugins/ml2/openvswitch_agent.ini openstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini agent tunnel_types vxlan openstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini agent l2_population True penstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini ovs local_ip 172.16.20.81 penstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini ovs tunnel_bridge br-tun openstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver openstack-config --set /etc/neutron/plugins/ml2/openvswitch_agent.ini securitygroup enable_security_group True
查看生效的配置
egrep -v "^#|^$" /etc/neutron/plugins/ml2/openvswitch_agent.ini
快速配置/etc/nova/nova.conf
openstack-config --set /etc/nova/nova.conf neutron url http://wtcontroller:9696 openstack-config --set /etc/nova/nova.conf neutron auth_url http://wtcontroller:5000 openstack-config --set /etc/nova/nova.conf neutron auth_type password openstack-config --set /etc/nova/nova.conf neutron project_domain_name default openstack-config --set /etc/nova/nova.conf neutron user_domain_name default openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne openstack-config --set /etc/nova/nova.conf neutron project_name service openstack-config --set /etc/nova/nova.conf neutron username neutron openstack-config --set /etc/nova/nova.conf neutron password wtoe@123456
#查看生效的配置
egrep -v '(^$|^#)' /etc/nova/nova.conf
重啓計算節點
systemctl restart openstack-nova-compute.service systemctl status openstack-nova-compute.service
啓動neutron網絡組件,並配置開機自啓動
#須要啓動1個服務,網橋代理
systemctl restart neutron-openvswitch-agent.service systemctl status neutron-openvswitch-agent.service systemctl enable neutron-openvswitch-agent.service systemctl list-unit-files |grep neutron* |grep enabled
在控制節點檢查確認neutron服務安裝成功
獲取管理權限
source admin-openrc
列表查看加載的網絡插件
openstack extension list --network
或者使用另外一種方法:顯示簡版信息
neutron ext-list
查看網絡代理列表
openstack network agent list
#正常狀況下:控制節點有3個服務,計算節點有1個服務,若是不是,須要檢查計算節點配置:網卡名稱,IP地址,端口,密碼等要素