如何一步步使用國內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是一個怎麼樣使用的。我從瞭解到部署成功也是 斷斷續續花了接近兩天的時間,每一次的探索都感覺對於部署各種應用有熟悉的感覺。