Openstack CentOS6.5 ALL IN ONE 安装

时间:2021-12-09 13:07:13

本文档以RDO的方式安装单节点、单网卡的Openstack。

RDO是可在Red Hat Enterprise Linux、Fedora及其变体上运行的社区支持OpenStack版本。部署简单方便,RDO中包含核心的OpenStack组件 – Nova、Glance、Keystone、Cinder、Neutron、Swift和Horizon,还有用于云应用协调的孵化项目 – Heat,以及用于资源监视和计量的Ceilometer。利用红帽开发的安装工具 – PackStack,可以实现非常简便轻松的安装过程。

RDO的ALL IN ONE安装方式主要用于测试环境,安装所需要的环境比较容易实现,生产环境推荐使用真实物理机,多节点并逐个安装各组件的方式进行。

一、安装环境:

服务器:vmware虚拟机 系统:CentOS6.5 内核版本:2.6.32-431.3.1.el6.x86_64

网卡:一块(eth0) IP:192.168.8.229 netmask:255.255.255.0 gateway:192.168.8.1(办公网络)

二、配置国内源

Shell
cd/etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum list

三、设置FQDN

因为RDO的安装方式是通过puppet进行安装需要用到FQDN的命名方式,所以主机名要这样设置,名字可以随意取

vim/etc/sysconfig/network
controller.domain.cc
hostname controller.domain.cc
[root@controller~]# hostname -f
controller.domain.cc

四、修改HOST文件

vi/etc/hosts
192.168.8.229controller.domain.cc

五、 配置cinder-volumes

给cinder-volumes单独一个分区,可以提高性能,我在安装系统的时候预留了一块分区未挂载。如果未预留,可以给虚拟机加一块硬盘做来此分区。

fdisk-l
pvcreate/dev/sda5
vgcreate cinder-volumes/dev/sda5

六、安装packstack

yum install-yhttp://rdo.fedorapeople.org/openstack/openstack-havana/rdo-release-havana.rpm
yum install-yopenstack-packstack
yum-yupdate

yum更新后重启服务器

七、关闭selinux

vi/etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled

八、开始安装

因为我们提前配置了cinder-volumes所以在安装命令中取消cinder-volumes的配置

 packstack--allinone--provision-demo=nCONFIG_CINDER_VOLUMES_CREATE=n

九、安装过程

[root@controller~]# packstack  --allinone --provision-demo=n CONFIG_CINDER_VOLUMES_CREATE=n
Welcome toInstaller setup utility
Packstack changed given value  torequired value/root/.ssh/id_rsa.pub
Installing:
Clean Up...                                            [DONE]
Setting up ssh keys...root@192.168.8.229'spassword:
root@192.168.8.229'spassword:
                                 [DONE]
Discovering hosts'details...                          [DONE]
Adding pre install manifest entries...                 [DONE]
Adding MySQL manifest entries...                       [DONE]
Adding QPID manifest entries...                        [DONE]
Adding Keystone manifest entries...                    [DONE]
Adding Glance Keystone manifest entries...             [DONE]
Adding Glance manifest entries...                      [DONE]
Installing dependencies forCinder...                  [DONE]
Adding Cinder Keystone manifest entries...             [DONE]
Adding Cinder manifest entries...                      [DONE]
Checking ifthe Cinder server hasacinder-volumes vg...[DONE]
Adding Nova API manifest entries...                    [DONE]
Adding Nova Keystone manifest entries...               [DONE]
Adding Nova Cert manifest entries...                   [DONE]
Adding Nova Conductor manifest entries...              [DONE]
Adding Nova Compute manifest entries...                [DONE]
Adding Nova Scheduler manifest entries...              [DONE]
Adding Nova VNC Proxy manifest entries...              [DONE]
Adding Nova Common manifest entries...                 [DONE]
Adding Openstack Network-related Nova manifest entries...[DONE]
Adding Neutron API manifest entries...                 [DONE]
Adding Neutron Keystone manifest entries...            [DONE]
Adding Neutron L3 manifest entries...                  [DONE]
Adding Neutron L2 Agent manifest entries...            [DONE]
Adding Neutron DHCP Agent manifest entries...          [DONE]
Adding Neutron LBaaS Agent manifest entries...         [DONE]
Adding Neutron Metadata Agent manifest entries...      [DONE]
Adding OpenStack Client manifest entries...            [DONE]
Adding Horizon manifest entries...                     [DONE]
Adding Swift Keystone manifest entries...              [DONE]
Adding Swift builder manifest entries...               [DONE]
Adding Swift proxy manifest entries...                 [DONE]
Adding Swift storage manifest entries...               [DONE]
Adding Swift common manifest entries...                [DONE]
Adding Ceilometer manifest entries...                  [DONE]
Adding Ceilometer Keystone manifest entries...         [DONE]
Adding Nagios server manifest entries...               [DONE]
Adding Nagios host manifest entries...                 [DONE]
Adding post install manifest entries...                [DONE]
Preparing servers...                                   [DONE]
Installing Dependencies...                             [DONE]
Copying Puppet modules andmanifests...                [DONE]
Applying Puppet manifests...
Applying192.168.8.229_prescript.pp
192.168.8.229_prescript.pp:               [DONE]                  
Applying192.168.8.229_mysql.pp
Applying192.168.8.229_qpid.pp
192.168.8.229_mysql.pp:                       [DONE]          
192.168.8.229_qpid.pp:                         [DONE]          
Applying192.168.8.229_keystone.pp
Applying192.168.8.229_glance.pp
Applying192.168.8.229_cinder.pp
192.168.8.229_keystone.pp:                 [DONE]                
192.168.8.229_glance.pp:                     [DONE]              
192.168.8.229_cinder.pp:                     [DONE]              
Applying192.168.8.229_api_nova.pp
192.168.8.229_api_nova.pp:                 [DONE]                
Applying192.168.8.229_nova.pp
192.168.8.229_nova.pp:                         [DONE]        
Applying192.168.8.229_neutron.pp
192.168.8.229_neutron.pp:                   [DONE]              
Applying192.168.8.229_osclient.pp
Applying192.168.8.229_horizon.pp
192.168.8.229_osclient.pp:                 [DONE]                
192.168.8.229_horizon.pp:                   [DONE]                
Applying192.168.8.229_ring_swift.pp
192.168.8.229_ring_swift.pp:             [DONE]                    
Applying192.168.8.229_swift.pp
Applying192.168.8.229_ceilometer.pp
Applying192.168.8.229_nagios.pp
Applying192.168.8.229_nagios_nrpe.pp
192.168.8.229_swift.pp:                       [DONE]                
192.168.8.229_nagios.pp:                     [DONE]                  
192.168.8.229_ceilometer.pp:             [DONE]                      
192.168.8.229_nagios_nrpe.pp:           [DONE]                      
Applying192.168.8.229_postscript.pp
192.168.8.229_postscript.pp:             [DONE]                    
                           [DONE]
Finalizing...                                          [DONE]
****Installation completed successfully******
Additional information:
*Anewanswerfile was created in:/root/packstack-answers-20140122-060833.txt
*Timesynchronization installation was skipped.Please note that unsynchronized timeon server instances might be problem forsome OpenStack components.
*Did notcreateacinder volume group,one already existed
*File/root/keystonerc_admin has been created on OpenStack client host192.168.8.229.Tousethe commandline tools you need tosource the file.
*Toaccess the OpenStack Dashboard browse tohttp://192.168.8.229/dashboard.
Please,findyour login credentials stored inthe keystonerc_admin inyour home directory.
*TouseNagios,browse tohttp://192.168.8.229/nagios username:nagiosadmin,password:cd40bf59e297418d
*The installation log fileisavailable at:/var/tmp/packstack/20140122-060832-eVf1sO/openstack-setup.log
*The generated manifests are available at:/var/tmp/packstack/20140122-060832-eVf1sO/manifest

安装过程中可能会因为源的问题中断,加上应答文件再次执行即可

 packstack--answer-file=/root/packstack-answers-20140121-232841.txt

安装完成后,重启服务器

十、配置网络

安装好以后配置网络

# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
ONBOOT=yes
HWADDR=00:E0:81:D8:43:BE
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex

ifcfg-br-ex 是一个openvswitch 的连接外网的bridge。因为RDO目前的BUG,安装后成后并没有ifcfg-br-ex被创建,需要手动新增。

# cat /etc/sysconfig/network-scripts/ifcfg-br-ex 
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.8.229
NETMASK=255.255.255.0
GATEWAY=192.168.8.1
ONBOOT=yes

重启网卡

十、安装镜像

安装完成后,用户、密码以及认证地址等环境变量被保存在/root/keystonerc_admin中,命令行下执行命令的时候需要先导入此文件或写到/etc/profile中。

十一、配置安全组规则

打开tcp:22端口和icmp协议的访问权限

Shell

1
2
neutron security-group-rule-create--protocol icmp--direction ingress default
neutron security-group-rule-create--protocol tcp--port-range-min22--port-range-max22--direction ingress default

查看新增的2个规则

Shell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[root@controller~(keystone_admin)]# neutron security-group-rule-list
+--------------------------------------+----------------+-----------+----------+------------------+--------------+
|id                                   |security_group|direction|protocol|remote_ip_prefix|remote_group|
+--------------------------------------+----------------+-----------+----------+------------------+--------------+
|058625eb-7ca6-4717-bc80-f3e645f1b664|default        |ingress   |          |                  |default      |
|1cf19202-07e4-4413-a4b2-566fb3aef72c|default        |ingress   |          |                  |default      |
|2482ca61-9f4d-4cf9-a81c-c1ee22df1cc0|default        |egress    |          |                  |              |
|40c6cfb5-231f-4427-9655-9194268a33b5|default        |egress    |          |                  |              |
|57df7a08-c3fd-4696-8f63-32571ccecb24|default        |egress    |          |                  |              |
|8391e869-b371-46bf-958e-d89615165fd1|default        |ingress   |icmp     |0.0.0.0/0        |              |
|890dbd60-242c-4cfb-9eba-f8a755907d8c|default        |ingress   |tcp      |0.0.0.0/0        |              |
|96218b0c-338e-472c-befb-c2a3eb2db6ef|default        |egress    |          |                  |              |
|a29a3323-595f-4c7b-bdae-53614a62cb1e|default        |egress    |          |                  |              |
|adc87cfb-5a71-4549-bb15-ffc2ab1b862c|default        |egress    |          |                  |              |
|c952a552-50cc-4432-8f64-2ad305fe5496|default        |ingress   |          |                  |default      |
|d0426da9-5c31-4670-878c-cdb5771dc71e|default        |ingress   |          |                  |default      |
|d4620fb7-19fc-41cb-be14-5f70858b1b01|default        |ingress   |          |                  |default      |
|e468de96-1593-495a-bda9-64657b53a9a0|default        |ingress   |          |                  |default      |
+--------------------------------------+----------------+-----------+----------+------------------+--------------+
[root@controller~(keystone_admin)]# neutron security-group-rule-show 8391e869-b371-46bf-958e-d89615165fd1
+-------------------+--------------------------------------+
|Field             |Value                                |
+-------------------+--------------------------------------+
|direction         |ingress                              |
|ethertype         |IPv4                                 |
|id                |8391e869-b371-46bf-958e-d89615165fd1|
|port_range_max    |                                      |
|port_range_min    |                                      |
|protocol          |icmp                                 |
|remote_group_id   |                                      |
|remote_ip_prefix  |0.0.0.0/0                            |
|security_group_id|6d8aa78f-1f81-4a7d-ac25-5ac5483e82e2|
|tenant_id         |02da2e92dd6b4478b09aa63b20a11b5a     |
+-------------------+--------------------------------------+
[root@controller~(keystone_admin)]# neutron security-group-rule-show 890dbd60-242c-4cfb-9eba-f8a755907d8c
+-------------------+--------------------------------------+
|Field             |Value                                |
+-------------------+--------------------------------------+
|direction         |ingress                              |
|ethertype         |IPv4                                 |
|id                |890dbd60-242c-4cfb-9eba-f8a755907d8c|
|port_range_max    |22                                   |
|port_range_min    |22                                   |
|protocol          |tcp                                  |
|remote_group_id   |                                      |
|remote_ip_prefix  |0.0.0.0/0                            |
|security_group_id|6d8aa78f-1f81-4a7d-ac25-5ac5483e82e2|
|tenant_id         |02da2e92dd6b4478b09aa63b20a11b5a     |
+-------------------+--------------------------------------+

Openstack  CentOS6.5 ALL IN ONE 安装

(未完待续)

遇到的问题及解决方法:

(先把遇到的问题写在这里怕以后忘记)

配置域名访问web界面后报错:

Shell
1
2
3
4
5
6
7
8
9
2014-01-2208:55:57,3236935ERROR django.requestInternal Server Error:/dashboard/
Traceback(most recent call last):
File"/usr/lib/python2.6/site-packages/django/core/handlers/base.py",line89,inget_response
response=middleware_method(request)
File"/usr/lib/python2.6/site-packages/django/middleware/common.py",line55,inprocess_request
host=request.get_host()
File"/usr/lib/python2.6/site-packages/django/http/__init__.py",line223,inget_host
"Invalid HTTP_HOST header (you may need to set ): %s"%host)
SuspiciousOperation:Invalid HTTP_HOST header(you may need toset ALLOWED_HOSTS):openstack.domain.cc

原因:django有个ALLOWED_HOSTS的配置,有允许的域名可以解析到服务器IP上。

解决方法:在/etc/openstack-dashboard/local_settings 里面找到ALLOWED_HOSTS在其中加入想要解析的域名,修改后的样子:

Shell
1
ALLOWED_HOSTS=['192.168.8.229','controller.domain.cn','localhost','openstack.domain.cc',]

重启apache