openstack 手动部署

1. 必要的服务

keystone,nova,cinder,glance,neutron,horizon

2.硬件设计

节点:1个,virtualBox虚拟机:Linux version 3.16.0-23-generic,Ubuntu 14.10

网络:1个,一般的环境都有一个外部网络,一个内网,或者是管理网和存储网

3.步骤

参考:https://www.lylinux.org/ubuntu-12-04%E4%B8%AD%E5%8D%95%E7%BD%91%E5%8D%A1%E9%83%A8%E7%BD%B2openstack.html

①准备

apt-get install bridge-utils

备注:网桥是一种软件配置,用于连结两个或更多个不同网段。bridge-utils 软件包里面的 brctl 工具管理网桥. brctl show 可以看到所有的网桥和连接到网桥的接口。

apt-get install ntp

编辑 /etc/ntp.conf 在末尾添加下面3行,一个节点应该不需要安装ntp吧?

server ntp.ubuntu.com iburst
server 127.127.1.0  # 預設的一個內部時鐘資料,用在沒有外部 NTP 伺服器時
fudge 127.127.1.0 stratum 10
/etc/init.d/ntp restart

apt-get install tgt

/etc/init.d/tgt start

apt-get install rabbitmq-server memcached python-memcache

apt-get install kvm libvirt-bin

apt-get install -y mysql-server python-mysqldb

②创建相关数据库

nova数据库, 管理员:novadbadmin,密码是:dieD9Mie
glance数据库,管理员:glancedbadmin,密码是:ohC3teiv
keystone数据库,管理员:keystone,密码是:openstack
mysql -uroot -p
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%' IDENTIFIED BY 'dieD9Mie';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%' IDENTIFIED BY 'ohC3teiv';
create database keystone;
grant all on keystone.* to 'keystone'@'%' identified by 'openstack';
quit

③安装和配置keystone

apt-get install keystone python-keystone python-keystoneclient
修改/etc/keystone/keystone.conf
admin_token = ADMIN # 这个值可以不改,不过要记住
[sql]
connection = mysql://keystone:openstack@localhost/keystone  # 根据自己的环境修改

重启服务 service keystone restart

keystone-manage db_sync  数据库迁移

导入数据:

wget http://www.chenshake.com/wp-content/uploads/2012/07/keystone_data.sh_.txt
mv keystone_data.sh_.txt keystone_data.sh
chmod +x keystone_data.sh  # 修改service_token 和service_endpoint
./keystone_data.sh

keystone的api需要token认证,我们制作一个文件 vi /root/keystone_admin

export SERVICE_TOKEN="hastexo" # 我进行了修改
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"


另一种方法,每次去获得token,修改/root/keystone_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=admin123
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://localhost:35357/v2.0

④安装和配置glance

apt-get install glance glance-api python-glanceclient glance-common glance-registry python-glance
配置/etc/glance/glance-api-paste.ini
admin_tenant_name = %SERVICE_TENANT_NAME% service
admin_user = %SERVICE_USER% glance
admin_password = %SERVICE_PASSWORD% admin
[paste_deploy]
flavor = keystone
配置/etc/glance/glance-registry.conf
admin_tenant_name = %SERVICE_TENANT_NAME%
admin_user = %SERVICE_USER%
admin_password = %SERVICE_PASSWORD%
[paste_deploy]
flavor = keystone
[database]
connection = mysql://glancedbadmin:ohC3teiv@localhost/glance
向keystone注册服务和endpoint
keystone service-create --name=glance --type=image --description="Glance Image Service"
keystone endpoint-create --service_id 2e1db83bf3c34bfe912547c68f282e3f --region RegionOne --publicurl http://localhost:9292/v1 --adminurl http://localhost:9292/v1 --internalurl http://localhost:9292/v1
测试

下载镜像 wget -P /data/images http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-i386-disk.img
上传镜像 
glance image-create --name "cirros-0.3.5" --file /data/images/cirros-0.3.5-i386-disk.img \
--disk-format qcow2 --container-format bare --is-public True --progress


⑤安装和配置nova

参考:http://www.linuxidc.com/Linux/2012-09/70029.htm
http://blog.csdn.net/celeste7777/article/details/49849163
apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume python-nova python-novaclient nova-consoleauth python-novnc novnc
创建一个网桥 br100
brctl  show; brctl addbr br100; brctl addif br100 eth0
修改一下rabbit密码,因为忘记了...
rabbitmqctl change_password guest rabbit
修改/etc/nova/nova.conf
[DEFAULT]
# AUTHENTICATION
auth_strategy=keystone
rpc_backend=rabbit
rabbit_host=localhost
rabbit_userid=guest
rabbit_password=rabbit
my_ip=127.0.0.1
api_paste_config=/etc/nova/api-paste.ini
# DATABASE
sql_connection=mysql://novadbadmin:dieD9Mie@localhost/nova
#NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
# Location of flagfiles for dhcpbridge (multi valued)
dhcpbridge_flagfile=/etc/nova/nova.conf
# Interface for public IP addresses (string value)
public_interface=eth1
# Location of nova-dhcpbridae (string value)
dhcpbridge=/usr/bin/nova-dhcpbridge
# Bridge for simple network instances (string value)
flat_network_bridge=br100
# FlatDhcp will bridge into this interface if set (string value)
flat_interface=eth0
# Firewall driver (defaults to hypervisor specific iptables driver)(string value)
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
keys_path=/var/lib/nova/keys
lock_path=/var/lib/nova/tmp
images_path=/var/lib/nova/images
buckets_path=/var/lib/nova/buckets
instances_path=/var/lib/nova/instances
networks_path=/var/lib/nova/networks
[glance]
glance_api_servers=127.0.0.1:9292

[keystone_authtoken]
identity_uri=http://localhost:35357
admin_user=nova
admin_password=admin
admin_tenant_name=service
如果是在虚拟机上部署,nova-compute.conf 中virt_type=qemu
创建网络:nova-manage --debug network create --label private --fixed_range_v4=192.168.0.0/24 --num_networks 1 --network_size 255
keystone service-create --name=nova --type=compute --description="Compute Service"
keystone endpoint-create --service_id 6705be2bbe3a4d2195e63c4e813c76e9 --region RegionOne --publicurl http://localhost:8774/v2/%\(tenant_id\)s \ 
--adminurl http://localhost:8774/v2/%\(tenant_id\)s  --internalurl http://localhost:8774/v2/%\(tenant_id\)s
nova-manage floating create --ip_range=10.172.7.0/24

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值