X86单网卡Desktop源码安装Openstack 组件之Keystone、Glance、Nova
由于我的试验环境有限, 所以在本地的x86的电脑上单节点安装Openstack的基础组件, 而没有使用多Compute节点的方式来部署, 据说那也是挺挑战的, 等有闲置的机器我会去尝试一下。
电脑配置如下:
OS: Fedora 17
CPU: Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Memory: 4G
安装步骤如下:
1、到Github中下载各个组件的源码
Keystone >> https://github.com/openstack/keystone.git
keystoneClient >> https://github.com/openstack/python-keystoneclient.git
Nova >> https://github.com/openstack/nova.git
NovaClient >> https://github.com/openstack/python-novaclient.git
Glance >> https://github.com/openstack/glance.git
GlanceClient >> https://github.com/openstack/python-glanceclient.git
下载想要的版本,解压
以下假定都解压到/opt/openstack/ 下
2、安装Mysql、RabbitMq-Server(可选)或Qpid ,用于组件内的通信
mysql、rabbiqmq 均是通过yum安装的,也可以源码安装。
配置Rabbitmq
将以下两行添加至/etc/rabbitmq/rabbitmq.conf 以及/etc/rabbitmq/rabbitmq-env.conf
DENAME=rabbit@localhost
NODE_IP_ADDRESS=127.0.0.1
为rabbitmq设置guest的密码
rabbitmqctl change_password guest flopsymopsy
mysql设置root密码
mysqladmin -u root password 'nomoresecret'
mysql -u root -pnomoresecret
create database keystone;
create database glance;
create database nova;
添加网卡br100
vim /etc/networks
添加以下至/etc/networks中
auto br100
iface br100 inet static
address 10.0.0.0
netmask 255.255.255.0
gateway 10.0.0.1
bridge_ports wlan0
bridge_stp off
bridge_fd 0
增加一个桥接设备, 我们将它命名为br100
brctl addbr br100
/etc/init.d/networking restart
3、编译安装个组件
cd ~/nova
pip install -r tools/pip-requires
python setup.py install
cd ~keystone
pip install -r tools/pip-requires
python setup.py install
cd ~/glance
pip install -r tools/pip-requires
python setup.py install
如何安装正常的情况下,在每个组件下面有etc目录
将每个组件etc目录下的文件拷贝至/etc目录下
cd keystone/
cp -R etc/* /etc/
cd glance/
cp -R etc/* /etc/
cd nova/
cp -R etc/* /etc/
4、配置keystone
vim /etc/keystone/keystone.conf
设置admin的Token
[DEFAULT]
admin_token = 721457575107e4d57fe3
也可代码修改token的值 方法如下
export ADMIN_TOKEN=$(openssl rand -hex 10)
openstack-config --set /etc/keystone/keystone.conf DEFAULT \
admin_token $ADMIN_TOKEN
修改mysql链接,修改为之前设置的用户名密码
[sql]
connection = mysql://root:nomoresecret@localhost/keystone?charset=utf8
启动keystone服务
keystone-all --config-dir=/etc/keystone &
数据库中创建相应的数据表
keystone-manage db_sync
5、配置glance
vim /etc/glance-api.conf
sql_connection = mysql://root:nomoresecret@localhost/glance?charset=utf8
vim /etc/glance/glance-api-paste.ini
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
delay_auth_decision = true
admin_tenant_name = service
admin_user = glance
admin_password = supersecret
vim /etc/glance-registry.conf
[keystone_authtoken]
signing_dir = /var/cache/glance/registry
auth_uri = http://127.0.0.1:5000/
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = supersecret
[paste_deploy]
flavor = keystone
创建glance数据表
glance-manage db_sync
6、配置nova
vim /etc/nova/nova.conf
[DEFAULT]
verbose=True
auth_strategy=keystone
allow_resize_to_same_host=True
api_paste_config=/etc/nova/api-paste.ini
rootwrap_config=/etc/nova/rootwrap.conf
compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
dhcpbridge_flagfile=/etc/nova/nova.conf
force_dhcp_release=True
fixed_range=10.0.0.0/24
default_floating_pool=nova
s3_host=192.168.1.110
s3_port=3333
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
my_ip=192.168.1.110
sql_connection=mysql://root:nomoresecret@localhost/nova?charset=utf8
libvirt_type=kvm
libvirt_cpu_mode=none
instance_name_template=instance-%08x
enabled_apis=ec2,osapi_compute,metadata
volume_api_class=nova.volume.cinder.API
logdir = /var/log/nova
state_path=/opt/data/nova
lock_path=/opt/data/nova
instances_path=/opt/data/nova/instances
logging_context_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s%(color)s] %(instance)s%(color)s%(message)s
logging_default_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s
logging_debug_format_suffix=from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d
logging_exception_prefix=%(color)s%(asctime)s TRACE %(name)s %(instance)s
network_manager=nova.network.manager.FlatDHCPManager
public_interface=br100
vlan_interface=eth0
flat_network_bridge=br100
flat_interface=eth0
novncproxy_base_url=http://127.0.0.1:6080/vnc_auto.html
xvpvncproxy_base_url=http://127.0.0.1:6081/console
vncserver_listen=127.0.0.1
vncserver_proxyclient_address=127.0.0.1
ec2_dmz_host=192.168.1.110
rabbit_host=localhost
rabbit_password=flopsymopsy
glance_api_servers=127.0.0.1:9292
compute_driver=libvirt.LibvirtDriver
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
vim /etc/nova/api-paste.ini
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_host = 127.0.0.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = supersecret
signing_dir = /tmp/keystone-signing-nova
至此,openstack的三个基础单节点搭建成功,启动服务流程见这
然后剩下的就是启动各个服务,创建初始化数据,进行相关的操作了
安装中主要参考了以下文章
http://docs.openstack.org/folsom/openstack-compute/install/yum/content/compute-verifying-install.html
http://blog.csdn.net/ugyn109/article/details/7480057