Centos 6.5 搭建Openstack平台

时间:2022-06-03 20:13:11
<pre name="code" class="plain">设置源
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

添加epel源
RDO需要使用epel源和RDO源,另外由于epel上的puppet版本太旧,所以需要增加puppet的源,Foreman的源,其实我们是用不上。

需要注意的一点就是,如果你是多节点的安装,那么你确保你的其他节点的epel源设置正确就可以,默认packstack不会设置其他节点的epel源。

我试验环境有内网的源,其实是不需要这个的。这个rpm包装完,你会发现 /etc/yum.repos.d/ 目录下多几个文件。

yum install -y http://rdo.fedorapeople.org/openstack-icehouse/rdo-release-icehouse.rpm
网卡配置
默认我使用eth0作为公网IP地址,虚拟机的floating IP,也是公网的IP地址,eth1,作为虚拟机通讯,需要设置一个私有的IP地址段就可以,这个IP地址段,和虚拟机获得的fix IP,没有任何联系。

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
HWADDR=00:E0:81:D8:43:BE
TYPE=Ethernet
BOOTPROTO=none
IPADDR=172.28.1.133
NETMASK=255.255.0.0
DNS1=172.28.0.1
eth1,是一个虚拟机通讯的网络,所以你设置一个专用的私有IP地址段就可以,这个是GRE网络需要的

cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
HWADDR=00:E0:81:D8:43:BF
TYPE=Ethernet
BOOTPROTO=none
IPADDR=10.1.1.133
NETMASK=255.255.255.0
DNS1=172.28.0.1
 

 

安装packstack
yum -y install openstack-packstack
packstack --gen-answer-file=node133.txt
 

修改应答文件
默认的应答文件有点变化,所以需要调整一下

CONFIG_HEAT_INSTALL=y
CONFIG_KEYSTONE_ADMIN_PW=admin
#CONFIG_NEUTRON_L2_PLUGIN=openvswitch
CONFIG_NEUTRON_L2_PLUGIN=ml2
CONFIG_NEUTRON_ML2_TYPE_DRIVERS=gre
CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=gre
CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES=100:1000
CONFIG_NEUTRON_OVS_TENANT_NETWORK_TYPE=gre
CONFIG_NEUTRON_OVS_TUNNEL_RANGES=100:1000
CONFIG_NEUTRON_OVS_TUNNEL_IF=eth1

#########
CONFIG_HEAT_CLOUDWATCH_INSTALL=y
CONFIG_HEAT_CFN_INSTALL=y
 

在我的实际的环境中,我还做下面的调整

CONFIG_SSH_KEY=/root/.ssh/authorized_keys
CONFIG_NTP_SERVERS=172.28.0.1
CONFIG_PROVISION_DEMO=n
CONFIG_CINDER_VOLUMES_CREATE=n
 

做这些调整的目的

使用密钥,可以免除输入密码,这样方便多节点部署
让所有的机器同步时间,避免不必要的麻烦
不创建demo用户,这样可以避免很多误解
用文件模拟cinder volume,性能很差,我的机器里已经有一个lvm 卷 cinder-volumes, 所以不需要文件模拟
运行packstack

这就是安装

packstack --answer-file=node133.txt
顺利装完后,你会看到

 **** Installation completed successfully ******


Additional information:
 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
 * File /root/keystonerc_admin has been created on OpenStack client host 172.28.1.133. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://172.28.1.133/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * To use Nagios, browse to http://172.28.1.133/nagios username : nagiosadmin, password : nagiosadmin
 * The installation log file is available at: /var/tmp/packstack/20140617-100211-nW1zwf/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20140617-100211-nW1zwf/manifests
调整网络
默认虚拟机是无法访问外网,所以我们需要设置一下。

查看当前网络情况

root@g133 ~]# ovs-vsctl show
d5211ea0-c973-4f41-a7f4-69dd0cf7238c
    Bridge br-int
        Port br-int
            Interface br-int
                type: internal
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
    Bridge br-tun
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
        Port "gre-0a01010a"
            Interface "gre-0a01010a"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.10"}
        Port br-tun
            Interface br-tun
                type: internal
        Port "gre-0a01010c"
            Interface "gre-0a01010c"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.12"}
    ovs_version: "1.11.0"
没有创建br-ex

我们需要创建 /etc/sysconfig/network-scripts/ifcfg-br-ex

# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
IPADDR=172.28.1.133
PREFIX=16
ONBOOT=yes
调整eth0

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
HWADDR=00:E0:81:DE:23:65
创建bridge br-ex

ovs-vsctl add-br br-ex
这个时候查看网络

# ovs-vsctl show
3a0b7e02-78a1-475e-bc93-5b57a6749aa3
    Bridge br-tun
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
        Port br-tun
            Interface br-tun
                type: internal
        Port "gre-0a01010a"
            Interface "gre-0a01010a"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.10"}
        Port "gre-0a01010c"
            Interface "gre-0a01010c"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.12"}
    Bridge br-int
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
        Port br-int
            Interface br-int
                type: internal
    Bridge br-ex
        Port br-ex
            Interface br-ex
                type: internal
    ovs_version: "1.11.0"
把bridge和网卡绑定

ovs-vsctl add-port br-ex eth0; service network restart
这个时候,你再查看网络

# ovs-vsctl show
3a0b7e02-78a1-475e-bc93-5b57a6749aa3
    Bridge br-tun
        Port patch-int
            Interface patch-int
                type: patch
                options: {peer=patch-tun}
        Port br-tun
            Interface br-tun
                type: internal
        Port "gre-0a01010a"
            Interface "gre-0a01010a"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.10"}
        Port "gre-0a01010c"
            Interface "gre-0a01010c"
                type: gre
                options: {in_key=flow, local_ip="10.1.1.133", out_key=flow, remote_ip="10.1.1.12"}
    Bridge br-int
        Port patch-tun
            Interface patch-tun
                type: patch
                options: {peer=patch-int}
        Port br-int
            Interface br-int
                type: internal
    Bridge br-ex
        Port "eth0"
            Interface "eth0"
        Port br-ex
            Interface br-ex
                type: internal
    ovs_version: "1.11.0"
转载至:http://www.chenshake.com/centos6-4-single-card-all-in-one-install-havana/