在CentOS8上用PackStack安装OpenStack-ussuri

环境和规划

OS : CentOS 8 64bits Minimal
CPU: 6 vCPU
RAM: 32GB
HDD1: /dev/sda  -> 512GB
HDD2: /dev/sdc  -> 1TB
NIC: 一个网络接口(eno1)
IP ADDRESS: 192.168.5.59

os和openstack服务安装于/dev/sda上,
磁盘 /dev/sdc用于 cinder-volumes

安装centos8和相关依赖包

最简化安装centos8,采用阿里云Repo

# 先备份
$ cd /etc/yum.repos.d
$ mkdir repo\_backup
$ mv \*.repo repo\_backup
# 拉阿里云源
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
# 清缓存
$ dnf clean all
# 更新元数据
$ dnf makecache
$ dnf -y update

安装常用软件和包

# 常用软件
$ dnf -y install wget curl telnet vim

# 虚拟环境依赖
$ dnf -y install network-scripts qemu-kvm libvirt libvirt-client genisoimage virt-install python-openvswitch openvswitch

# bridge-utils 需要手动下载安装
$ wget https://download-ib01.fedoraproject.org/pub/fedora-secondary/releases/30/Everything/i386/os/Packages/b/bridge-utils-1.6-3.fc30.i686.rpm
$ dnf install ./bridge-utils-1.6-3.fc30.i686.rpm
$ dnf install -y 

# 开启powertools
$ dnf config-manager --enable PowerTools

设置hostname

$ hostnamectl set-hostname openstack --static

关闭相关服务

关闭SELinux

$ setenforce 0
$ sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

关闭防火墙

$ sudo systemctl disable firewalld
$ sudo systemctl stop firewalld

停用新的NetworkManager,启用旧的network服务

$ systemctl disable NetworkManager
$ systemctl stop NetworkManager
$ systemctl enable network
$ systemctl start network

打开openvswitch服务

$ systemctl enable openvswitch
$ systemctl restart openvswitch

创建cinder-volumes

分区/dev/sdc

$ fdisk /dev/sdc

将磁盘纳入lvm控制

$ pvcreate /dev/sdc1

创建volume组

$ vgcreate cinder-volumes /dev/sdc1

查看,保证设置正确

$ pvs
  PV         VG             Fmt  Attr PSize    PFree
  /dev/sda3  cl             lvm2 a--   464.17g 278.48g
  /dev/sdc1  cinder-volumes lvm2 a--  <931.51g  46.35g
  
$ vgs
  VG             #PV #LV #SN Attr   VSize    VFree
  cinder-volumes   1   4   0 wz--n- <931.51g  46.35g

配置OVS网桥

现有网卡eno1,加入br-ex网桥

# 创建网卡并加入网桥,该操作会导致断网
$ ovs-vsctl --may-exist add-br br-ex   
$ ovs-vsctl --may-exist add-port br-ex eno1

修改network-scripts/ifcfg设置

# 备份配置
$ cp /etc/sysconfig/network-scripts/ifcfg-eno1 /etc/sysconfig/network-scripts/ifcfg-eno1.bak

设置完毕后如下

$ cat /etc/sysconfig/network-scripts/ifcfg-eno1
TYPE="OVSPort"
NAME="eno1"
DEVICE="eno1"
DEVICETYPE="ovs"
ONBOOT=yes
BOOTPROTO="none"
OVS_BRIDGE="br-ex"

$ cat /etc/sysconfig/network-scripts/ifcfg-br-ex
PROXY_METHOD="none"
BROWSER_ONLY="no"
DEFROUTE="yes"
UUID="6a9c93e4-8112-4638-bee3-862dbb5b714d"
ONBOOT="yes"
IPADDR="192.168.5.59"
PREFIX="24"
GATEWAY="192.168.5.1"
NETMASK="255.255.255.0"
DNS1="xxx.xxx.xxx.xxx"
DEVICE="br-ex"
NAME="br-ex"
DEVICETYPE="ovs"
OVSBOOTPROTO="static"
TYPE="OVSBridge"
OVS_EXTRA="set bridge br-ex fail_mode=standalone"

重启网络

$ ifconfig br-ex down  
$ ifup br-ex   
$ ifdown em1   
$ ifup eno1

查看,保证设置正确性

$ ovs-vsctl show

重启

$ reboot -f

安装packstack并生成应答文件

$ dnf install -y centos-release-openstack-ussuri
$ dnf update -y

# 安装Installer
$ dnf install -y openstack-packstack

# 生成应答文件
$ packstack --gen-answer-file=/root/answer-file.ini

设置应答文件

CONFIG_CONTROLLER_HOST=192.168.5.59
CONFIG_COMPUTE_HOSTS=192.168.5.59
CONFIG_NETWORK_HOSTS=192.168.5.59

# 禁用demo环境
CONFIG_PROVISION_DEMO=n

# 设置admin用户密码为adminpass
CONFIG_KEYSTONE_ADMIN_PW=adminpass

# 设置为n,使用/dev/sdc1的cinder-volumes
CONFIG_CINDER_VOLUMES_CREATE=n

# cinder后端采用lvm
CONFIG_CINDER_BACKEND=lvm

# 设置cinder-volumes大小
CONFIG_CINDER_VOLUMES_SIZE=930G

CONFIG_NEUTRON_L3_EXT_BRIDGE=br-ex
CONFIG_NEUTRON_ML2_TYPE_DRIVERS=geneve,flat
CONFIG_NEUTRON_ML2_FLAT_NETWORKS=extnet
CONFIG_NEUTRON_ML2_VLAN_RANGES=extnet:1000:1999

# ovs网桥映射
CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=extnet:br-ex

CONFIG_NEUTRON_OVS_EXTERNAL_PHYSNET=extnet

CONFIG_NEUTRON_OVN_BRIDGE_MAPPINGS=extnet:br-ex

CONFIG_NEUTRON_OVN_EXTERNAL_PHYSNET=extnet

安装

$ packstack --answer-file=/root/answer-file.ini

访问

http://192.168.5.59
admin / adminpass

你可能感兴趣的:(openstack,运维)