openstack安装(包含离线安装)

        假期安装了一套openstackdemo,采用的是packstack安装脚本。Openstack是由多个组件拼接起来的,在使用packstack安装的时候,可以通过修改answer file的配置,来删除不需要的组件。本次采用fedorapeople的安装方法,简单期间,本文没有删除组件,采用默认安装方式。

        在安装之前,请确认你的硬件配置,CPU至少2核,内存至少4G,磁盘20GB(不包括的离线安装包存放的内容)。不能说低于这个配置装不起来,只能说,你可能会遇到很多麻烦。。

        我采用的操作系统是Centos6.6(当然本方法也适用于redhat,fedora等rpm系),CPU 2core,内存4GB,硬盘20GB,是在阿里云上安装成功的。

        先贴出来完整的安装日志,让大家在万里长征的路上知道自己离胜利还有多远:

Welcome to Installer setup utility
Packstack changed given value  to required value /root/.ssh/id_rsa.pub

Installing:
Clean Up                                             [ DONE ]
Setting up ssh keys                                  [ DONE ]
Discovering hosts' details                           [ DONE ]
Adding pre install manifest entries                  [ DONE ]
Preparing servers                                    [ DONE ]
Adding AMQP manifest entries                         [ DONE ]
Adding MariaDB manifest entries                      [ DONE ]
Adding Keystone manifest entries                     [ DONE ]
Adding Glance Keystone manifest entries              [ DONE ]
Adding Glance manifest entries                       [ DONE ]
Adding Cinder Keystone manifest entries              [ DONE ]
Adding Cinder manifest entries                       [ DONE ]
Checking if the Cinder server has a cinder-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 ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Adding Nova Compute manifest entries                 [ DONE ]
Adding Nova Scheduler manifest entries               [ DONE ]
Adding Nova VNC Proxy manifest entries               [ DONE ]
Adding Openstack Network-related Nova manifest entries[ DONE ]
Adding Nova Common 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 Metering Agent manifest entries       [ DONE ]
Adding Neutron Metadata Agent manifest entries       [ DONE ]
Checking if NetworkManager is enabled and running    [ 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 Provisioning Demo manifest entries            [ DONE ]
Adding Provisioning Glance manifest entries          [ DONE ]
Adding MongoDB 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 ]
Installing Dependencies                              [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 115.28.59.208_prescript.pp
115.28.59.208_prescript.pp:                          [ DONE ]         
Applying 115.28.59.208_amqp.pp
Applying 115.28.59.208_mariadb.pp
115.28.59.208_amqp.pp:                               [ DONE ]       
115.28.59.208_mariadb.pp:                            [ DONE ]       
Applying 115.28.59.208_keystone.pp
Applying 115.28.59.208_glance.pp
Applying 115.28.59.208_cinder.pp
115.28.59.208_keystone.pp:                           [ DONE ]        
115.28.59.208_cinder.pp:                             [ DONE ]        
115.28.59.208_glance.pp:                             [ DONE ]        
Applying 115.28.59.208_api_nova.pp
115.28.59.208_api_nova.pp:                           [ DONE ]        
Applying 115.28.59.208_nova.pp
115.28.59.208_nova.pp:                               [ DONE ]    
Applying 115.28.59.208_neutron.pp
115.28.59.208_neutron.pp:                            [ DONE ]       
Applying 115.28.59.208_neutron_fwaas.pp
Applying 115.28.59.208_osclient.pp
Applying 115.28.59.208_horizon.pp
115.28.59.208_neutron_fwaas.pp:                      [ DONE ]             
115.28.59.208_horizon.pp:                            [ DONE ]             
115.28.59.208_osclient.pp:                           [ DONE ]             
Applying 115.28.59.208_ring_swift.pp
115.28.59.208_ring_swift.pp:                         [ DONE ]          
Applying 115.28.59.208_swift.pp
Applying 115.28.59.208_provision_demo.pp
Applying 115.28.59.208_provision_glance.pp
115.28.59.208_swift.pp:                              [ DONE ]                
115.28.59.208_provision_demo.pp:                     [ DONE ]                
115.28.59.208_provision_glance.pp:                   [ DONE ]                
Applying 115.28.59.208_mongodb.pp
115.28.59.208_mongodb.pp:                            [ DONE ]       
Applying 115.28.59.208_ceilometer.pp
Applying 115.28.59.208_nagios.pp
Applying 115.28.59.208_nagios_nrpe.pp
115.28.59.208_ceilometer.pp:                         [ DONE ]           
115.28.59.208_nagios_nrpe.pp:                        [ DONE ]           
115.28.59.208_nagios.pp:                             [ DONE ]           
Applying 115.28.59.208_postscript.pp
115.28.59.208_postscript.pp:                         [ DONE ]          
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** 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.
 * Did not create a cinder volume group, one already existed
 * File /root/keystonerc_admin has been created on OpenStack client host 115.28.59.208. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://115.28.59.208/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * To use Nagios, browse to http://115.28.59.208/nagios username: nagiosadmin, password: 90f9898eae6a4c29
 * The installation log file is available at: /var/tmp/packstack/20150430-210138-4uRp2v/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20150430-210138-4uRp2v/manifests


 

如果你是离线安装的,开始前,你需要知道几个网址:

l  第一个也是最重要的,fedorapeople的openstack安装镜像:

https://repos.fedorapeople.org/repos/openstack/

进去之后可以选择需要安装的openstack版本:

openstack安装(包含离线安装)_第1张图片

我这里采用icehouse,在icehouse页面中,epel-6和epel-7是针对不同版本的linux,epel-6针对的是内核版本为2.6.X的(一般都是2.6.32了吧),epel-7针对2.7内核版本的(我是这么理解的,不对的话请拍砖)。rdo-release的rpm包是你首先需要安装的,它会在你的/etc/yum.repo.d中生成对应的镜像库地址。

openstack安装(包含离线安装)_第2张图片

l  第二个是阿里云的包镜像,注意自己操作系统的版本

http://mirrors.aliyun.com/epel/6/x86_64/

http://mirrors.aliyun.com/centos/6.6/extras/x86_64/Packages/

http://mirrors.aliyun.com/centos/6.6/os/x86_64/Packages/

http://mirrors.aliyun.com/centos/6.6/updates/x86_64/Packages/

这几个镜像是Centos的包库,在安装openstack时都需要用到。如果是离线安装,要把所有的包通过网络下载的本地,下载的时候注意Packages的平级目录下的repodata也要下载。

l  第三个是puppetlabs

http://yum.puppetlabs.com/el/6/products/x86_64/

http://yum.puppetlabs.com/el/6/dependencies/x86_64/

l  第四个是foreman

http://yum.theforeman.org/releases/1.5/el6/x86_64/

http://yum.theforeman.org/plugins/1.5/el6/x86_64/

后两个也都是包库。

 

再啰嗦一次,如果离线安装,所以把这些网址中的所有包全部下载的了本地(包比较多哈,我是自己写的perl脚本自动下载的,大概一个通宵下完的),下完之后13G左右吧,注意文件存放的目录结构。

 



【现在开始安装】

l  先安装我们刚才提到的rdo包

rpm -ivhhttps://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm

然后就可以看到/etc/yum.repo.d中多了一些文件(红圈里)

openstack安装(包含离线安装)_第3张图片

如果是离线安装,修改包括epel.repo和CentOS-Base.repo在内的5个repo文件,修改里面的包库地址为你的本地路径,enable=0的是用不到的,不用管。

l  更新系统文件

这一步很重要,如果漏了,后面你会碰到各种因为软件版本导致的问题

yum -y update

l  重启

reboot

l  安装packstack

yum install -yopenstack-packstack

l  安装openstack

packstack --allinone --install-hosts=115.28.59.208

如果你的机器只有一块网卡,--install-hosts=可以省略。

l  安装过程会因为各种问题中断,重新安装时,务必使用answerfile安装,否则会报错。Answerfile文件在你的用户名目录下,比如如果你是root用户,就在/root下。

packstack --answer-file=/root/[your answerfile]

 

如果一切顺利,就会安装成功啦。登陆dashboard:

 openstack安装(包含离线安装)_第4张图片

 

 

【错误处理】

当然,一次安装成功的概率很小,下面总结我在过程中遇到的问题:

 

l  ERROR : Error appeared during Puppet run:115.28.59.208_ring_swift.pp

Error: Execution of'/usr/bin/swift-ring-builder /etc/swift/object.builder addr1z1-115.28.59.208:6000/swift_loopback 10.00' returned 2: Device 0 already uses115.28.59.208:6000/swift.

解决:

rm /etc/swift/*.builder -f; rm/etc/swift/*.ring.gz -f; rm -fr /etc/swift/backups

 

l  ERROR : Cinder's volume group 'cinder-volumes' could not be created.

解决:

dd if=/dev/zero of=cinder-volumes bs=1count=0 seek=2G

losetup /dev/loop2 cinder-volumes

pvcreate /dev/loop2

vgcreate cinder-volumes /dev/loop2

如果遇到loop2端口忙,可以换换其他端口

 

l  Could not load downloaded file/var/lib/puppet/lib/puppet/provider/nova_admin_tenant_id_setter/ini_setting

解决:

这可能是因为你的rubygems版本不对,我的版本是rubygems-1.3.7-5.el6.noarch,请核对。

 

l  ERROR : Error appeared during Puppet run:172.31.193.4_provision_glance.pp

Error: Execution of '/usr/bin/glance -Tservices -I glance -K 421b7f47a3ff49f4 -N http://172.31.193.4:35357/v2.0/image-create --name=cirros --is-public=Yes --container-format=bare--disk-format=qcow2--copy-from=http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img'returned 1: Request returned failure status.

You will find full trace in log/var/tmp/packstack/20150502-204944-Wdz9Wo/manifests/172.31.193.4_provision_glance.pp.log

Please check log file/var/tmp/packstack/20150502-204944-Wdz9Wo/openstack-setup.log for moreinformation

解决:

如果你是离线安装,因为--copy-from=后面必须跟URL,所以要写成下面这样

/usr/bin/glance -T services -I glance -K421b7f47a3ff49f4 -N http://172.31.193.4:35357/v2.0/ image-create --name=cirros--is-public=Yes --container-format=bare --disk-format=qcow2 --file=/etc/cirros-0.3.1-x86_64-disk.img

 

 

你可能感兴趣的:(openstack)