Create Nova database by operating on controller node
mysql -u root -pzouhuiying CREATE DATABASE nova; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS'; flush privileges
Add environment variables (temporarily added environment variables, only valid in the current window)
source admin-openrc.sh
Create Nova User
openstack user create --domain default --password-prompt nova
Add the admin role to the nova user:
openstack role add --project service --user nova admin
Create the nova service entity:
openstack service create --name nova --description "OpenStack Compute" compute
Create the Compute service API endpoints:
openstack endpoint create --region RegionOne compute public http://controller:8774/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne compute internal http://controller:8774/v2/%\(tenant_id\)s openstack endpoint create --region RegionOne compute admin http://controller:8774/v2/%\(tenant_id\)s
Install related packages
yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient
vim /etc/nova/nova.conf
[database] ... connection = mysql://nova:NOVA_DBPASS@controller/nova Configuration of message queues [DEFAULT] ... rpc_backend = rabbit [oslo_messaging_rabbit] ... rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS //Change to your own password //authentication configuration [DEFAULT] ... auth_strategy = keystone [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = nova password = NOVA_PASS [DEFAULT] ... my_ip = 10.0.0.11 //make it support neutron service [DEFAULT] ... network_api_class = nova.network.neutronv2.api.API security_group_api = neutron linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver firewall_driver = nova.virt.firewall.NoopFirewallDriver //vnc configuration [vnc] ... vncserver_listen = $my_ip vncserver_proxyclient_address = $my_ip [glance] ... host = controller [oslo_concurrency] ... lock_path = /var/lib/nova/tmp //disable the EC2 API: [DEFAULT] ... enabled_apis=osapi_compute,metadata
Sync Nova database
su -s /bin/sh -c "nova-manage db sync" nova
Set up automatic startup/start service at boot
systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl start openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
The following is to
install
yum install openstack-nova-compute sysfsutils
vim /etc/nova/nova.conf
[DEFAULT] ... rpc_backend = rabbit [oslo_messaging_rabbit] ... rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [DEFAULT] ... auth_strategy = keystone [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 auth_plugin = password project_domain_id = default user_domain_id = default project_name = service username = nova password = NOVA_PASS [DEFAULT] ... my_ip = MANAGEMENT_INTERFACE_IP_ADDRESS [DEFAULT] ... network_api_class = nova.network.neutronv2.api.API security_group_api = neutron linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver firewall_driver = nova.virt.firewall.NoopFirewallDriver [vnc] ... enabled = True vncserver_listen = 0.0.0.0 vncserver_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080/vnc_auto.html [glance] ... host = controller [oslo_concurrency] ... lock_path = /var/lib/nova/tmp
Determine whether this virtual machine supports kvm, 0: not supported, >=1 supported
egrep -c '(vmx|svm)' /proc/cpuinfo
vim /etc/nova/nova.conf
[libvirt] ... virt_type = qemu //If kvm is not supported, use qemu
start the service
systemctl enable libvirtd.service openstack-nova-compute.service systemctl start libvirtd.service openstack-nova-compute.service
The error encountered:
AMQP server on controller: 5672 is unreachable
Solution: Check that the port 5672 of the controller node is not up, 5672 is the port of rabbitmq. The reason for the check is that the controller node forgot to install rabbitmq, because Nova needs to use the service
AMQP server on controller: 5672 is unreachable
. Although the service is enabled, it has no permission to access. The
solution is to grant permissions.
rabbitmqctl add_user openstack zouhuiying rabbitmqctl set_permissions openstack ".*" ".*" ".*"