一、环境准备
1、环境 centos7-1611 ,硬件:CPU:1vcpu4核;内存:8G;硬盘:100G<br /> 2、双网卡设置:<br /> 网卡1:NAT模式,IP=10.110.84.17<br /> 网卡2:仅主机模式,IP=172.16.100.17<br /> 网络机构如下图:<br />![](https://github.com/meetbill/openstack_install/raw/master/doc/images/env/networklayout.png#from=url&id=GCHYy&margin=%5Bobject%20Object%5D&originHeight=567&originWidth=693&originalType=binary&ratio=1&status=done&style=none)<br /> <br /> 3、修改网卡配置文件:<br /> 网卡1:
[root@controller]# vi /etc/sysconfig/network-scripts/ifcfg-enp8s0
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp8s0"
UUID="9b56649e-ddf3-4c1b-9407-9a2db56ec3e5"
DEVICE="enp8s0"
ONBOOT="yes"
IPADDR="10.110.84.17"
PREFIX="23"
GATEWAY="10.110.84.1"
DNS1="223.5.5.5"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
网卡2:
[root@controller]# vi /etc/sysconfig/network-scripts/ifcfg-enp9s0
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp9s0
UUID=a7058ef0-8087-4cf2-bc34-115a3703b8c6
DEVICE=enp9s0
ONBOOT=yes
IPADDR=172.16.100.17
NETMASK=255.255.255.0
4、重启网络:
systemctl restart network
5、 测试网络连通性。
ping www.baidu.com -c4
7、修改主机名:
修改主机名:
[root@controller ~]# hostnamectl set-hostname controller
按ctrl+d 退出 重新登陆
查看结果:
[root@controller ~]# cat /etc/hostname
controller
[root@controller ~]#
8、设置字符集
检测:
[root@controller ~]# cat /etc/locale.conf
LANG=”zh_CN.UTF-8”
如果不一样,则修改:
[root@controller ~]# localectl
System Locale: LANG=zh_CN.UTF-8
VC Keymap: cn
X11 Layout: cn
9、关闭不必要的服务
[root@controller ~]# systemctl stop postfix.service
[root@controller ~]# systemctl disable postfix.service
[root@controller ~]# systemctl disable firewalld.service
[root@controller ~]# systemctl stop firewalld.service
[root@controller ~]# systemctl status firewalld.service
10,优化selinux
[root@controller ~]# vi /etc/selinux/config
SELINUX=permissive
11、更改yum源:
- 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
CentOS 7 yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
epel源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
- 运行 yum makecache 生成缓存
yum makecache
yum repolist
12、安装常用软件:
yum install vim wget bash-completion lrzsz nmap nc tree htop iftop net-tools -y
二、安装openstack
[root@controller ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@controller ~]# yum install -y openstack-packstack //安装openstack-packstack包
[root@controller ~]# packstack --gen-answer-file=openstack.txt //获得应答文件,去修改安装的参数
[root@controller ~]# ls
anaconda-ks.cfg openstack.txt
[root@controller ~]# vi openstack.txt
19 CONFIG_MARIADB_INSTALL=y //mariadb数据库默认安装,是
22 CONFIG_GLANCE_INSTALL=y //glance镜像组件,开启
25 CONFIG_CINDER_INSTALL=y //cinder块存储,开启
29 CONFIG_MANILA_INSTALL=n //manila组件是openstack的扩展系统,默认是N,不需要更改
32 CONFIG_NOVA_INSTALL=y //nova计算组件,开启
35 CONFIG_NEUTRON_INSTALL=y //neutron网络组件,开启
38 CONFIG_HORIZON_INSTALL=y //horizon控制台组件,开启
41 CONFIG_SWIFT_INSTALL=n //swift对象存储,默认是Y,但是在生产环境中一般不装,选n
46 CONFIG_CEILOMETER_INSTALL=y //ceilometer计费服务,开启
50 CONFIG_AODH_INSTALL=n //aodh组件,改为n
53 CONFIG_PANKO_INSTALL=n //panko组件,n
60 CONFIG_HEAT_INSTALL=n //heat编排工具组件,默认是n,不该=改
94 CONFIG_CONTROLLER_HOST=172.16.100.10 //指定控制节点IP地址(根据实际情况填写主机ip)
97 CONFIG_COMPUTE_HOST=172.16.100.10 //指定计算节点(根据实际情况填写主机ip)
101 CONFIG_NETWORK_HOSTS=172.16.100.10 //指定网络节点(根据实际情况填写主机ip)
557 CONFIG_CINDER_VOLUMES_SIZE=5G //系统在创建cinder组件时会创建一个20G卷,虚拟机空间有限,放小一点
778 CONFIG_NEUTRON_METADATA_PW=123123 //修改网络metadata的密码
782 CONFIG_LBAAS_INSTALL=y //lbaas负载均衡组件,必须要装
790 CONFIG_NEUTRON_FWAAS=y //网络防火墙组件,必须要装
794 CONFIG_NEUTRON_VPNAAS=y //网络VPN组件,必须要装
817 CONFIG_NEUTRON_ML2_FLAT_NETWORKS=physnet1 //flat网络这边要设置物理网卡名字
862 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex //ovs_bridge_mappings这边要设置物理网卡的名字
873 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth1 //ovs_bridge_ifaces这边br-ex:eth1是网络节点的nat网卡
1185 CONFIG_PROVISION_DEMO=n //关闭在线下载一个demo测试的镜像,这里把它关掉
使用工具安装,密码是随机生成的 实验环境不方便 所以我们把密码统一改成000000
[root@controller ~]# sed -i.bak -r 's/(.+_PW)=[0-9a-z]+/\1=000000/g' openstack.txt
自动糊部署安装
[root@controller ~]# packstack --answer-file=openstack.txt