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

记录一台单节点物理服务器使用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 '192.168.100.106  localhost' >>/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 CONFIG_SWIFT_INSTALL=n  #y-n SWIFT是OpenStack的对象存储组件,默认是Y,在生产环境中一般是不装,所以改n
50 CONFIG_AODH_INSTALL=n   #y-n 不安装该服务
97 CONFIG_COMPUTE_HOSTS=192.168.100.106 #计算节点ip地址
795 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vxlan,flat
801 CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vxlan
808 CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS=openvswitch
813 CONFIG_NEUTRON_ML2_FLAT_NETWORKS=physnet1      #flat网络这边要设置物理网卡名字
840 CONFIG_NEUTRON_L2_AGENT=openvswitch            #L2网络的代理模式,也可选择linuxbridge
858 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex    #这边要设置物理网卡的名字
869 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0          #这边br-ex:eth0是网络节点的nat网卡,到时候安装完毕之后IP地址会漂到这个上
1181 CONFIG_PROVISION_DEMO=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

回退leatherman版本

#不执行此步骤会故障报错
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

一键部署单节点

[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

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

vim /etc/httpd/conf/ports.conf
#Listen 0.0.0.0:8774    
#Listen 0.0.0.0:8775
Listen 0.0.0.0:8778
Listen 5000
Listen 80
Listen 8041
Listen 8777

systemctl restart httpd.service openstack-nova-api.service

#8774和8775端口是nova-api使用的端口
[21:17 root@localhost ~]# netstat -lntup|grep 877
tcp        0      0 0.0.0.0:8775            0.0.0.0:*               LISTEN      24150/python2       
tcp        0      0 0.0.0.0:8776            0.0.0.0:*               LISTEN      9917/python2        
tcp        0      0 0.0.0.0:8778            0.0.0.0:*               LISTEN      23780/httpd         
tcp        0      0 0.0.0.0:8774            0.0.0.0:*               LISTEN      24150/python2 
tcp6       0      0 :::8777                 :::*                    LISTEN      23780/httpd

命令行查看openstack

#使用admin用户的变量文件
[root@openstack ~]# source ~/keystonerc_admin
[root@openstack ~]# cat keystonerc_admin 
export OS_USERNAME=admin
export OS_PASSWORD='lichenxing.1314'
export OS_REGION_NAME=RegionOne
export OS_AUTH_URL=http://10.0.1.120:5000/v3
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3

[21:31 root@localhost ~]# openstack network agent list
+--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host      | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+
| 1f21f477-6457-4cd9-b74f-6e71c3de8bc4 | Metering agent     | openstack | None              | :-)   | UP    | neutron-metering-agent    |
| ae92acb9-fa3c-440e-9d79-37e7d634ca27 | L3 agent           | openstack | nova              | :-)   | UP    | neutron-l3-agent          |
| d5282204-e084-44f1-b3ce-434bb8345d76 | Open vSwitch agent | openstack | None              | :-)   | UP    | neutron-openvswitch-agent |
| f2e0a4fc-afe6-4d45-97f1-04a128d16ee4 | Metadata agent     | openstack | None              | :-)   | UP    | neutron-metadata-agent    |
| f615c007-95a2-4450-ae3f-2603e97bf5d5 | DHCP agent         | openstack | nova              | :-)   | UP    | neutron-dhcp-agent        |
+--------------------------------------+--------------------+-----------+-------------------+-------+-------+---------------------------+

上传镜像启动实例

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

创建需要的网络环境

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,997评论 6 502
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,603评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 163,359评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,309评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,346评论 6 390
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,258评论 1 300
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,122评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,970评论 0 275
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,403评论 1 313
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,596评论 3 334
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,769评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,464评论 5 344
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,075评论 3 327
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,705评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,848评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,831评论 2 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,678评论 2 354