热门标签 | 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


推荐阅读
  • 探讨HTML中的DIV样式难题
    本文深入分析了HTML中常见的DIV样式问题,并提供了有效的解决策略。适合所有对Web前端开发感兴趣的读者。 ... [详细]
  • PHP 中 preg_match 函数的 isU 修饰符详解
    本文详细解析 PHP 中 preg_match 函数中 isU 修饰符的具体含义及其应用场景,帮助开发者更好地理解和使用正则表达式。 ... [详细]
  • iTOP4412开发板QtE5.7源码编译指南
    本文详细介绍了如何在iTOP4412开发板上编译QtE5.7源码,包括所需文件的位置、编译器设置、触摸库编译以及QtE5.7的完整编译流程。 ... [详细]
  • 使用JS、HTML5和C3创建自定义弹出窗口
    本文介绍如何结合JavaScript、HTML5和C3.js来实现一个功能丰富的自定义弹出窗口。通过具体的代码示例,详细讲解了实现过程中的关键步骤和技术要点。 ... [详细]
  • 推荐几款高效测量图片像素的工具
    本文介绍了几款适用于Web前端开发的工具,这些工具可以帮助用户在图片上绘制线条并精确测量其像素长度。对于需要进行图像处理或设计工作的开发者来说非常实用。 ... [详细]
  • 配置PHPStudy环境并使用DVWA进行Web安全测试
    本文详细介绍了如何在PHPStudy环境下配置DVWA( Damn Vulnerable Web Application ),并利用该平台进行SQL注入和XSS攻击的练习。通过此过程,读者可以熟悉常见的Web漏洞及其利用方法。 ... [详细]
  • docker镜像重启_docker怎么启动镜像dock ... [详细]
  • MySQL Debug 模式的实现与应用
    本文详细介绍了如何启用和使用 MySQL 的调试模式,包括编译选项、环境变量配置以及调试信息的解析。通过实际案例展示了如何利用调试模式解决客户端无法连接服务器的问题。 ... [详细]
  • 本文详细介绍如何通过设置SSH密钥来获取连接GitHub远程仓库的权限,包括生成密钥、添加到GitHub账户以及验证连接等步骤。 ... [详细]
  • 最新计算机专业原创毕业设计参考选题都有源码+数据库是近期作品ling取参考你的选题刚好在下面有,有时间看到机会给您发1ssm资源循环利用2springboot校园考勤系统3ssm防 ... [详细]
  • 随着技术社区的发展,越来越多的技术爱好者选择通过撰写博客来分享自己的学习经验和项目进展。本文将介绍一个具体案例,即将一套原本运行于Windows平台的代码成功移植到Linux(Redhat)环境下的过程与挑战。 ... [详细]
  • Windows 环境下安装 Git 并连接 GitHub 的详细步骤
    本文详细介绍了如何在 Windows 系统中安装 Git 工具,并通过配置 SSH 密钥实现与 GitHub 的安全连接。包括下载、安装、环境配置及验证连接等关键步骤。 ... [详细]
  • 深入分析十大PHP开发框架
    随着PHP技术的发展,各类开发框架层出不穷,成为了开发者们热议的话题。本文将详细介绍并对比十款主流的PHP开发框架,旨在帮助开发者根据自身需求选择最合适的工具。 ... [详细]
  • Django xAdmin 使用指南(第一部分)
    本文介绍如何在Django项目中集成和使用xAdmin,这是一个增强版的管理界面,提供了比Django默认admin更多的功能。文中详细描述了集成步骤及配置方法。 ... [详细]
  • CSS高级技巧:动态高亮当前页面导航
    本文介绍了如何使用CSS实现网站导航栏中当前页面的高亮显示,提升用户体验。通过为每个页面的body元素添加特定ID,并结合导航项的类名,可以轻松实现这一功能。 ... [详细]
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社区 版权所有