#記錄一臺單節點物理服務器使用PackStack部署OpenStack-Train版的操作
戴爾R720
系統:centos7.8.2003
cpu型號: E5-2670v2
2C8核32線程
內存 32G
網絡環境:
eth0 192.168.100.106 物理外網
eth1 172.16.0.106 私有內網
#服務器基礎優化
echo 'net.ipv4.ip_forward=1 ' >>/etc/sysctl.conf
echo 'net.ipv4.tcp_tw_recycle=1 ' >>/etc/sysctl.conf
echo 'net.ipv4.tcp_tw_reuse=1 ' >>/etc/sysctl.conf
sysctl -p
chmod +x /etc/rc.d/rc.local
yum install -y mlocate lrzsz tree vim nc nmap wget bash-completion bash-completion-extras cowsay sl htop iotop iftop lsof net-tools sysstat unzip bc psmisc ntpdate wc telnet-server bind-utils sshpass
echo 'localhost 192.168.100.106' >>/etc/hosts
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
systemctl stop NetworkManager
systemctl disable NetworkManager
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y mlocate lrzsz tree vim nc nmap wget bash-completion bash-completion-extras cowsay sl htop iotop iftop lsof net-tools sysstat unzip bc psmisc ntpdate wc telnet-server bind-utils sshpass
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
yum clean all
yum makecache
ntpdate ntp1.aliyun.com
echo '*/30 * * * * /sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
#安裝train版yum源
yum install centos-release-openstack-train -y
#安裝openstack-packstack工具用於生成openstack應答文件
yum install openstack-packstack -y
packstack --gen-answer-file=openstack.txt
packstack --allinone #allinone模式
packstack --gen-answer-file=<file> #生成部署配置文件
packstack --answer-file=<file> #選擇應答文件
#packstack每個版本的配置文件均有小改動,不要修改錯位置
可以詳細學習一下配置文件的各個模塊的配置參數,可根據自己實際需求更改
[19:57 root@localhost ~]# vim openstack.txt
41行: y-n #SWIFT是OpenStack的對象存儲組件,默認是Y,在生產環境中一般是不裝,所以改n
50行: y-n #不安裝該服務
97行: 10.0.1.120,10.0.1.130 #計算節點ip地址
808 openvswitch
813: physnet1 #flat網絡這邊要設置物理網卡名字
840 openvswitch #L2網絡的代理模式,也可選擇linuxbridge
858: physnet1:br-ex #這邊要設置物理網卡的名字
869: br-ex:eth0 #這邊br-ex:eth0是網絡節點的nat網卡,到時候安裝完畢之後IP地址會漂到這個上
1181: y-n #DEMO是OpenStack聯網下載一個測試鏡像,這邊沒聯網。說以改成n
##更改密碼(123456)
sed -i -r 's/(.+_PW)=.+/\1=123456/' openstack.txt
#備份配置文件
egrep -v "^#|^$" openstack.txt >openstack.txt.bak1
#查看所有的主機ip地址是否都指定到eth0網卡
[20:01 root@localhost ~]# grep 'HOST=' openstack.txt
CONFIG_CONTROLLER_HOST=192.168.100.106
CONFIG_VCENTER_HOST=
CONFIG_STORAGE_HOST=192.168.100.106
CONFIG_SAHARA_HOST=192.168.100.106
CONFIG_AMQP_HOST=192.168.100.106
CONFIG_MARIADB_HOST=192.168.100.106
CONFIG_TEMPEST_HOST=
CONFIG_REDIS_HOST=192.168.100.106
#一鍵部署單節點
[20:15 root@localhost ~]# packstack --answer-file=openstack.txt
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20200614-205624-uEmdI2/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 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 Gnocchi entries [ DONE ]
Preparing Redis entries [ DONE ]
Preparing Ceilometer entries [ DONE ]
Preparing Puppet manifests [ DONE ]
Copying Puppet modules and manifests [ DONE ]
Applying 192.168.100.106_controller.pp
192.168.100.106_controller.pp: [ DONE ]
Applying 192.168.100.106_network.pp
192.168.100.106_network.pp: [ DONE ]
Applying 192.168.100.106_compute.pp
192.168.100.106_compute.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.
* File /root/keystonerc_admin has been created on OpenStack client host 192.168.100.106. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://192.168.100.106/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/20200614-205624-uEmdI2/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20200614-205624-uEmdI2/manifests
#packstack部署禁止了openstack的dashbrard界面對域的支持,需要可打開
vim /etc/openstack-dashboard/local_settings
79 OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
85 OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
461 TIME_ZONE = "Asia/Shanghai" #配置時區爲亞洲上海
systemctl restart httpd.service memcached.service
#故障報錯
facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory
leatherman rpm包版本問題
[20:06 root@localhost ~/openstack]# yum list | grep leatherman
leatherman.x86_64 1.10.0-1.el7 @epel
leatherman-devel.x86_64 1.10.0-1.el7 epel
而facter需要1.3.0
[20:09 root@localhost ~/openstack]# facter -p
facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory
回退leatherman版本
yum downgrade leatherman -y