侧边栏壁纸
博主头像
聆尘风博主等级

欲买桂花同载酒,终不似,少年游

  • 累计撰写 73 篇文章
  • 累计创建 17 个标签
  • 累计收到 6 条评论

目 录CONTENT

文章目录

Openstack搭建

聆尘风
2024-06-25 / 0 评论 / 1 点赞 / 45 阅读 / 12622 字

Centos7单机部署openstack ——All In One

前期准备:

一.准备一台虚拟机

8G

8核

100G磁盘

手动分区

/home 41.12GiB

/boot 512MiB

/ 50.5Gib

swap 4096MiB

centos-root 挂载点/

期望容量 70 GiB

接受更改后点击完成

开启以太网,必须开启ens33

暂时不修改主机名

禁用Kdump

设置root密码

二.ssh连接

1.完成后登录查看地址

ip a

2.关闭防火墙,禁用防火墙

systemctl stop firewalld
systemctl disable firewalld

3.测试连接

ping baidu.com

三.安装前设置

4.禁用防火墙

systemctl disable firewalld

5.禁用selinux

vi /etc/selinux.config
# 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  #这里设置为disable
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

6.保存退出后重启虚拟机

reboot

7.启用network服务 ——一定要!!!

systemctl enable network
systemctl start network

8.修改主机名以及映射

hostnamectl set-hostname openstack
vi /etc/hosts
#在最后添加 ip  hostname  hostname.localdomain
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.35   openstack openstack.localdomain
保存退出后测试ping通主机名
[root@localhost ~]# ping openstack
PING openstack (192.168.200.354) 56(84) bytes of data.
64 bytes from openstack (192.168.200.35): icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from openstack (192.168.200.35): icmp_seq=2 ttl=64 time=0.046 ms
^Z
[1]+  已停止               ping openstack

9.进行时间同步

[root@localhost ~]# yum install -y chrony
已加载插件:fastestmirror
Determining fastest mirrors
* base: ftp.sjtu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.ustc.edu.cn
base                                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                    | 2.9 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                                              | 153 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                                          | 253 kB  00:00:00     
(3/4): base/7/x86_64/primary_db                                                                                            | 6.1 MB  00:00:05     
(4/4): updates/7/x86_64/primary_db                                                                                         |  26 MB  00:00:24     
正在解决依赖关系
--> 正在检查事务
---> 软件包 chrony.x86_64.0.3.4-1.el7 将被 安装
--> 正在处理依赖关系 libseccomp.so.2()(64bit),它被软件包 chrony-3.4-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 libseccomp.x86_64.0.2.3.1-4.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================================================
Package                              架构                             版本                                  源                              大小
==================================================================================================================================================
正在安装:
chrony                               x86_64                           3.4-1.el7                             base                           251 k
为依赖而安装:
libseccomp                           x86_64                           2.3.1-4.el7                           base                            56 k
事务概要
==================================================================================================================================================
安装  1 软件包 (+1 依赖软件包)
总下载量:307 k
安装大小:788 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/libseccomp-2.3.1-4.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEYkB  00:00:42 ETA 
libseccomp-2.3.1-4.el7.x86_64.rpm 的公钥尚未安装
(1/2): libseccomp-2.3.1-4.el7.x86_64.rpm                                                                                   |  56 kB  00:00:14     
(2/2): chrony-3.4-1.el7.x86_64.rpm                                                                                         | 251 kB  00:00:35     
--------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                              8.7 kB/s | 307 kB  00:00:35     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
软件包     : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装    : libseccomp-2.3.1-4.el7.x86_64                                                                                                 1/2 
正在安装    : chrony-3.4-1.el7.x86_64                                                                                                       2/2 
验证中      : libseccomp-2.3.1-4.el7.x86_64                                                                                                1/2 
验证中      : chrony-3.4-1.el7.x86_64                                                                                                       2/2 
已安装:
chrony.x86_64 0:3.4-1.el7                                                                                                                       
作为依赖被安装:
libseccomp.x86_64 0:2.3.1-4.el7                                                                                                                 
完毕!
[root@localhost ~]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3
server ntp1.aliyun.com iburst #__________添加这一行_________
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *
# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2
# Allow NTP client access from local network.
"/etc/chrony.conf" 39L, 1138C written
[root@localhost ~]# 

四.安装openstack

[root@localhost ~]# yum -y install centos-release-openstack-train
已安装:
centos-release-openstack-train.noarch 0:1-1.el7.centos                                                                                          
作为依赖被安装:
centos-release-ceph-nautilus.noarch 0:1.2-2.el7.centos                  centos-release-nfs-ganesha28.noarch 0:1.0-3.el7.centos                 
centos-release-qemu-ev.noarch 0:1.0-4.el7.centos                        centos-release-storage-common.noarch 0:2-2.el7.centos                  
centos-release-virt-common.noarch 0:1-1.el7.centos                     
作为依赖被升级:
centos-release.x86_64 0:7-9.2009.1.el7.centos                                                                                                   
完毕!
[root@localhost ~]# yum -y install openstack-packstack
rubygem-io-console.x86_64 0:0.4.2-39.el7_9                           rubygem-json.x86_64 0:1.7.7-39.el7_9                                      
rubygem-pathspec.noarch 0:0.2.1-3.el7                                rubygem-psych.x86_64 0:2.0.0-39.el7_9                                     
rubygem-rdoc.noarch 0:4.0.0-39.el7_9                                 rubygem-rgen.noarch 0:0.6.6-2.el7                                         
rubygems.noarch 0:2.0.14.1-39.el7_9                                  yaml-cpp.x86_64 0:0.5.1-6.el7                                             
作为依赖被升级:
libselinux.x86_64 0:2.5-15.el7   libselinux-python.x86_64 0:2.5-15.el7   libselinux-utils.x86_64 0:2.5-15.el7   libsepol.x86_64 0:2.5-10.el7  
完毕!

10.挂起虚拟机,拍摄快照,防止出意外

五.使用openstack --allinone安装

[root@openstack ~]#  packstack --allinone
Welcome to the Packstack setup utility
The installation log file is available at: /var/tmp/packstack/20240423-141738-Yav4Yc/openstack-setup.log
Packstack changed given value  to required value /root/.ssh/id_rsa.pub
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 ]

需要等很久,出现successfully就是成功le

输入http://192.168.200.35直接访问Openstack主页

查看admin默认密码

cat keystonerc_admin

登陆进去为主页

然后去右上角设置修改密码

修改后重新登陆即可

我自己设置的为000000,根据自己进行设置密码

1

评论区