CentOS上使用Packstack安装单节点OpenStack

前言

OpenStack为私有云和公有云提供可扩展的弹性的云计算服务项目目标是提供实施简单、可大规模扩展、丰富、标准统一的云计算管理平台。

环境准备

硬件准备

内存:大于 6G,越大越好
CPU:大于 4核,越多越好
存储:大于 100G,越大越好
网络:至少一个接口,且可以访问互联网
类型:物理机或虚拟机

软件准备

操作系统:CentOS-7-x86_64-DVD-2009
OpenStack 版本:OpenStack-train

前期配置

安装操作系统

最小化安装 CentOS 7.9

关闭 SELinux

临时关闭

[root@localhost ~]# setenforce 0

修改配置文件,永久关闭

[root@localhost ~]# vi /etc/selinux/config

设置 SELINUX 为disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

关闭防火墙

关闭防火墙并设置防火墙为开机不启动

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

修改网卡名称并配置网络

重命名网卡配置文件

[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-ens32 ifcfg-eth0

编辑网卡配置文件

[root@localhost network-scripts]# vi ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static # IP 地址为静态配置
NAME=eth0
DEVICE=eth0 # 网卡设备名
ONBOOT=yes
IPADDR=172.16.8.100 # IP地址
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=172.16.8.2 # 网关
DNS1=114.114.114.114 # 主 DNS

关闭网络管理软件 NetworkManager

[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl disable NetworkManager

修改开机引导文件

[root@localhost ~]# vi /etc/default/grub

spectre_v2=retpoline  后新增 net.ifnames=0 biosdevname=0

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline net.ifnames=0 biosdevname=0 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

重新生成 GRUB 并更新内核参数

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

 配置 yum 软件源

删除已有的 repo 文件

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# rm -fr *

下载在线源文件(这里使用的阿里云的镜像源)

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

更新缓存

[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache

安装基本软件

[root@localhost ~]# yum install -y bash-completion vim net-tools wget ntpdate

 配置时间同步

这里使用的是阿里云的 NTP 授时服务器

[root@localhost ~]# ntpdate ntp.aliyun.com

修改主机名和配置 hosts 文件

[root@localhost ~]# hostnamectl set-hostname controller
[root@localhost ~]# bash
[root@controller ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.8.100 controller

 开始安装

配置 RDO-OpenStack 软件源

配置 epel 源

[root@controller ~]# wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

配置 RDO 源

[root@controller ~]# yum install -y https://rdoproject.org/repos/rdo-release.rpm
[root@controller ~]# vim /etc/yum.repos.d/rdo-release.repo
 [openstack-train]
name=OpenStack Train Repository
baseurl=https://mirrors.aliyun.com/centos/7.9.2009/cloud/$basearch/openstack-train/
# mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=cloud-openstack-train
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud

更新缓存

[root@controller ~]# yum clean all
[root@controller ~]# yum makecache

查看软件缓存列表

[root@controller ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* rdo-qemu-ev: mirrors.163.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,756
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 512
openstack-train/x86_64 OpenStack Train Repository 3,168
rdo-qemu-ev/x86_64 RDO CentOS-7 - QEMU EV 63
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 4,101
repolist: 31,672

 安装依赖包

安装 leatherman 1.3.0-9.el7

[root@controller ~]# yum install -y leatherman-1.3.0-9.el7.x86_64
[root@controller ~]# rpm -q leatherman
leatherman-1.3.0-9.el7.x86_64

安装 python2-qpid-proton-0.26.0-2.el7.x86_64

[root@controller ~]# yum install -y python2-qpid-proton-0.26.0-2.el7.x86_64
[root@controller ~]# rpm -q python2-qpid-proton-0.26.0-2.el7.x86_64
python2-qpid-proton-0.26.0-2.el7.x86_64

 安装 packstack

[root@controller ~]# yum install -y openstack-packstack

 生成 RDO 应答文件

[root@controller ~]# packstack --gen-answer-file=/root/openstack.ini
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
[root@controller ~]# ls
anaconda-ks.cfg openstack.ini

 编辑应答文件

[root@controller ~]# vim openstack.ini

按照以下内容对 openstack.ini  文件进行修改,除修改以下所列项外,其他项不保持变(密码字段,可根据需要自行修改,这里全部配置为了 123456 )

CONFIG_DEFAULT_PASSWORD=123456
CONFIG_AODH_INSTALL=n
CONFIG_MARIADB_USER=root
CONFIG_MARIADB_PW=123456
CONFIG_KEYSTONE_DB_PW=123456
CONFIG_KEYSTONE_ADMIN_EMAIL=root@localhost
CONFIG_KEYSTONE_ADMIN_USERNAME=admin
CONFIG_KEYSTONE_ADMIN_PW=123456
CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vxlan,flat
CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vxlan
CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS=openvswitch
CONFIG_NEUTRON_L2_AGENT=openvswitch
CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=extnet:br-ex
CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0
CONFIG_NEUTRON_OVS_EXTERNAL_PHYSNET=extnet
CONFIG_PROVISION_DEMO=n

开始安装

使用编辑好的应答文件进行安装

[root@controller ~]# packstack --answer-file=/root/openstack.ini
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20220809-155808-CJshER/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 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 172.16.8.100_controller.pp
172.16.8.100_controller.pp: [ DONE ]
Applying 172.16.8.100_network.pp
172.16.8.100_network.pp: [ DONE ]
Applying 172.16.8.100_compute.pp
172.16.8.100_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 172.16.8.100. To use the command line tools you need to source the file.
* To access the OpenStack Dashboard browse to http://172.16.8.100/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/20220809-155808-CJshER/openstack-setup.log
* The generated manifests are available at: /var/tmp/packstack/20220809-155808-CJshER/manifests

验证安装

命令行

导入 OpenStack 访问密钥

[root@controller ~]# source keystonerc_admin

查看 Nova 组件服务

[root@controller ~(keystone_admin)]# nova service-list
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+
| b06dfd75-cec2-4e20-9a3d-a411fbdd1654 | nova-conductor | controller | internal | enabled | up | 2023-09-21T09:03:46.000000 | - | False |
| 3c734ba5-aca7-4d5f-9665-f85ec58a74e3 | nova-scheduler | controller | internal | enabled | up | 2023-09-21T09:03:42.000000 | - | False |
| ee49cbc0-ab81-407a-9711-a8527afoc5bf | nova-compute | controller | nova | enabled | up | 2023-09-21T09:03:47.000000 | - | False |
+--------------------------------------+----------------+------------+----------+---------+-------+----------------------------+-----------------+-------------+

查看服务列表

[root@controller ~(keystone_admin)]# openstack service list
+----------------------------------+------------+--------------+
| ID                               | Name       | Type         |
+----------------------------------+------------+--------------+
| 29b3be88324449118440cd72c1bdc674 | cinderv3   | volumev3     |
| 36ca1b3ef5f44c22951283ecf157d02b | neutron    | network      |
| 5403e654121c4690a28a4b0970857993 | swift      | object-store |
| a6b4198b645d415e9b1a8123cb088078 | aodh       | alarming     |
| bf2149be65344b94aee5ed59f4ae4d9f | nova       | compute      |
| cc39a43522e04d43967a2328d8dab935 | glance     | image        |
| d82544dd2cfe4edc81877b8e7a0dcda6 | ceilometer | metering     |
| e07efd435825458e907e3681881fe27d | keystone   | identity     |
| e9139dc2a30c440b88208de0ca0b78f6 | gnocchi    | metric       |
| ea42fb99e1b542e289105f111f15bc17 | placement  | placement    |
| f019f96acff9429a965770bb099687d0 | cinderv2   | volumev2     |
+----------------------------------+------------+--------------+

访问 dashboard

打开浏览器,访问 http://172.16.8.100/dashboard

输入账号: admin 密码:123456 登录

©版权声明:
作者:xiaofu
文章标题:CentOS上使用Packstack安装单节点OpenStack
文章地址:https://blog.xf0.cc/168.html
作者地址:https://blog.xf0.cc/author/xiaofu
来源:Fu Zai's Notes
文章版权归作者所有,未经允许请勿转载。
THE END
分享
二维码
海报
CentOS上使用Packstack安装单节点OpenStack
前言 OpenStack为私有云和公有云提供可扩展的弹性的云计算服务。项目目标是提供实施简单、可大规模扩展、丰富、标准统一的云计算管理平台。 环境准备 硬件准备……
文章目录
关闭
目 录