1. vmware workstation虚拟环境
  2. 系统:centos7.8.2003
  3. cpu型号: 虚拟
  4. 2C832线程
  5. 内存 8G
  6. 网络环境:
  7. ens33 192.168.100.10 私有外网
  8. ens34 192.168.200.10 物理外网
  9. echo 'net.ipv4.ip_forward=1 ' >>/etc/sysctl.conf
  10. echo 'net.ipv4.tcp_tw_recycle=1 ' >>/etc/sysctl.conf
  11. echo 'net.ipv4.tcp_tw_reuse=1 ' >>/etc/sysctl.conf
  12. sysctl -p
  13. chmod +x /etc/rc.d/rc.local
  14. 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
  15. hostnamectl set-hostname controller
  16. echo '192.168.100.10 controller' >>/etc/hosts
  17. systemctl stop firewalld
  18. systemctl disable firewalld
  19. setenforce 0
  20. sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
  21. systemctl stop NetworkManager
  22. systemctl disable NetworkManager
  23. wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  24. curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  25. 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
  26. sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
  27. yum clean all
  28. yum makecache
  29. ntpdate ntp1.aliyun.com
  30. echo '*/30 * * * * /sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
  31. yum install centos-release-openstack-train -y
  32. yum install openstack-packstack -y
  33. packstack --gen-answer-file=openstack.txt
  34. vim编辑 openstack.txt具体修改的内容参考后续。
  35. sed -i -r 's/(.+_PW)=.+/\1=123456/' openstack.txt
  36. #设置所有密码为123456
  37. egrep -v "^#|^$" openstack.txt >openstack.txt.bak1
  38. #备份应答文件
  39. leatherman rpm包版本问题处理:
  40. yum list | grep leatherman
  41. facter -p
  42. yum downgrade leatherman -y
  43. packstack --answer-file=openstack.txt
  44. #packstack --allinone  #allinone模式
  45. #packstack --gen-answer-file=<file>  #生成部署配置文件
  46. #packstack --answer-file=<file>    #选择应答文件

建议大家详细学习一下配置文件的各个模块的配置参数,可根据自己实际需求更改
本次应答文件修改的内容如下:

  1. [19:57 root@localhost ~]# vim openstack.txt
  2. 41 CONFIG_SWIFT_INSTALL=n #y-n SWIFT是OpenStack的对象存储组件,默认是Y,在生产环境中一般是不装,所以改n
  3. 50 CONFIG_AODH_INSTALL=n #y-n 不安装该服务
  4. 97 CONFIG_COMPUTE_HOSTS=192.168.100.10 #计算节点ip地址
  5. 795 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vxlan,flat
  6. 801 CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vxlan
  7. 808 CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS=openvswitch
  8. 813 CONFIG_NEUTRON_ML2_FLAT_NETWORKS=ens33 #flat网络这边要设置物理网卡名字
  9. 840 CONFIG_NEUTRON_L2_AGENT=openvswitch #L2网络的代理模式,也可选择linuxbridge
  10. 858 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=ens33:br-ex #这边要设置物理网卡的名字
  11. 869 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:ens34 #这边br-ex:eth0是网络节点的nat网卡,到时候安装完毕之后IP地址会漂到这个上
  12. 1181 CONFIG_PROVISION_DEMO=n #DEMO是OpenStack联网下载一个测试镜像,这边没联网。说以改成n

更改密码(123456)(参考)

  1. sed -i -r 's/(.+_PW)=.+/\1=123456/' openstack.txt
  2. egrep -v "^#|^$" openstack.txt >openstack.txt.bak1
  3. [20:01 root@localhost ~]# grep 'HOST=' openstack.txt
  4. CONFIG_CONTROLLER_HOST=192.168.200.10
  5. CONFIG_VCENTER_HOST=
  6. CONFIG_STORAGE_HOST=192.168.200.10
  7. CONFIG_SAHARA_HOST=192.168.200.10
  8. CONFIG_AMQP_HOST=192.168.200.10
  9. CONFIG_MARIADB_HOST=192.168.200.10
  10. CONFIG_TEMPEST_HOST=
  11. CONFIG_REDIS_HOST=192.168.200.10
  12. #不执行此步骤会故障报错
  13. facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory
  14. leatherman rpm包版本问题
  15. [20:06 root@localhost ~/openstack]# yum list | grep leatherman
  16. leatherman.x86_64 1.10.0-1.el7 @epel
  17. leatherman-devel.x86_64 1.10.0-1.el7 epel
  18. facter需要1.3.0
  19. [20:09 root@localhost ~/openstack]# facter -p
  20. facter: error while loading shared libraries: leatherman_curl.so.1.3.0: cannot open shared object file: No such file or directory
  21. 回退leatherman版本
  22. yum downgrade leatherman -y
  23. [20:15 root@localhost ~]# packstack --answer-file=openstack.txt
  24. Welcome to the Packstack setup utility
  25. The installation log file is available at: /var/tmp/packstack/20200614-205624-uEmdI2/openstack-setup.log
  26. Installing:
  27. Clean Up [ DONE ]
  28. Discovering ip protocol version [ DONE ]
  29. Setting up ssh keys [ DONE ]
  30. Preparing servers [ DONE ]
  31. Pre installing Puppet and discovering hosts' details [ DONE ]
  32. Preparing pre-install entries [ DONE ]
  33. Setting up CACERT [ DONE ]
  34. Preparing AMQP entries [ DONE ]
  35. Preparing MariaDB entries [ DONE ]
  36. Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
  37. Preparing Keystone entries [ DONE ]
  38. Preparing Glance entries [ DONE ]
  39. Checking if the Cinder server has a cinder-volumes vg[ DONE ]
  40. Preparing Cinder entries [ DONE ]
  41. Preparing Nova API entries [ DONE ]
  42. Creating ssh keys for Nova migration [ DONE ]
  43. Gathering ssh host keys for Nova migration [ DONE ]
  44. Preparing Nova Compute entries [ DONE ]
  45. Preparing Nova Scheduler entries [ DONE ]
  46. Preparing Nova VNC Proxy entries [ DONE ]
  47. Preparing OpenStack Network-related Nova entries [ DONE ]
  48. Preparing Nova Common entries [ DONE ]
  49. Preparing Neutron API entries [ DONE ]
  50. Preparing Neutron L3 entries [ DONE ]
  51. Preparing Neutron L2 Agent entries [ DONE ]
  52. Preparing Neutron DHCP Agent entries [ DONE ]
  53. Preparing Neutron Metering Agent entries [ DONE ]
  54. Checking if NetworkManager is enabled and running [ DONE ]
  55. Preparing OpenStack Client entries [ DONE ]
  56. Preparing Horizon entries [ DONE ]
  57. Preparing Gnocchi entries [ DONE ]
  58. Preparing Redis entries [ DONE ]
  59. Preparing Ceilometer entries [ DONE ]
  60. Preparing Puppet manifests [ DONE ]
  61. Copying Puppet modules and manifests [ DONE ]
  62. Applying 192.168.200.10_controller.pp
  63. 192.168.100.106_controller.pp: [ DONE ]
  64. Applying 192.168.200.10_network.pp
  65. 192.168.100.106_network.pp: [ DONE ]
  66. Applying 192.168.200.10_compute.pp
  67. 192.168.200.10_compute.pp: [ DONE ]
  68. Applying Puppet manifests [ DONE ]
  69. Finalizing [ DONE ]
  70. **** Installation completed successfully ******
  71. Additional information:
  72. * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
  73. * File /root/keystonerc_admin has been created on OpenStack client host 192.168.200.10. To use the command line tools you need to source the file.
  74. * To access the OpenStack Dashboard browse to http://192.168.200.10/dashboard .
  75. Please, find your login credentials stored in the keystonerc_admin in your home directory.
  76. * The installation log file is available at: /var/tmp/packstack/20200614-205624-uEmdI2/openstack-setup.log
  77. * The generated manifests are available at: /var/tmp/packstack/20200614-205624-uEmdI2/manifests

packstack 部署禁止了 openstack 的 dashbrard 界面对域的支持,需要可打开

  1. vim /etc/openstack-dashboard/local_settings
  2. 79 OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
  3. 85 OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
  4. 461 TIME_ZONE = "Asia/Shanghai"
  5. systemctl restart httpd.service memcached.service

因为 packstack 是通过封装 puppet,httpd 的配置端口文件中会生成监控端口的文件,会导致占用了 nova-api 的端口 8774 和 8775,所以禁用掉即可

  1. vim /etc/httpd/conf/ports.conf
  2. #Listen 0.0.0.0:8774
  3. #Listen 0.0.0.0:8775
  4. Listen 0.0.0.0:8778
  5. Listen 5000
  6. Listen 80
  7. Listen 8041
  8. Listen 8777
  9. systemctl restart httpd.service openstack-nova-api.service
  10. #8774和8775端口是nova-api使用的端口
  11. [21:17 root@localhost ~]# netstat -lntup|grep 877
  12. tcp 0 0 0.0.0.0:8775 0.0.0.0:* LISTEN 24150/python2
  13. tcp 0 0 0.0.0.0:8776 0.0.0.0:* LISTEN 9917/python2
  14. tcp 0 0 0.0.0.0:8778 0.0.0.0:* LISTEN 23780/httpd
  15. tcp 0 0 0.0.0.0:8774 0.0.0.0:* LISTEN 24150/python2
  16. tcp6 0 0 :::8777 :::* LISTEN 23780/httpd

Packstack单节点一键部署openstack-Train版 - 图1 Packstack单节点一键部署openstack-Train版 - 图2

查看用户密码:

  1. #使用admin用户的变量文件
  2. [root@openstack ~]# source ~/keystonerc_admin
  3. [root@openstack ~]# cat keystonerc_admin
  4. export OS_USERNAME=admin
  5. export OS_PASSWORD='123456'
  6. export OS_REGION_NAME=RegionOne
  7. export OS_AUTH_URL=http://192.168.200.10:5000/v3
  8. export OS_PROJECT_NAME=admin
  9. export OS_USER_DOMAIN_NAME=Default
  10. export OS_PROJECT_DOMAIN_NAME=Default
  11. export OS_IDENTITY_API_VERSION=3
  12. [21:31 root@localhost ~]# openstack network agent list
  13. +--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+
  14. | ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
  15. +--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+
  16. | 1f21f477-6457-4cd9-b74f-6e71c3de8bc4 | Metering agent | openstack | None | :-) | UP | neutron-metering-agent |
  17. | ae92acb9-fa3c-440e-9d79-37e7d634ca27 | L3 agent | openstack | nova | :-) | UP | neutron-l3-agent |
  18. | d5282204-e084-44f1-b3ce-434bb8345d76 | Open vSwitch agent | openstack | None | :-) | UP | neutron-openvswitch-agent |
  19. | f2e0a4fc-afe6-4d45-97f1-04a128d16ee4 | Metadata agent | openstack | None | :-) | UP | neutron-metadata-agent |
  20. | f615c007-95a2-4450-ae3f-2603e97bf5d5 | DHCP agent | openstack | nova | :-) | UP | neutron-dhcp-agent |
  21. +--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+

这里是提前做好的 centos 镜像
https://www.jianshu.com/p/5c2a63220027

Packstack单节点一键部署openstack-Train版 - 图3

被以下专题收入,发现更多相似内容

https://www.jianshu.com/p/7e99604fe83f