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安裝映象:
進去之後可以選擇需要安裝的openstack版本:
我這裡採用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中生成對應的映象庫地址。
l 第二個是阿里雲的包映象,注意自己作業系統的版本
這幾個映象是Centos的包庫,在安裝openstack時都需要用到。如果是離線安裝,要把所有的包通過網路下載的本地,下載的時候注意Packages的平級目錄下的repodata也要下載。
l 第三個是puppetlabs
l 第四個是foreman
後兩個也都是包庫。
再囉嗦一次,如果離線安裝,所以把這些網址中的所有包全部下載的了本地(包比較多哈,我是自己寫的perl指令碼自動下載的,大概一個通宵下完的),下完之後13G左右吧,注意檔案存放的目錄結構。
【現在開始安裝】
l 先安裝我們剛才提到的rdo包
rpm -ivhhttps://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm
然後就可以看到/etc/yum.repo.d中多了一些檔案(紅圈裡)
如果是離線安裝,修改包括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:
【錯誤處理】
當然,一次安裝成功的概率很小,下面總結我在過程中遇到的問題:
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