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文件内的以下几条内容

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

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

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

1、
CONFIG_CINDER_VOLUMES_CREATE=n 282行
关掉cinder volume

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

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

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

1、
CONFIG_PROVISION_DEMO=n 629行
不用demo

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

配置后的信息

1-5、
禁止、关闭、屏蔽NetworkManager.service;下次启动、开始network.service
进入到/etc/sysconfig/network-scripts
将ifcfg-eth0复制成ifcfg-br-ex

1-2、
编辑ifcfg-eth0后的配置
编辑ifcfg-br-ex后的配置
systemctl restart network
当重启服务没出错时,说明以上所配置的文件没有问题
以下图形化的操作所有带*号标记都必须填

1-2、
登陆admin用户

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


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


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


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



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


1、
切换到普通用户usr1下




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



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


1、
创建一个路由器

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


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

登陆usr1上

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

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



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




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


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


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




以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




将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


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



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



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


创建一个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、
