系统说明
服务器操作系统:Centos7
开发环境:VMware workstation Pro
OpenStack版本:stein
操作步骤
备份yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
运行 yum makecache
生成缓存
yum -y update
使用packstack 工具一键部署openstack
修改cento系统的主机名
hostnamectl set-hostname openstack
添加主机hosts记录
echo "172.17.2.60 openstack" >> /etc/hosts #将172.17.2.60修改为自己的虚拟机IP
echo "172.17.2.60 openstack.localdomain" >> /etc/hosts #将172.17.2.60修改为自己的虚拟机IP
验证修改结果
more /etc/hosts
设置本机SSH免密码登录
生成ssh密钥
ssh-keygen
ssh-copy-id root@172.17.2.60 #将172.17.2.60修改为自己的虚拟机IP
关闭服务
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭SeLinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
关闭NetworManager服务
systemctl stop NetworkManager
systemctl disable NetworkManager
重启
reboot
安装常用软件
yum -y install vim bash-completion yum-utils
修改OpenStack配置文件
移除原系统自带的repo文件,避免和新建的配置文件内容冲突
mkdir ori_repo-config
mv /etc/yum.repos.d/* ./ori_repo-config/
touch /etc/yum.repos.d/CentOS-PrivateLocal.repo
vi /etc/yum.repos.d/CentOS-PrivateLocal.repo
将下列代码复制到CentOS-PrivateLocal.repo文件中
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[centos-openstack-stein]
name=CentOS-7 - OpenStack stein
baseurl=http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-stein/
gpgcheck=0
enabled=1
[centos-qemu-ev]
name=CentOS-$releasever - QEMU EV
baseurl=http://mirrors.aliyun.com/centos/7/virt/x86_64/kvm-common/
gpgcheck=0
enabled=1
[centos-ceph-nautilus]
name=CentOS-7 - Ceph Nautilus
baseurl=http://mirrors.aliyun.com/centos/7/storage/x86_64/ceph-nautilus/
gpgcheck=0
enabled=1
[centos-nfs-ganesha28]
name=CentOS-7 - NFS Ganesha 2.8
baseurl=http://mirrors.aliyun.com/centos/7/storage/x86_64/nfsganesha-28/
gpgcheck=0
enabled=1
或者更换其他源
#清华大学源
curl -o /etc/yum.repos.d/CentOS-PrivateLocal.repo https://mirror.wjcloud.top/CentOS-PrivateLocal-qinghua.repo
#中科大源
curl -o /etc/yum.repos.d/CentOS-PrivateLocal.repo https://mirror.wjcloud.top/CentOS-PrivateLocal-zkd.repo
清除本地yum索引缓存,然后再重建索引缓存
yum clean all
yum makecache
安装packstack工具
yum -y install openstack-packstack
一键安装openstack
packstack --allinone
等待20分钟后安装完成
访问http://虚拟机IP/
查看密码
cat /root/keystonerc_admin
export OS_USERNAME=admin #用户名
export OS_PASSWORD='625d45e5c2bb4330' #密码
一键部署命令
curl -sSL https://mirror.wjcloud.top/quick-openstack.sh -o quick-openstack.sh && sh quick-openstack.sh