openstack云基础架构

openstack搭建及基本配置

节点servera:
配置好yum后
yum -y update 更新yum仓库

安装openstack
yum -y install openstack-packstack
packstack --gen-answer-file=/root/answers.txt 将openstack的配置文件写到当前生成一个answer.txt自定名的文件

vim /root/answers.txt 修改answer.txt文件内的以下几条内容

 

enter description here

1.png

1、
CONFIG_NTP_SERVERS=172.25.254.254 67行
指定的连接的服务端

 

 

enter description here

2.png

1、
CONFIG_COMPUTE_HOSTS=172.25.0.10 89行
指定本机的IP地址

 

 

enter description here

3.png

1、
CONFIG_KEYSTONE_ADMIN_PW=redhat 246行
登陆admin用户的密码

 

 

enter description here

4.png

1、
CONFIG_CINDER_VOLUMES_CREATE=n 282行
关掉cinder volume

 

 

enter description here

5.png

1、
CONFIG_NEUTRON_OVS_TUNNEL_IF=eth1 554行行
指定默认的网卡接口名称

 

 

enter description here

5a.png

1、
CONFIG_HORIZON_SSL=y 560行行行
开启ssl服务

 

 

enter description here

6.png

1、
CONFIG_SWIFT_INSTALL=y 39行
开启swift服务

 

 

enter description here

7.png

1、
CONFIG_PROVISION_DEMO=n 629行
不用demo

 

 

enter description here

8.png

1、
packstack --answer-file /root/answers.txt 将写好的文件配置openstack

 

 

enter description here

9.png

配置后的信息

 

 

enter description here

10.png

1-5、
禁止、关闭、屏蔽NetworkManager.service;下次启动、开始network.service

 

进入到/etc/sysconfig/network-scripts
将ifcfg-eth0复制成ifcfg-br-ex

 

enter description here

11.png

1-2、
编辑ifcfg-eth0后的配置
编辑ifcfg-br-ex后的配置

 

systemctl restart network
当重启服务没出错时,说明以上所配置的文件没有问题


以下图形化的操作所有带*号标记都必须填

 

enter description here

12.png

1-2、
登陆admin用户

 

 

enter description here

13.png

1-3、
在ldentity-projects下创建一个poreject1组,需要的性能配置如下:
虚拟cpu:2
磁盘空间:10G
内存:4296M
实例:2

 

 

enter description here

14.png

 

 

enter description here

15.png

1-4、
VCPUs 2 #cpu个数
instances 2 #创建多少个虚拟机
Injected File
Injected File Content
Volumes #数据区,硬盘个数
Volunme Snapshost #数据区,硬盘个数
Total Size of Volumes and Snapshost(GB) 10 #硬盘大小
RAM(MB) 4096 #运行内存
Security Groups #安全组,创多少个服务
Security Group Rules #总服务创建多少个条目
Floating IPs #浮动IP
Networks #每个服务的网络
Ports #端口
Routers #路由
Subnets

 


 

enter description here

16.png

 

 

enter description here

17.png

 

在ldentity-users下创建adm1和usr1,将这2个用户加入到project1这个组;
1-6、
adm1为管理员用户,邮箱为adm1@example.com,密码:redhat
usr1为普通用户,邮箱为usr1@example.com,密码:redhat


 

enter description here

18.png

 

 

enter description here

19.png

 

在Admin-System-Networks-Flavor下创建一个公有的flavor,flavor的配置如下:
1-7、
name:m2.tiny
VCPU:1
Ram:1024MB
Root disk:20GB
Ephemeral disk:2GB
Swap:512MB

 

enter description here

20.png

 


 

enter description here

21.png

 

 

enter description here

22.png

 

在Admin-System-Images下添加一个共享镜像,在指定的位置将镜像文件下到本地
1-5、
name:small
image location:http://classroom.example.com/pub/materials/samall.img
format:QCOW2-QEMU Emulator
勾选:Public 将此镜像共享

 

enter description here

23.png

 


 

enter description here

24.png

1、
切换到普通用户usr1下

 

 

enter description here

25.png

 

 

enter description here

26.png

 

 

enter description here

27.png

 

 

enter description here

28.png

在project创建一个网络分为:内网和外网
1-3、
内网
name:int
子网名:subint
IP地址:192.168.0.0/24
DHCP:开启

 

 

enter description here

29.png

 

 

enter description here

30.png

 

 

enter description here

31.png

1-3
外网
name:0ext
子网名:subext
IP地址:172.25.0.0/24
static池:172.25.0.29,172.25.0.99

 

 

enter description here

33.png

 

 

enter description here

32.png

1、
创建一个路由器

 

 

enter description here

34.png

1、
登陆到project1组的管理员adm1

 

 

enter description here

35.png

 

 

enter description here

36.png

1-3、
在Admin-Sysm-Networks下,Edlit Network编辑ext,将ext加入到External Network外网

 

 

enter description here

37.png

登陆usr1上

 

 

enter description here

38.png

1-2、
在 Project-Networks-Routers下,以router1添加set gateway,将ext在usr1用户下对应adm1管理员上的外网,将路由条目写入路由表。

 

 

enter description here

39.png

1-2、
点击router1,进入后点击add interface添加一个条目将该条目加入router1,该路由会自动生成一个ID。

 

 

enter description here

40.png

 

 

enter description here

41.png

 


 

enter description here

42.png

在以project1组创建一个安全组,开放http、https、ssh服务
在Project-Compute-Access&Security-Security Groups下Creale Security Group添加一个安全组
name:sec1
description:sec1

 

 

enter description here

43.png

 

 

enter description here

44.png

 

 

enter description here

45.png

 

 

enter description here

46.png

1-3、
在Project-Compute-Access&Security下点击sec1下的Manage Rules,Add Rule添加策略
http:80端口
https:443端口
ssh:22端口
** 按要求是添加对应的端口,但在添加是只能看到服务名

 

 

enter description here

47.png

 

 

enter description here

48.png

1-2、
在Project-Compute-Access&Security-Key Palrs下添加一把钥匙,并将钥匙下载到本地
name:key

 

 

enter description here

49.png

 

 

enter description here

50.png

1-2、
下载的文件在真机下/tmp下,用命令scp将/tmp/key.pem root@servera.pod0.example.com:/root/.ssh/key下
并给予读写权限chmod 600 key

 


 

enter description here

51.png

 

 

enter description here

52.png

 

 

enter description here

53.png

 

 

enter description here

54.png

以M2.tiny创建一个web实例,将上面small镜像、安全策略sec1、key钥匙加入web中实现一个模版
1-5、
在Project-Compute-Instances下,Launch Instance创建一个模版
Instance Name:web
Flavor:m2.tiny
Instance Count:1
Instance Boot Source:Boot from image
Image Name:small(340.3MB)
/
Key Palr:key
Securlty Groups:勾选sec1
/
Selected networks:+int

 


 

enter description here

55.png

 

 

enter description here

56.png

 

 

enter description here

57.png

 

 

enter description here

58.png

将web这个实例增加一个浮动IP,使该IP可以任意分配
1-2、
在Project-Compute-Instances下,点击web右边的Associate Floating IP
/
点击IP Address下的+号,将外网ext的网络172.25.0.29/172.25.0.99这个地址池加入其中
/
在加入后内网会自动分配的一个IP 地址为172.25.0.30

 


 

enter description here

59.png

 

 

enter description here

60.png

创建一个storage存储卷
1-2、
在Project-Compute-Volumes-Volumes下,点击Cerate Volume
Volume Name:storage
Size:2 卷的大小2G

 


 

enter description here

61.png

 

 

enter description here

62.png

 

 

enter description here

63.png

创建storage的快照storage-anap,并将storage加入到web实例中
1、
在Project-Compute-Volumes-Volumes下,点击Create Snapshot添加一个快照
Snapshot Name:storage-anap

 

 

enter description here

64.png

 

 

enter description here

65.png

 

 

enter description here

66.png

1、
点击Edit Attachments编辑storage
Attach to Instance:web

 


 

enter description here

67.png

 

 

enter description here

68.png

创建一个Swift容器,该容器能被adm1管理,将本地/etc下的所有文件压缩,压缩后的文件要与源文件名一样
1-2、
~cd /root/
~tar zcvf etc.tgz /etc/ 将/etc/的文件打包成.tgz
~cp keystonerc_admin keystonerc.adm1 将新的keystonerc_admin修改成keystonerc_adm1
~cat keystonerc_adm1 将文件keystonerc_adm1修改如下
export OS_USERNAME=adm1
export OS_TENANT_NAME=project1
export OS_PASSWORD=redhat
export OS_AUTH_URL=http://172.25.0.10:5000/v2.0/
export OS_REGION_NAME=RegionOne
export PS1='[\u@\h \W(keystone_adm1)]$'
~source keystonerc_adm1
~swift post swift-container
~swift upload swfit-container etc.tgz

 

1、

posted @ 2016-10-16 19:28  ZhengLiming  阅读(1154)  评论(0编辑  收藏  举报