如何一步步使用國內yum源一鍵安裝openstack-ocata版本基於centos7


寫在前面的話,在網上看了一個國外的一鍵安裝視頻,我也照着做,結果出現很多錯誤,現在把坑解決了,照着做肯定能安裝成功的

環境

  virtualhost 下的centos7

配置

  雙網卡 一個10網段,nat通信用 一個192網段 和宿主機通信使用

  2c 這個測試部署的話,不是強要求,我部署后CPU也就占20%

  5.4G內存 我的宿主機也就8G內存 配到這個數據已經很卡了 再次PS 

  安裝完成要占用約5G左右的內存

部署

  由於我的是nat 網絡,所以先配置雙網卡,否則部署后,不能正常訪問openstack的管理網頁,因為需要修改到這個參數,這個到后面再說

  雙網卡配置略過,自己在網上查吧很多的。實在找不到就留言

正式開始

  1-設置yum源01_setyum.sh(非常重要,雖然出了openstack 專用的yum源,但那不是咱們能用的),我做成了腳本樣子的,直接拷貝拿去用,鏡像源用的是清華源,因為阿里源有的包跳轉到404的鏈接還在上面,后面一鍵安裝的時候就會坑哭你,親測。。都是淚。腳本正文如下

#創建備份路徑
mkdir -p /etc/yum.repos.d/bak_tmp/
#移走當前的所有源,為什么?因為一鍵安裝會亂跳,跳到不能用的就報錯,然后你就安裝失敗
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak_tmp/
#創建yum 文件
touch /etc/yum.repos.d/centos-tuna.repo
#導入鏡像內容到yum文件中
cat   >>/etc/yum.repos.d/centos-tuna.repo << EOF
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-\$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/os/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-\$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/updates/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[centosplus]
name=CentOS-\$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/centosplus/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[cloud]
name=CentOS-\$releasever - Cloud
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/cloud/\$basearch/openstack-ocata/
enabled=1
gpgcheck=0
[paas]
name=CentOS-\$releasever - paas
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/paas/\$basearch/openshift-origin13/
enabled=1
gpgcheck=0
[kvm]
name=CentOS-\$releasever - kvm
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/virt/\$basearch/kvm-common/
enabled=1
gpgcheck=0

EOF
#清除yum緩存
yum clean all
#重新做yum 緩存
yum makecache

  2-配置環境 02_setenv.sh

cat >/etc/environment <<EOF
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
EOF

systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl restart network

  3-安裝一鍵部署包 03_set_openstack-packstack.sh

yum -y update
yum install -y openstack-packstack
#報錯無法安裝openstack-selinux 沒有相關依賴包,通過增加paas 鏡像源解決
yum install -y openstack-selinux
yum -y install wget
#--提示缺少libLibev.so.4()(64bit)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install libev
#有可能yum源混亂了,所以重新執行yibian
mkdir -p /etc/yum.repos.d/bak_tmp_1 mv /etc/yum.repos.d/*.repo /etc/yum.repo.d/bak_tmp_1/ mv /etc/yum.repos.d/bak_tmp_1/centos-tuna.repo /etc/yum.repos.d/ yum clean all
yum makecache
#解決python-werkzeug 不在cloud源,在virt里面,所以找不到此包 wget -O /root/python-werkzeug-0.9.1-1.el7.noarch.rpm
https://mirrors.tuna.tsinghua.edu.cn/centos/7/virt/x86_64/ovirt-4.3/common/python-werkzeug-0.9.1-1.el7.noarch.rpm rpm -ivh /root/python-werkzeug-0.9.1-1.el7.noarch.rpm

  執行到這里才完成一點點,為了保險。重新進入到yum文件夾

cd /etc/yum.repos.d/
ll
#確認當前只有一個centos-tuna.repo

  確認完成執行最后一步安裝操作,也就是出錯最多的操作

#-d 表示debug 日志級別
packstack --allinone -d

  安裝成功的樣例如下

  比較長,就不展開了 

[root@openstack-allinone yum.repos.d]# packstack --allinone -d
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20190121-202443-CWIVyN/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
Preparing Nova Compute entries                       [ DONE ]
Preparing Nova Scheduler entries                     [ DONE ]
Preparing Nova VNC Proxy entries                     [ DONE ]
Preparing OpenStack Network-related Nova entries     [ DONE ]
Preparing Nova Common entries                        [ DONE ]
Preparing Neutron LBaaS Agent entries                [ DONE ]
Preparing Neutron API entries                        [ DONE ]
Preparing Neutron L3 entries                         [ DONE ]
Preparing Neutron L2 Agent entries                   [ DONE ]
Preparing Neutron DHCP Agent entries                 [ DONE ]
Preparing Neutron Metering Agent entries             [ DONE ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Swift builder entries                      [ DONE ]
Preparing Swift proxy entries                        [ DONE ]
Preparing Swift storage entries                      [ DONE ]
Preparing Gnocchi entries                            [ DONE ]
Preparing MongoDB entries                            [ DONE ]
Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 10.0.2.28_controller.pp
10.0.2.28_controller.pp:                             [ DONE ]      
Applying 10.0.2.28_network.pp
10.0.2.28_network.pp:                                [ DONE ]   
Applying 10.0.2.28_compute.pp
10.0.2.28_compute.pp:                                [ DONE ]   
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

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

Additional information:
 * A new answerfile was created in: /root/packstack-answers-20190121-202444.txt
 * 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 10.0.2.28. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://10.0.2.28/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * Because of the kernel update the host 10.0.2.28 requires reboot.
 * The installation log file is available at: /var/tmp/packstack/20190121-202443-CWIVyN/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20190121-202443-CWIVyN/manifests
 * Note temporary directory /var/tmp/packstack/503a14fac81b4a29937e3fc3f14381f5 on host 10.0.2.28 was not deleted for debugging purposes.
You have new mail in /var/spool/mail/root
View Code

  失敗的案例如下

Preparing Redis entries                              [ DONE ]
Preparing Ceilometer entries                         [ DONE ]
Preparing Aodh entries                               [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 10.0.2.28_controller.pp
10.0.2.28_controller.pp:                          [ ERROR ]        
Applying Puppet manifests                         [ ERROR ]

ERROR : Error appeared during Puppet run: 10.0.2.28_controller.pp
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install openstack-aodh-notifier' returned 1: Error downloading packages:
You will find full trace in log /var/tmp/packstack/20190121-193700-TbxiNW/manifests/10.0.2.28_controller.pp.log
Please check log file /var/tmp/packstack/20190121-193700-TbxiNW/openstack-setup.log for more information
Additional information:
 * A new answerfile was created in: /root/packstack-answers-20190121-193701.txt
 * 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 10.0.2.28. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://10.0.2.28/dashboard .
Please, find your login credentials stored in the keystonerc_admin in your home directory.
 * Note temporary directory /var/tmp/packstack/ff08df80e03e49f49e802dd352ea13e0 on host 10.0.2.28 was not deleted for debugging purposes.
不要慌,檢查你的文件夾下的yum 源,全部移除到備份文件夾
yum makecache 
重新開始執行
View Code

  部署成功后驗證登陸,ip 為你自己虛擬機的ip,主要看

more /etc/httpd/15-hrion*.conf #記不清全拼了,找到這個文件
增加一個serveralias 192.168.x。x #宿主機和虛擬機能正常通信的IP
#重啟
systemctl restart httpd

  千辛萬苦就是要看到這么一個圖。爬坑也是花時間的,現在總結在這里。祝你們測試部署成功

    登陸的賬號密碼在

--密碼文件在root用戶目錄下
cat /root/keystonerc_admin
復制OS_USERNAME=admin
     OS_PASSWORD=XXXX

  結束語

  這次的部署獲益良多,要感謝阿里雲yum源的一個功能,就是在頁面可以支持搜索包,這樣我就知道這個包在哪個文件夾下,也是感謝清華yum源的給力,通過在阿里yum搜索到的包,去清華yum源找到對應的頁面 ,一步步配置到第一步設置的yum中。才能正常的安裝這個一鍵安裝包。否則在vpn的龜速下是很難正常完成一鍵部署的安裝,這個一鍵部署的openstack 主要還是用來體會一下openstack是一個怎么樣使用的。自己裝一次,比看10次文檔還印象深刻。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM