热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Ubuntu12.04系统部署Openstack教程

OpenstackInstallationandConfiguration准备环境OS:Ubuntu12.0464位安装系统时安装ssh、dns更改系统时间:ntpdateip或一个时间域名hwclock-w防火墙:ufwdisable更改系统支持语言/etc/default/localerebootOpenstack

Openstack Installation and Configuration

准备环境

OS:Ubuntu12.04 64位
安装系统时安装ssh、dns
更改系统时间:ntpdate ip或一个时间域名      hwclock -w
防火墙:ufw disable
更改系统支持语言  /etc/default/locale  reboot

Openstack install start
#Update the machine using the following commands
sudo apt-get update
sudo apt-get upgrade

#Install bridge-utils
sudo apt-get install bridge-utils

#Network Configuration
#The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.97
netmask 255.255.255.0
gateway 192.168.3.1

# Bridge network interface for VM networks
auto br100
iface br100 inet static
address 192.168.100.1
netmask 255.255.255.0
bridge_stp off
bridge_fd 0

brctl addbr br100
/etc/init.d/networking restart

#NTP Server
apt-get install ntp
vi  /etc/ntp.conf
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
service ntp restart

#Mysql
apt-get install mysql-server python-mysqldb
#Create the root password for mysql. The password used in this guide is “password”
vi  /etc/mysql/my.cnf
bind-address = 0.0.0.0
service mysql restart

#Creating Databases
#about nova databases
mysql -uroot -ppassword -e ‘CREATE DATABASE nova;’
mysql -uroot -ppassword -e ‘CREATE USER nova;’
mysql -uroot -ppassword -e “GRANT ALL PRIVILEGES ON nova.* TO ‘nova’@'%’;”
mysql -uroot -ppassword -e “SET PASSWORD FOR ‘nova’@'%’ =PASSWORD(‘password’);”
#about glance databases
mysql -uroot -ppassword -e ‘CREATE DATABASE glance;’
mysql -uroot -ppassword -e ‘CREATE USER glance;’
mysql -uroot -ppassword -e “GRANT ALL PRIVILEGES ON glance.* TO ‘glance’@'%’;”
mysql -uroot -ppassword -e “SET PASSWORD FOR ‘glance’@'%’ =PASSWORD(‘password’);”
#about keystone databases
mysql -uroot -ppassword -e ‘CREATE DATABASE keystone;’
mysql -uroot -ppassword -e ‘CREATE USER keystone;’
mysql -uroot -ppassword -e “GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone’@'%’;”
mysql -uroot -ppassword -e “SET PASSWORD FOR ‘keystone’@'%’ =PASSWORD(‘password’);”

#Keystone
apt-get install keystone python-keystone python-keystoneclient
vi  /etc/keystone/keystone.conf
admin_token = admin
cOnnection= mysql://keystone:password@192.168.3.97/keystone
service keystone restart
keystone-manage db_sync
export SERVICE_ENDPOINT=”http://localhost:35357/v2.0″
export SERVICE_TOKEN=admin

source /etc/profile
/root/.bashrc

#Creating Tenants
keystone tenant-create ?name admin
+————-+———————————-+
|   Property  |              Value               |
+————-+———————————-+
| description | None                             |
| enabled     | True                             |
| id          | 71afa7f265a043baaf35c94c526f6fe6 |
| name        | admin                            |
+————-+———————————-+
keystone tenant-create ?name service
+————-+———————————-+
|   Property  |              Value               |
+————-+———————————-+
| description | None                             |
| enabled     | True                             |
| id          | 9b154b36eba44e6faa243cbe31cd505e |
| name        | service                          |
+————-+———————————-+

#create users
keystone user-create ?name admin ?pass admin ?email admin@foobar.com
keystone user-create ?name nova ?pass nova ?email nova@foobar.com
keystone user-create ?name glance ?pass glance ?email glance@foobar.com
keystone user-create ?name swift ?pass swift ?email swift@foobar.com
输出如下
root@oak-controller:~# keystone user-create ?name admin ?pass admin ?email admin@foobar.com
+———-+————————————————————————————————————————-+
| Property |                                                          Value                                                          |
+———-+————————————————————————————————————————-+
| email    | admin@foobar.com                                                                                                        |
| enabled  | True                                                                                                                    |
| id       | e7865fd421764554a15418467d530d9f                                                                                        |
| name     | admin                                                                                                                   |
| password | $6$rounds=40000$Tl1Ll7lr2A7PKV2w$Jf4VNEPGpIQg2xefYHTCU1Ou4eKpvTpVtdbJ8q2WJ426hdS2onr4YQcdkGJOvyVtR6tA3KN.TiL57Rdlo.B2M1 |
| tenantId | None                                                                                                                    |
+———-+————————————————————————————————————————-+
root@oak-controller:~# keystone user-create ?name nova ?pass nova ?email nova@foobar.com
+———-+————————————————————————————————————————-+
| Property |                                                          Value                                                          |
+———-+————————————————————————————————————————-+
| email    | nova@foobar.com                                                                                                         |
| enabled  | True                                                                                                                    |
| id       | 16b969fb9f3a470581141d601e61beeb                                                                                        |
| name     | nova                                                                                                                    |
| password | $6$rounds=40000$2hIzWJsygWb9ebna$TtXRFGcGsBoJSE9rO1R5Dg9o27EGwvK7LDZuNVSsA.vVgcriyXkBzqIrfm8pF3qNfgaImbvxqdBNtWYbbejpt. |
| tenantId | None                                                                                                                    |
+———-+————————————————————————————————————————-+
root@oak-controller:~# keystone user-create ?name glance ?pass glance ?email glance@foobar.com
+———-+————————————————————————————————————————-+
| Property |                                                          Value                                                          |
+———-+————————————————————————————————————————-+
| email    | glance@foobar.com                                                                                                       |
| enabled  | True                                                                                                                    |
| id       | 0846f49915e34af2b2711daa2276600b                                                                                        |
| name     | glance                                                                                                                  |
| password | $6$rounds=40000$9n/XT3tA4Va/Yw5q$A9YHhm5.A4I5sf8o55FZHZinRoNPfb/7jNpEYpizG2Pfa3r97faysrGePtXaaaST46CrTaJWbUCCG49wBjt6n1 |
| tenantId | None                                                                                                                    |
+———-+————————————————————————————————————————-+
root@oak-controller:~# keystone user-create ?name swift ?pass swift ?email swift@foobar.com
+———-+————————————————————————————————————————-+
| Property |                                                          Value                                                          |
+———-+————————————————————————————————————————-+
| email    | swift@foobar.com                                                                                                        |
| enabled  | True                                                                                                                    |
| id       | 89d985c3654a49edbbaf098b044d4d97                                                                                        |
| name     | swift                                                                                                                   |
| password | $6$rounds=40000$1S5h0kE6JpNxx73b$.Nf8wwfRO3/UFI58WAo77ASdp93vtEiyrWyL160prVWyPnp5VMlUnNaJKLyxnahagxBXX87Y4KbhfvWU87E2d0 |
| tenantId | None                                                                                                                    |
+———-+————————————————————————————————————————-+

# Creating Roles
keystone role-create ?name admin
keystone role-create ?name Member
输出如下:
root@oak-controller:~# keystone role-create ?name admin
+———-+———————————-+
| Property |              Value               |
+———-+———————————-+
| id       | 54f31e5da56e4c26ad4febce9ff7b017 |
| name     | admin                            |
+———-+———————————-+
root@oak-controller:~# keystone role-create ?name Member
+———-+———————————-+
| Property |              Value               |
+———-+———————————-+
| id       | 6d763be492464f9396bbaf02fbfff753 |
| name     | Member                           |
+———-+———————————-+

#Listing Tenants, Users and Roles
root@oak-controller:~# keystone tenant-list
+———————————-+———+———+
|                id                |   name  | enabled |
+———————————-+———+———+
| 71afa7f265a043baaf35c94c526f6fe6 | admin   | True    |
| 9b154b36eba44e6faa243cbe31cd505e | service | True    |
+———————————-+———+———+
root@oak-controller:~# keystone user-list
+———————————-+———+——————-+——?+
|                id                | enabled |       email       |  name  |
+———————————-+———+——————-+——?+
| 0846f49915e34af2b2711daa2276600b | True    | glance@foobar.com | glance |
| 16b969fb9f3a470581141d601e61beeb | True    | nova@foobar.com   | nova   |
| 89d985c3654a49edbbaf098b044d4d97 | True    | swift@foobar.com  | swift  |
| e7865fd421764554a15418467d530d9f | True    | admin@foobar.com  | admin  |
+———————————-+———+——————-+——?+
root@oak-controller:~# keystone role-list
+———————————-+——?+
|                id                |  name  |
+———————————-+——?+
| 54f31e5da56e4c26ad4febce9ff7b017 | admin  |
| 6d763be492464f9396bbaf02fbfff753 | Member |
+———————————-+——?+

#command example
keystone user-role-add ?user $USER_ID ?role $ROLE_ID ?tenant_id $TENANT_ID

#To add a role of ‘admin’ to the user ‘admin’ of the tenant ‘admin’
keystone user-role-add ?user e7865fd421764554a15418467d530d9f ?role 54f31e5da56e4c26ad4febce9ff7b017 ?tenant_id 71afa7f265a043baaf35c94c526f6fe6

#The following commands will add a role of ‘admin’ to the users ‘nova’, ‘glance’ and ‘swift’ of the tenant ‘service’.
keystone user-role-add ?user 0846f49915e34af2b2711daa2276600b ?role 54f31e5da56e4c26ad4febce9ff7b017 ?tenant_id 9b154b36eba44e6faa243cbe31cd505e
keystone user-role-add ?user 16b969fb9f3a470581141d601e61beeb ?role 54f31e5da56e4c26ad4febce9ff7b017 ?tenant_id 9b154b36eba44e6faa243cbe31cd505e
keystone user-role-add ?user 89d985c3654a49edbbaf098b044d4d97 ?role 54f31e5da56e4c26ad4febce9ff7b017 ?tenant_id 9b154b36eba44e6faa243cbe31cd505e

#add a role ‘Member’ to user ‘admin’ of tenant ‘admin’
keystone user-role-add ?user e7865fd421764554a15418467d530d9f ?role 6d763be492464f9396bbaf02fbfff753 ?tenant_id 71afa7f265a043baaf35c94c526f6fe6

# Creating Services
#command example
keystone service-create ?name service_name ?type service_type ?description ‘Description of the service’

keystone service-create ?name nova ?type compute ?description ‘OpenStack Compute Service’
keystone service-create ?name volume ?type volume ?description ‘OpenStack Volume Service’
keystone service-create ?name glance ?type image ?description ‘OpenStack Image Service’
keystone service-create ?name swift ?type object-store ?description ‘OpenStack Storage Service’
keystone service-create ?name keystone ?type identity ?description ‘OpenStack Identity Service’
keystone service-create ?name ec2 ?type ec2 ?description ‘EC2 Service’

keystone service-list
root@oak-controller:~# keystone service-list
+———————————-+———-+————?+—————————-+
|                id                |   name   |     type     |        description         |
+———————————-+———-+————?+—————————-+
| 368283bcbbf2488d94c8e8f8f6899ee4 | keystone | identity     | OpenStack Identity Service |
| 50ab784afa0e4583ad78578d089678e9 | swift    | object-store | OpenStack Storage Service  |
| 63b3a3c91869439cabfc2fdd9a793dde | volume   | volume       | OpenStack Volume Service   |
| b07ac3f65cb34bbe97d717be3f60c45a | glance   | image        | OpenStack Image Service    |
| dcf501c58c314e06a99b3639782d5cee | ec2      | ec2          | EC2 Service                |
| e828bd8bc67b490eaa10911168f82c3b | nova     | compute      | OpenStack Compute Service  |
+———————————-+———-+————?+—————————-+

#Creating Endpoints
example:keystone endpoint-create ?region region_name ?service_id service_id ?publicurl public_url ?adminurl admin_url  ?internalurl internal_url

#nova-compute
keystone endpoint-create ?region myregion ?service_id e828bd8bc67b490eaa10911168f82c3b ?publicurl ‘http://192.168.3.97:8774/v2/$(tenant_id)s’ ?adminurl ‘http://192.168.3.97:8774/v2/$(tenant_id)s’ ?internalurl ‘http://192.168.3.97:8774/v2/$(tenant_id)s’
#nova-volume
keystone endpoint-create ?region myregion ?service_id 63b3a3c91869439cabfc2fdd9a793dde ?publicurl ‘http://192.168.3.97:8776/v1/$(tenant_id)s’ ?adminurl ‘http://192.168.3.97:8776/v1/$(tenant_id)s’ ?internalurl ‘http://192.168.3.97:8776/v1/$(tenant_id)s’
#glance
keystone endpoint-create ?region myregion ?service_id b07ac3f65cb34bbe97d717be3f60c45a ?publicurl ‘http://192.168.3.97:9292/v1′ ?adminurl ‘http://192.168.3.97:9292/v1′ ?internalurl ‘http://192.168.3.97:9292/v1′
#swift
keystone endpoint-create ?region myregion ?service_id 50ab784afa0e4583ad78578d089678e9 ?publicurl ‘http://192.168.3.97:8080/v1/AUTH_$(tenant_id)s’ ?adminurl ‘http://192.168.3.97:8080/v1′ ?internalurl ‘http://192.168.3.97:8080/v1/AUTH_$(tenant_id)s’
#keystone
keystone endpoint-create ?region myregion ?service_id 368283bcbbf2488d94c8e8f8f6899ee4 ?publicurl http://192.168.3.97:5000/v2.0 ?adminurl http://192.168.3.97:35357/v2.0 ?internalurl http://192.168.3.97:5000/v2.0
#ec2
keystone endpoint-create ?region myregion ?service_id dcf501c58c314e06a99b3639782d5cee ?publicurl http://192.168.3.97:8773/services/Cloud ?adminurl http://192.168.3.97:8773/services/Admin ?internalurl http://192.168.3.97:8773/services/Cloud

#Glance
apt-get install glance glance-api glance-client glance-common glance-registry python-glance
#Glance Configuration
vi /etc/glance/glance-api-paste.ini
admin_tenant_name = service
admin_user = glance
admin_password = glance

vi /etc/glance/glance-registry-paste.ini
admin_tenant_name = service
admin_user = glance
admin_password = glance

vi /etc/glance/glance-registry.conf
sql_cOnnection= mysql://glance:password@192.168.3.97/glance
[paste_deploy]
flavor = keystone

vi /etc/glance/glance-api.conf
[paste_deploy]
flavor = keystone

glance-manage version_control 0
glance-manage db_sync

restart glance-api
restart glance-registry

export SERVICE_TOKEN=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL=”http://localhost:5000/v2.0/”
export SERVICE_ENDPOINT=http://localhost:35357/v2.0

source .bashrc

glance index
echo$?

###Nova
apt-get install nova-api nova-cert nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume rabbitmq-server novnc nova-consoleauth
vi /etc/nova/nova.conf
?dhcpbridge_flagfile=/etc/nova/nova.conf
?dhcpbridge=/usr/bin/nova-dhcpbridge
?logdir=/var/log/nova
?state_path=/var/lib/nova
?lock_path=/run/lock/nova
?allow_admin_api=true
?use_deprecated_auth=false
?auth_strategy=keystone
?scheduler_driver=nova.scheduler.simple.SimpleScheduler
?s3_host=192.168.3.97
?ec2_host=192.168.3.97
?rabbit_host=192.168.3.97
?cc_host=192.168.3.97
?nova_url=http://192.168.3.97:8774/v1.1/
?routing_source_ip=192.168.3.97
?glance_api_servers=192.168.3.97:9292
?image_service=nova.image.glance.GlanceImageService
?iscsi_ip_prefix=192.168.100
?sql_cOnnection=mysql://nova:password@192.168.3.97/nova
?ec2_url=http://192.168.3.97:8773/services/Cloud
?keystone_ec2_url=http://192.168.3.97:5000/v2.0/ec2tokens
?api_paste_cOnfig=/etc/nova/api-paste.ini
?libvirt_type=kvm
?libvirt_use_virtio_for_bridges=true
?start_guests_on_host_boot=true
?resume_guests_state_on_host_boot=true
# vnc specific configuration
?novnc_enabled=true
?novncproxy_base_url=http://192.168.3.97:6080/vnc_auto.html
?vncserver_proxyclient_address=192.168.3.97
?vncserver_listen=192.168.3.97
# network specific settings
?network_manager=nova.network.manager.FlatDHCPManager
?public_interface=eth0
?flat_interface=eth0
?flat_network_bridge=br100
?fixed_range=192.168.100.1/24
#JJZ>>>>>> fixed_range defines the internal network used by VM, change to 192.168.100.1/24
?floating_range=192.168.3.129/25
#JJZ>>>>>> floating_range defines the external network used by VM, change to 192.168.3.129/25
?network_size=256
#JJZ>>>>> network_size define the network size of internal network, change to 256
?flat_network_dhcp_start=192.168.100.2
?flat_injected=False
?force_dhcp_release
?iscsi_helper=tgtadm
?connection_type=libvirt
?root_helper=sudo nova-rootwrap
?verbose

root@oak-controller:~# pvcreate /dev/sda4
Physical volume “/dev/sda4″ successfully created
root@oak-controller:~# vgcreate nova-volumes /dev/sda4
Volume group “nova-volumes” successfully created

chown -R nova:nova /etc/nova
chmod 644 /etc/nova/nova.conf
vi /etc/nova/api-paste.ini
admin_tenant_name = service
admin_user = nova
admin_password = nova

nova-manage db sync
nova-manage network create private ?fixed_range_v4=192.168.100.0/24 ?num_networks=1 ?bridge=br100 ?bridge_interface=eth0 ?network_size=256

nova-manage floating create ?ip_range=192.168.3.128/25从新在执行下地址poor 取决于我nova.conf 的配置定义

export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL=”http://localhost:5000/v2.0/”

service libvirt-bin restart
service nova-network restart
service nova-api restart
service nova-objectstore restart
service nova-scheduler restart
service nova-consoleauth restart
service nova-cert restart
service nova-volume restart
service nova-compute restart

root@oak-controller:~# nova-manage service list
2012-07-26 14:37:28 DEBUG nova.utils [req-8d4b9794-c2bb-4e35-b3a0-d1f9796c784e None None] backend from (pid=25877) __get_backend /usr/lib/python2.7/dist-packages/nova/utils.py:658
Binary           Host                                 Zone             Status     State Updated_At
nova-network     oak-controller                       nova             enabled    :-)    2012-07-26 06:37:25
nova-compute     oak-controller                       nova             enabled    :-)    2012-07-26 06:37:25
nova-scheduler   oak-controller                       nova             enabled    :-)    2012-07-26 06:37:18
nova-consoleauth oak-controller                       nova             enabled    :-)    2012-07-26 06:37:22
nova-cert        oak-controller                       nova             enabled    :-)    2012-07-26 06:37:20

apt-get install git-core
apt-get install -y memcached libapache2-mod-wsgi openstack-dashboard
#create database dash
mysql -uroot -ppassword -e ‘CREATE DATABASE dash;’
mysql -uroot -ppassword -e ‘CREATE USER dash;’
mysql -uroot -ppassword -e “GRANT ALL PRIVILEGES ON dash.* TO ‘dash’@'%’;”
mysql -uroot -ppassword -e “SET PASSWORD FOR ‘dash’@'%’ =PASSWORD(‘password’);”
vi /etc/openstack-dashboard/local_settings.py
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘dash’,
‘USER’: ‘dash’,
‘PASSWORD’: ‘password’,
‘HOST’: ’192.168.3.97′,
‘default-character-set’: ‘utf8′
},
}

/usr/share/openstack-dashboard/manage.py syncdb
mkdir -p /var/lib/dash/.blackhole
/etc/init.d/apache2 restart
restart nova-api


推荐阅读
  • PHP 5.2.5 安装与配置指南
    本文详细介绍了 PHP 5.2.5 的安装和配置步骤,帮助开发者解决常见的环境配置问题,特别是上传图片时遇到的错误。通过本教程,您可以顺利搭建并优化 PHP 运行环境。 ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 本文深入探讨 MyBatis 中动态 SQL 的使用方法,包括 if/where、trim 自定义字符串截取规则、choose 分支选择、封装查询和修改条件的 where/set 标签、批量处理的 foreach 标签以及内置参数和 bind 的用法。 ... [详细]
  • 本文详细介绍了如何通过多种编程语言(如PHP、JSP)实现网站与MySQL数据库的连接,包括创建数据库、表的基本操作,以及数据的读取和写入方法。 ... [详细]
  • 网络运维工程师负责确保企业IT基础设施的稳定运行,保障业务连续性和数据安全。他们需要具备多种技能,包括搭建和维护网络环境、监控系统性能、处理突发事件等。本文将探讨网络运维工程师的职业前景及其平均薪酬水平。 ... [详细]
  • 本文介绍如何通过SSH协议使用Xshell远程连接到Ubuntu系统。为了实现这一目标,需要确保Ubuntu系统已安装并配置好SSH服务器,并保证网络连通性。 ... [详细]
  • 自己用过的一些比较有用的css3新属性【HTML】
    web前端|html教程自己用过的一些比较用的css3新属性web前端-html教程css3刚推出不久,虽然大多数的css3属性在很多流行的浏览器中不支持,但我个人觉得还是要尽量开 ... [详细]
  • 云计算的优势与应用场景
    本文详细探讨了云计算为企业和个人带来的多种优势,包括成本节约、安全性提升、灵活性增强等。同时介绍了云计算的五大核心特点,并结合实际案例进行分析。 ... [详细]
  • 嵌入式开发环境搭建与文件传输指南
    本文详细介绍了如何为嵌入式应用开发搭建必要的软硬件环境,并提供了通过串口和网线两种方式将文件传输到开发板的具体步骤。适合Linux开发初学者参考。 ... [详细]
  • 使用JS、HTML5和C3创建自定义弹出窗口
    本文介绍如何结合JavaScript、HTML5和C3.js来实现一个功能丰富的自定义弹出窗口。通过具体的代码示例,详细讲解了实现过程中的关键步骤和技术要点。 ... [详细]
  • docker镜像重启_docker怎么启动镜像dock ... [详细]
  • 在寻找轻量级Ruby Web框架的过程中,您可能会遇到Sinatra和Ramaze。两者都以简洁、轻便著称,但它们之间存在一些关键区别。本文将探讨这些差异,并提供详细的分析,帮助您做出最佳选择。 ... [详细]
  • 本文详细介绍如何通过设置SSH密钥来获取连接GitHub远程仓库的权限,包括生成密钥、添加到GitHub账户以及验证连接等步骤。 ... [详细]
  • 本文详细记录了在基于Debian的Deepin 20操作系统上安装MySQL 5.7的具体步骤,包括软件包的选择、依赖项的处理及远程访问权限的配置。 ... [详细]
  • 在Ubuntu 16.04 LTS上配置Qt Creator开发环境
    本文详细介绍了如何在Ubuntu 16.04 LTS系统中安装和配置Qt Creator,涵盖了从下载到安装的全过程,并提供了常见问题的解决方案。 ... [详细]
author-avatar
lrg冰天雪地789_444
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有