目录
(一)安装前的准备
主机名 | IP地址 | 网卡 | 网关 | DNS | 虚拟网卡 | 操作系统 |
---|---|---|---|---|---|---|
openstack | 10.0.15.100 | VM net8 | 10.0.15.2 | 114.114.114.114 | br-ex | centos7.4 |
1、初始化
[root@localhost ~]# hostnamectl set-hostname openstack
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPADDR=10.0.15.200
NETMASK=255.255.255.0
DNS1=114.114.114.114
GATEWAY=10.0.15.2
NAME=eth0
UUID=9626c5da-56c5-4750-8ee8-53513b8d4833
DEVICE=eth0
ONBOOT=yes
[root@localhost ~]# 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
# 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
[root@openstack ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.15.200 openstack
[root@localhost ~]# reboot
2、修改yum仓库
[root@openstack ~]# rm -rfv /etc/yum.repos.d/*
removed ‘/etc/yum.repos.d/CentOS-Base.repo’
removed ‘/etc/yum.repos.d/CentOS-CR.repo’
removed ‘/etc/yum.repos.d/CentOS-Debuginfo.repo’
removed ‘/etc/yum.repos.d/CentOS-Media.repo’
removed ‘/etc/yum.repos.d/CentOS-Sources.repo’
removed ‘/etc/yum.repos.d/CentOS-Vault.repo’
removed ‘/etc/yum.repos.d/CentOS-fasttrack.repo’
[root@openstack ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 23227 0 --:--:-- --:--:-- --:--:-- 23361
[root@openstack ~]# sed -i /aliyuncs/d /etc/yum.repos.d/*.repo
[root@openstack ~]# yum clean all;yum repolist all
3、linux必要软件包安装
[root@openstack ~]# yum install vim bash-completion tree net-tools wget lrzsz zip unzip -y
(二)安装过程
1、安装openstack软件库
[root@openstack ~]# yum install centos-release-openstack-stein -y
2、安装Packstack工具
[root@openstack ~]# yum install openstack-packstack -y
3、一键部署openstack(需要等待一段时间)
[root@openstack ~]# packstack --allinone
(三)安装后的调整
1、生成虚拟网桥
[root@openstack ~]# cd /etc/sysconfig/network-scripts/
[root@openstack network-scripts]# cp ifcfg-eth0 ifcfg-br-ex
[root@openstack network-scripts]# vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
[root@openstack network-scripts]# vi ifcfg-br-ex
IPADDR=10.0.15.200
NETMASK=255.255.255.0
GATEWAY=10.0.15.2
DNS1=114.114.114.114
OTPROTO=none
DEFROUTE=yes
NAME=br-ex
DEVICE=br-ex
ONBOOT=yes
PEERDNS=no
NM_CONTROLLED=no
[root@openstack network-scripts]# ovs-vsctl add-port br-ex eth0 (命令执行后远程连接会断开,在虚拟机里执行systemctl restart network)
2、查看登陆密码
[root@openstack ~]# cat keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD='09012425534d4139'
export OS_REGION_NAME=RegionOne
export OS_AUTH_URL=http://10.0.15.200:5000/v3
export PS1='[\u@\h \W(keystone_admin)]\$ '
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
3、登陆访问
4、登陆成功
(四)安装备注
1、可能碰到的问题及解决方法
使用了epel源,将leatherman更新。不使用epel源,将不会碰到这个问题 leatherman 版本过高
[root@openstack ~]# yum downgrade leatherman -y
卸载后执行(file为root家目录下的一个以时间和日期命名的.txt文化)
[root@openstack ~]# packstack --answer-file=
未安装python2-qpid-proton
[root@openstack ~]# yum install python2-qpid-proton -y
2、安装完成后家目录下生成文件的作用
###安装完成后家目录下生成了以下三个文件
packstack-answers-20220307-042836.txt ###allinone自动应答文件,里面包含了openstack创建时需要的配置信息,例如admin用户的登陆密码,各组件的数据库密码,物理网络名称等等
keystonerc_admin ###admin用户的环境变量,管理openstack前必须使用,使用方法 . keystonerc_admin 或者 source keystonerc_admin
keystonerc_demo ###demo用户的环境变量