从零开始搭建OpenStack-基础环境准备

1、基础环境准备

  • OpenStack主要把底层多台服务器资源分为三类:计算、网络、存储,用户可以通过OpenStack提供的web界面直接在OpenStack上启动虚拟机实例。
  • 本次以openstack R版为例,其中各服务器角色如下:
从零开始搭建OpenStack-基础环境准备
  • 设置时间同步
# yum 安装 ntp
yum -y install ntp ntpdate ntp-doc
# 校对系统时钟
ntpdate 0.cn.pool.ntp.org
  • 设置hostname和host文件
#设置计算机名
hostnamectl set-hostname master
hostnamectl set-hostname node1
hostnamectl set-hostname node2

#设置host
echo "192.168.23.45 master " >> /etc/hosts
echo "192.168.23.46 node1 " >> /etc/hosts
echo "192.168.23.47 node2 " >> /etc/hosts

#发送到其余节点
scp /etc/hosts node1:/etc/ node2:/etc
  • 关闭selinux、iptables和NetworkManager
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#关闭selinux
setenforce 0
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config

ssh node1 'sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config'
ssh node2 'sed -i 's@SELINUX=enforcing@SELINUX=disabled@g' /etc/selinux/config'
ssh node1 'setenforce 0 && getenforce'
ssh node2 'setenforce 0 && getenforce'

systemctl stop firewalld NetworkManager
systemctl disable firewalld NetworkManager 

ssh node1 'systemctl stop firewalld NetworkManager && systemctl disable firewalld NetworkManager'
ssh node2 'systemctl stop firewalld NetworkManager && systemctl disable firewalld NetworkManager'

2、基础包安装

  • 由于每台服务器均是最小化安装,因此还需要安装一些基础包:
yum install -y vim wget tree lrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop lsof ntpdate telnet bridge-utils;
  • 配置阿里云的base仓库和epel仓库包
[root@master ~]# rm -rf /etc/yum.repos.d/*.repo
[root@master ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@master ~]#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@master ~]#scp /etc/yum.repos.d/Centos-Base.repo node1:/etc/yum.repos.d/
[root@master ~]#scp /etc/yum.repos.d/epel.repo node1:/etc/yum.repos.d/
[root@master ~]#scp /etc/yum.repos.d/Centos-Base.repo node2:/etc/yum.repos.d/
[root@master ~]#scp /etc/yum.repos.d/epel.repo node2:/etc/yum.repos.d/
  • 配置OpenStack R版的yum仓库
[root@master ~]yum install centos-release-openstack-rocky -y
  • 各节点安装python-openstackclient和openstack-selinux包
[root@master ~]yum install -y python-openstackclient openstack-selinux

原创文章,作者:jacky,如若转载,请注明出处:https://kubiyun.com/archives/417

(0)
上一篇 2026-01-30 09:42
下一篇 2026-02-04 11:56

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

评论列表(1条)

  • this review的头像
    this review 2026-03-01 17:16

    Attractive section of content. I just stumbled
    upon your site and in accession capital to assert
    that I get actually enjoyed account your blog posts.
    Any way I will be subscribing to your augment and even I achievement you access consistently rapidly.