openstack安装--nova

在controller节点操作

创建Nova数据库
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


添加环境变量(临时加的环境变量,只在当前的窗口有效)
source admin-openrc.sh


创建Nova用户
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

安装相关的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
消息队列的配置
[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 = 10.0.0.11

//使其支持neutron服务
[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配置
[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


同步Nova数据库
su -s /bin/sh -c "nova-manage db sync" nova


设置开机自动启动/启动服务
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



以下是在compute节点安装
安装openstack-nova-compute服务
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



判断本台虚拟机是否支持kvm,0:不支持,>=1支持

egrep -c '(vmx|svm)' /proc/cpuinfo


vim /etc/nova/nova.conf
[libvirt]
...
virt_type = qemu //不支持kvm的要用qemu


启动服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service



遇到的错误:
AMQP server on controller:5672 is unreachable
解决办法:查看controller节点的5672端口没起来,5672是rabbitmq的端口。检查原因是controller节点忘记装了rabbitmq,因为Nova要用到该服务
AMQP server on controller:5672 is unreachable
该服务虽然开启但是没有权限访问
解决办法赋予权限
rabbitmqctl add_user openstack zouhuiying
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

猜你喜欢

转载自zouhuiying.iteye.com/blog/2321690