OpenStack介紹
openstack詳細介紹及常用命令請查看此文
通過Packstack(RDO)部署OpenStack,官方文檔點擊此處查看
安裝環境
-
工具:VMware Workstation 16 Pro
-
操作系統:CentOS 8.3
-
虛擬機配置
-
內存 8G
-
處理器 6C
-
磁盤 120G
-
虛擬化引擎
以上配置非最低要求,可根據實際情況嘗試安裝
-
基礎配置
-
配置環境
編輯
vim /etc/environment
文件,添加以下內容LANG=en_US.utf-8 LC_ALL=en_US.utf-8
安裝en_US.utf-8語言包
dnf install glibc-langpack-en -y
-
設置主機名並配置
/etc/hosts
文件修改主機名
hostnamectl set-hostname duan exec bash
使用echo命令,在/etc/hosts文件中添加本地解析,或者通過vim命令添加
echo -e "192.166.66.6\tduan" >> /etc/hosts
-
關閉防火牆並禁止開機自啟
systemctl disable firewalld && systemctl stop firewalld
-
更換網絡服務
在安裝部署OpenStack時,OpenStack的網絡服務會與NetworkManager服務產生沖突,二者無法一起正常工作,需要使用Network
# 安裝Network服務 dnf install network-scripts -y # 停用NetworkManager並禁止開機自啟 systemctl stop NetworkManager && systemctl disable NetworkManager # 啟用 Network並設置開機自啟 systemctl start network && systemctl enable network
更換網絡后,遠程連接工具可能會斷開,建議
reboot
重啟系統,IP可能會發生變化,請查看IP后重新連接遠程工具 -
設置靜態IP
編輯網絡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33
修改修改並添加以下內容
# 設為靜態 BOOTPROTO=static # 設為開機自動連接 ONBOOT=yes # 添加IP、子網掩碼及網關 IPADDR=192.166.66.6 NETMASK=255.255.255.0 GATEWAY=192.166.66.2
重啟Network網絡服務
# 重啟網絡服務 systemctl restart network # 測試是否可訪問外網 ping -c 5 www.baidu.com
OpenStack安裝
-
啟用
powertools
存儲庫並安裝Victoria版openstackdnf config-manager --enable powertools dnf install centos-release-openstack-victoria -y
-
更新當前軟件包
dnf update -y
-
安裝paskstack工具
dnf install openstack-packstack -y
-
使用packstack命令安裝openstack
packstack --allinone
安裝進度由當前網絡環境決定,請耐心等待……,此次在出租屋里安裝耗時1小時左右
安裝成功會出現“Installation completed successfully”提示,如下
[root@duan ~]# packstack --allinone Welcome to the Packstack setup utility The installation log file is available at: /var/tmp/packstack/20210225-204839-3dgxy1c1/openstack-setup.log Packstack changed given value to required value /root/.ssh/id_rsa.pub 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 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 Redis entries [ DONE ] Preparing Ceilometer entries [ DONE ] Preparing Aodh entries [ DONE ] Preparing Puppet manifests [ DONE ] Copying Puppet modules and manifests [ DONE ] Applying 192.166.66.6_controller.pp 192.166.66.6_controller.pp: [ DONE ] Applying 192.166.66.6_network.pp 192.166.66.6_network.pp: [ DONE ] Applying 192.166.66.6_compute.pp 192.166.66.6_compute.pp: [ DONE ] Applying Puppet manifests [ DONE ] Finalizing [ DONE ] **** Installation completed successfully ****** Additional information: * Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS plugin. Geneve will be used as the encapsulation method for tenant networks * A new answerfile was created in: /root/packstack-answers-20210225-204841.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 192.166.66.6. To use the command line tools you need to source the file. * To access the OpenStack Dashboard browse to http://192.166.66.6/dashboard . Please, find your login credentials stored in the keystonerc_admin in your home directory. * The installation log file is available at: /var/tmp/packstack/20210225-204839-3dgxy1c1/openstack-setup.log * The generated manifests are available at: /var/tmp/packstack/20210225-204839-3dgxy1c1/manifests
-
通過生成的鏈接
http://192.166.66.6/dashboard
訪問OpenStack儀表板登錄賬號密碼在keystonerc_admin文件中查看
登錄成功頁面
之后就可以使用界面自己玩耍啦,創建卷、快照、鏡像、網絡、安全組,又或者項目、角色、用戶等盡情嘗試吧!
當然也可以使用openstack命令
使用命令前需要加載環境變量,執行命令
source keystonerc_admin
或. keystonerc_admin
在安裝過程中有出現報錯:ERROR : Error appeared during Puppet run: 192.166.66.6_controller.pp,導致安裝終止,這個報錯原因多半是沒有/etc/hosts文件中添加本地解析導致,也可能是網絡問題,若完全按照上面步驟操作依然出現此報錯,建議更換網絡試一下
其它方式安裝可以參考這三篇文章
Centos 8使用devstack快速安裝openstack最新版
Centos 8安裝部署openstack Victoria版
Ubuntu 20使用devstack快速安裝openstack最新版