安装OpenStack计算服务(nova)

1. 配置数据库 数据库安装在控制节(controller)点上
$ mysql -u root -p

2.创建 glance 数据库
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123456';

3. 切换到管理员身份
# source admin-openrc.sh
(我的admin-openrc.sh存在/etc/keystone目录下)


4.创建 nova 用户:(123456为密码)
$ keystone user-create --name nova --pass 123456


5.为nova用户添加admin角色:
keystone user-role-add --user nova --tenant service --role admin

6.创建 nova 服务实体:
keystone service-create --name nova --type compute --description "OpenStack Compute"


7.创建计算服务API端点:
keystone endpoint-create --service-id $(keystone service-list | awk '/ compute / {print $2}') --publicurl http://controller:8774/v2/%\(tenant_id\)s --internalurl http://controller:8774/v2/%\(tenant_id\)s --adminurl http://controller:8774/v2/%\(tenant_id\)s --region regionOne


8.安装相关包
apt-get install nova-api nova-cert nova-conductor nova-consoleauth nova-novncproxy nova-scheduler python-novaclient

9.编辑 /etc/nova/nova.conf 加入下面的内容
[database]connection = mysql://nova:123456@10.0.0.11/nova[DEFAULT]rpc_backend = rabbitrabbit_host = controllerrabbit_password = 123456auth_strategy = keystone#这个IP应该是管理网段的IPmy_ip = 10.0.0.11vncserver_listen = 10.0.0.11vncserver_proxyclient_address = 10.0.0.11verbose = True[keystone_authtoken]auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = novaadmin_password = 123456[glance]host = controller

10.装载计算服务数据库:
su -s /bin/sh -c "nova-manage db sync" nova

11.重启计算服务
# service nova-api restart# service nova-cert restart# service nova-consoleauth restart# service nova-scheduler restart# service nova-conductor restart# service nova-novncproxy restart

安装配置计算节点(Compute1)
 12.安装包:
# apt-get install nova-compute sysfsutils

13.编辑 /etc/nova/nova.conf 加入下面的内容
[DEFAULT]
...
rpc_backend = rabbit
rabbit_host = controller
rabbit_password = openstack
auth_strategy = keystone
my_ip = 10.0.0.31

vnc_enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = 10.0.0.31
novncproxy_base_url = http://10.0.0.11:6080/vnc_auto.html

verbose = True

[keystone_authtoken]
...
auth_uri = http://10.0.0.11:5000/v2.0
identity_uri = http://10.0.0.11:35357
admin_tenant_name = service
admin_user = nova
admin_password =123456

[glance]
...
host = controller

14.看看这个节点支不支持硬件虚拟化
# egrep -c '(vmx|svm)' /proc/cpuinfo
如果返回的结果是0,那你就需要编辑/etc/nova/nova-compute.conf这个文件,把virt_type改成qemu:
[libvirt]...virt_type = qemu

15.重启计算服务
# service nova-compute restart

 验证安装
16. 切换为管理员
$ source admin-openrc.sh

17.列出所有的服务组件
$ nova service-list
(验证出错,发现ntp时钟配置有问题,改正后就验证成功)

18.列出所有映像
$ nova image-list

可能遇到的错误及解决方法:



posted @ 2017-07-05 11:50  scujcc_钟LS  阅读(299)  评论(0编辑  收藏  举报