02-单节点的OpenStack一体化部署

2020-07-22  本文已影响0人  小巫吞金兽

在安装centos7的计算机中通过RDO的packstack安装工具自动安装单节点OpenStack测试平台,这里用的OpenStack版本为Queens。

1、准备安装的基础环境

①安装带图形界面的centos7.5操作系统(这里不在阐述)

②装完系统后,查看网络是否可用

[root@localhost ~]# ifconfig ens33

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.136.129  netmask 255.255.255.0  broadcast 192.168.136.255

        inet6 fe80::f33c:4348:bfa7:f870  prefixlen 64  scopeid 0x20<link>

        ether 00:0c:29:82:0e:68  txqueuelen 1000  (Ethernet)

        RX packets 93  bytes 12781 (12.4 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 122  bytes 13299 (12.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# ping www.baidu.com #验证网络是否连接外网

PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.

64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=128 time=5.84 ms

64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=128 time=9.24 ms

③查看yum源是否可用

[root@localhost ~]# yum repolist

已加载插件:fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.bit.edu.cn

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

源标识                                  源名称                                    状态

base/7/x86_64                          CentOS-7 - Base                            10,070

extras/7/x86_64                        CentOS-7 - Extras                            397

updates/7/x86_64                        CentOS-7 - Updates                            862

repolist: 11,329

④修改主机名

[root@localhost ~]# hostnamectl set-hostname openstack.cn

[root@localhost ~]# hostname

openstack.cn

⑤修改selinux为disabled

[root@localhost ~]# vim /etc/selinux/config  #修改配置文件

SELINUX=disabled

[root@localhost ~]# reboot     #修改为disabled时,一定要重启系统,才能生效

⑥禁用防火墙

[root@openstack ~]# systemctl disable firewalld# 禁用防火墙

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@openstack ~]# systemctl stop firewalld #禁用防火墙

[root@openstack ~]# systemctl status firewalld  #查看防火墙状态

● firewalld.service - firewalld - dynamic firewall daemon

  Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

  Active: inactive (dead)  # 防火墙此时必须是dead状态

    Docs: man:firewalld(1)

6月 29 10:46:10 openstack.cn systemd[1]: Starting firewalld - dynamic firewall daemon...

6月 29 10:46:11 openstack.cn systemd[1]: Started firewalld - dynamic firewall daemon.

6月 29 10:50:33 openstack.cn systemd[1]: Stopping firewalld - dynamic firewall daemon...

6月 29 10:50:34 openstack.cn systemd[1]: Stopped firewalld - dynamic firewall daemon.

⑦禁用NetworkManager服务

centos7的网络默认由NetworkManager(网络管理器)负责管理,但NetworkManager服务与OpenStack网络组建的Neturon有冲突,因此必须停用它,改成传统的网络服务Network来管理服务。

[root@openstack ~]# systemctl disable NetworkManager #禁用NetworkManager

Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.

Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.

Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.

Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.

[root@openstack ~]# systemctl stop NetworkManager #禁用NetworkManager

[root@openstack ~]# systemctl start network #重启传统网络服务network

[root@openstack ~]# systemctl enable network #开机自启动传统网络服务network

[root@openstack ~]# ping www.baidu.com   #验证网络的可以用性

PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.

64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=1 ttl=128 time=5.84 ms

64 bytes from 61.135.169.121 (61.135.169.121): icmp_seq=2 ttl=128 time=9.24 ms

⑧设置主机名解析

每个节点都要设置可识别的主机名,通过 /etc/hosts文件来提供各节点主机的名称解析

注意:所有节点的主机名都要提供解析,各节点上的127.0.0.1的名称解析必须保留,不能删除。要保证各个节点能够连接Internet,且每个节点的ip地址和主机名能够互相解析。

[root@openstack ~]# vim /etc/hosts

192.168.136.129 openstack.cn  openstack    #文件的末尾处添加此命令

[ip地址]  [域名]  [主机名]

⑨更改语言编码

如果centos7安装的是非英文版本,需要更改语言编码

[root@openstack ~]# vim /etc/environment  #设置英文环境

LANG=en_US.utf-8     

LC_ALL=en_US.utf-8

⑩设置时间同步

[root@openstack ~]# yum -y install chrony   #安装事假同步NTP包

[root@openstack ~]# vim /etc/chrony.conf  #修改配置文件 ,指向阿里云同步

server ntp1.aliyun.com iburst #阿里云ntp同步时间

allow 0/0  #允许所有计算机连接此时间服务器

[root@openstack ~]# systemctl restart chronyd #重启时间同步chronyd服务

[root@openstack ~]# chronyc sourcestats #检查源时间服务器状态

210 Number of sources = 5

Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev

==============================================================================

amy.chl.la                  0  0    0    +0.000  2000.000    +0ns  4000ms

makaki.miuku.net            9  6  1039    -2.924    16.830    +26ms  3509us

119.28.183.184            20  13  21m    -2.790    15.150    +17ms  6024us

time.cloudflare.com        23  9  54m    -5.858    14.740    +20ms    16ms

120.25.115.20              22  15  55m    +0.000      1.979    +24ns  1530us

[root@openstack ~]# chronyc sources #检查设置的源时间服务器

210 Number of sources = 5

MS Name/IP address        Stratum Poll Reach LastRx Last sample             

===============================================================================

^? amy.chl.la                    0  10    0    -    +0ns[  +0ns] +/-    0ns

^- makaki.miuku.net              2  7  377    11    +26ms[  +26ms] +/-  96ms

^- 119.28.183.184                2  7  377  106    +18ms[  +18ms] +/-  67ms

^- time.cloudflare.com          3  8  377  128  +4783us[+4783us] +/-  137ms

^* 120.25.115.20                2  8  377  391  -2181us[-2156us] +/-  25ms

注意:只要有^*就有同步

*********************************************

2、准备所需的软件库

[root@openstack ~]# yum -y install centos-release-openstack-queens  #安装centos-release-openstack-queens

[root@openstack ~]# yum-config-manager  --enable openstack-queens #确保openstack-queens可用

[root@openstack ~]#yum update -y #升级所有包,并升级内核

[root@openstack ~]#yum -y install yum-plugin-priorities #安装yum-plugin-priorities插件用于设置yum调用软件源顺序

[root@openstack ~]#cd  /etc/yum.repos.d/  #进入yum.repos.d目录

[root@openstack ~]#curl -O https://trunk.rdoproject.org/centos7/delorean-deps.repo  #下载delorean-deps.repo

[root@openstack ~]#curl -O https://trunk.rdoproject.org/centos7/current-passed-ci/delorean.repo  #下载delorean.repo 

[root@openstack ~]#yum update -y #升级所有包,并升级内核

************************************************

3、安装packstack安装器

[root@openstack ~]#yum install -y openstack-packstack #安装过程需要安装很多依赖包

************************************************

4、运行packstack安装OpenStack

使用"All-in-One"方式进行单节点部署

[root@openstack ~]# packstack  --allinone

Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20200629-131314-8mFyAb/openstack-setup.log

Packstack changed given value  to required value /root/.ssh/id_rsa.pub

Installing:

Clean Up                                             [DONE ]

Discovering ipprotocol version                      [DONE ]

# 设置SSH密钥

Setting up sshkeys                                  [ DONE ]

# 准备服务器

Preparing servers                                    [ DONE ]

# 安装Puppet和探测主机详情之前

Pre installing Puppet and discovering

hosts' details [ DONE ]

# 准备预装的项目

Preparing pre-install entries                        [ DONE ]

# 设置证书

Setting up CACERT                                    [ DONE ]

# 准备AMQP(高级消息队列协议)项目

Preparing AMQP entries                               [ DONE ]

# 准备MariaDB(现已代替MySQL)数据库项目

Preparing MariaDBentries                            [ DONE ]

# 修正Keystone LDAP参数

Fixing Keystone LDAP configparameters to be undef if

empty[ DONE ]

# 准备Keystone(认证服务)项目

Preparing Keystone entries                           [ DONE ]

# 准备Glance(镜像服务)项目

Preparing Glance entries                             [ DONE ]

# 检查Cinder(卷存储服务)是否有卷

Checking if the Cinder server has a

cinder-volumes vg[ DONE ]

# 准备Cinder(卷存储服务)项目

Preparing Cinder entries                             [ DONE ]

# 准备Nova API(Nova对外接口)项目

Preparing Nova API entries                           [ DONE ]

# 为Nova迁移创建SSH密钥

Creating sshkeys for Nova migration                 [ DONE]

Gathering sshhost keys for Nova migration           [ DONE]

# 准备Nova Compute(计算服务)项目

Preparing Nova Compute entries                       [ DONE ]

# 准备Nova Scheduler(调度服务)项目

Preparing Nova Scheduler entries                     [ DONE ]

# 准备Nova VNC(虚拟网络控制台)代理项目

Preparing Nova VNC Proxy entries                     [ DONE ]

# 准备OpenStack与网络相关的Nova项目

Preparing OpenStackNetwork-related Nova entries     [ DONE ]

# 准备Nova通用项目

Preparing Nova Common entries                        [ DONE ]

# 以下准备Neutron(网络组件)项目

Preparing Neutron LBaaSAgent 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 Agententries             [ DONE ]

Checking if NetworkManagerisenabled and running    [ DONE ]

# 准备OpenStack客户端项目

Preparing OpenStackClient entries                   [ DONE ]

# 准备Horizon仪表板项目

Preparing Horizon entries                            [ DONE ]

# 以下准备Swift(对象存储)项目

Preparing Swift builder entries                      [ DONE ]

Preparing Swift proxy entries                        [ DONE ]

Preparing Swift storage entries                      [ DONE ]

# 准备Gnocchi(用于计费的时间序列数据库作为服务)项目

Preparing Gnocchi entries                            [ DONE ]

# 准备Redis(用于计费的数据结构服务器)项目

Preparing Redisentries                              [ DONE ]

# 准备Ceilometer(计费服务)项目

Preparing Ceilometer entries                         [ DONE ]

# 准备Aodh(警告)项目

Preparing Aodhentries                               [ DONE]

# 准备Puppet模块和配置清单

Preparing Puppet manifests                          [ DONE ]

Copying Puppet modules and manifests                [ DONE ]

# 应用控制节点(测试时可能需要较长时间)

Applying 192.168.136.129_controller.pp    #在此过程要等待30min左右

192.168.136.129_controller.pp:                      [ DONE ]   

# 应用网络节点(测试时可能需要较长时间)

Applying 192.168.136.129_network.pp

192.168.136.129_network.pp:                          [ DONE ]  

# 应用计算节点(测试时可能需要较长时间)

Applying 192.168.136.129_compute.pp

192.168.136.129_compute.pp:                          [ DONE ]   

# 应用Puppet配置清单

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 or FWaaS services. Geneve will be used as the encapsulation method for tenant networks

# 执行命令产生的应答文件

* A new answerfile was created in: /root/packstack-answers-20200629-131315.txt

# 未安装时间同步。,需要确认CentOS 7当前的系统时间正确,如果不正确,则需要修改

* Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.

# 在用户主目录下产生keystonerc_admin文件,使用命令行工具需要使用它作为授权凭据

* File /root/keystonerc_admin has been created on OpenStack client host 192.168.136.129. To use the command line tools you need to source the file.

# 访问OpenStack Dashboard(Web访问接口),请使用keystonerc_admin中的登录凭据

* To access the OpenStack Dashboard browse to http://192.168.136.129/dashboard .

Please, find your login credentials stored in the keystonerc_admin in your home directory.

* Because of the kernel update the host 192.168.136.129 requires reboot.

# 安装日志文件名及其路径

* The installation log file is available at: /var/tmp/packstack/20200629-131314-8mFyAb/openstack-setup.log

# Puppet配置清单路径

* The generated manifests are available at: /var/tmp/packstack/20200629-131314-8mFyAb/manifests

You have new mail in /var/spool/mail/root

以上利用DRO安装OpenStack过程。整个环境配置及安装大概需要1.5个小时。

上一篇下一篇

猜你喜欢

热点阅读