1. 创建devstack用户
sudo useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo su - stack
2. 拉取devstack git库(这里指定的是queens版本)
git clone https://git.openstack.org/openstack-dev/devstack --branch stable/queens
3. 进入devstack配置安装
stack@localhost ~]$cd devstack
[stack@localhost devstack]$ vi local.conf
[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git
DOWNLOAD_DEFAULT_IMAGES=False
IMAGE_URLS=http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
HOST_IP=192.168.0.240
SERVICE_IP_VERSION=4
FIXED_RANGE=10.0.0.0/24
FLOATING_RANGE=192.168.200.0/24
PUBLIC_INTERFACE=ens34
PUBLIC_NETWORK_GATEWAY=192.168.200.1
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service neutron
4. 指定devstack国内的镜像源(queens版本)
[root@localhost ~]$ vi /etc/yum.repos.d/local.repo
[openstack]
name=openstack
baseurl=https://mirrors.aliyun.com/centos/7.6.1810/cloud/x86_64/openstack-queens/
enabled=1
gpgcheck=0
[centos7]
name=centos7
baseurl=https://mirrors.aliyun.com/centos/7.6.1810/os/x86_64/
enabled=1
gpgcheck=0
5. root用户目录下配置pip安装源
[root@localhost ~]$ mkdir .pip
[root@localhost ~]$ vi .pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
6.下载指定文件(手动下载防止延迟)
[stack@localhost ~]$cd devstack/files
[stack@localhost files]$wget -c https://github.com/coreos/etcd/releases/download/v3.1.10/etcd-v3.1.10-linux-amd64.tar.gz
[stack@localhost files]$wget -c https://github.com/coreos/etcd/releases/download/v3.1.7/etcd-v3.1.7-linux-amd64.tar.gz
7. 调整防火墙
[root@localhost ~]$vim /etc/selinux/config
SELINUX=permissive
[root@localhost ~]$setenforce 0
[root@localhost ~]$iptables -F
[root@localhost ~]$iptables -X
[root@localhost ~]$iptables -Z
8.安装devstack
[stack@localhost ~]$cd devstack
[stack@localhost devstack]$ ./stack
9.启动和关闭devstack
启动所有服务
sudo systemctl start devstack@*
关闭指定服务
sudo systemctl stop devstack@n-*
参考文档 https://docs.openstack.org/devstack/latest/