一、环境准备

  1. 1、环境 centos7-1611 ,硬件:CPU1vcpu4核;内存:8G;硬盘:100G<br /> 2、双网卡设置:<br /> 网卡1NAT模式,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:
  1. [root@controller]# vi /etc/sysconfig/network-scripts/ifcfg-enp8s0
  2. TYPE="Ethernet"
  3. BOOTPROTO="none"
  4. DEFROUTE="yes"
  5. IPV4_FAILURE_FATAL="no"
  6. IPV6INIT="yes"
  7. IPV6_AUTOCONF="yes"
  8. IPV6_DEFROUTE="yes"
  9. IPV6_FAILURE_FATAL="no"
  10. IPV6_ADDR_GEN_MODE="stable-privacy"
  11. NAME="enp8s0"
  12. UUID="9b56649e-ddf3-4c1b-9407-9a2db56ec3e5"
  13. DEVICE="enp8s0"
  14. ONBOOT="yes"
  15. IPADDR="10.110.84.17"
  16. PREFIX="23"
  17. GATEWAY="10.110.84.1"
  18. DNS1="223.5.5.5"
  19. IPV6_PEERDNS="yes"
  20. IPV6_PEERROUTES="yes"
  21. IPV6_PRIVACY="no"

网卡2:

  1. [root@controller]# vi /etc/sysconfig/network-scripts/ifcfg-enp9s0
  2. TYPE=Ethernet
  3. BOOTPROTO=static
  4. DEFROUTE=yes
  5. PEERDNS=yes
  6. PEERROUTES=yes
  7. IPV4_FAILURE_FATAL=no
  8. IPV6INIT=yes
  9. IPV6_AUTOCONF=yes
  10. IPV6_DEFROUTE=yes
  11. IPV6_PEERDNS=yes
  12. IPV6_PEERROUTES=yes
  13. IPV6_FAILURE_FATAL=no
  14. IPV6_ADDR_GEN_MODE=stable-privacy
  15. NAME=enp9s0
  16. UUID=a7058ef0-8087-4cf2-bc34-115a3703b8c6
  17. DEVICE=enp9s0
  18. ONBOOT=yes
  19. IPADDR=172.16.100.17
  20. NETMASK=255.255.255.0

4、重启网络:

  1. systemctl restart network

5、 测试网络连通性。
ping www.baidu.com -c4
image.png
7、修改主机名:

  1. 修改主机名:
  2. [root@controller ~]# hostnamectl set-hostname controller
  3. ctrl+d 退出 重新登陆
  4. 查看结果:
  5. [root@controller ~]# cat /etc/hostname
  6. controller
  7. [root@controller ~]#

8、设置字符集
检测:
[root@controller ~]# cat /etc/locale.conf
LANG=”zh_CN.UTF-8”
如果不一样,则修改:

  1. [root@controller ~]# localectl
  2. System Locale: LANG=zh_CN.UTF-8
  3. VC Keymap: cn
  4. X11 Layout: cn

9、关闭不必要的服务

  1. [root@controller ~]# systemctl stop postfix.service
  2. [root@controller ~]# systemctl disable postfix.service
  3. [root@controller ~]# systemctl disable firewalld.service
  4. [root@controller ~]# systemctl stop firewalld.service
  5. [root@controller ~]# systemctl status firewalld.service

10,优化selinux

  1. [root@controller ~]# vi /etc/selinux/config
  2. SELINUX=permissive

11、更改yum源:

  1. 备份
  1. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
    CentOS 7 yum源
  1. wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  2. 或者
  3. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

  1. epel源
  1. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  1. 运行 yum makecache 生成缓存
  1. yum makecache
  2. yum repolist

12、安装常用软件:

  1. yum install vim wget bash-completion lrzsz nmap nc tree htop iftop net-tools -y

二、安装openstack

  1. [root@controller ~]# cat /etc/redhat-release
  2. CentOS Linux release 7.3.1611 (Core)
  3. [root@controller ~]# yum install -y openstack-packstack //安装openstack-packstack包
  4. [root@controller ~]# packstack --gen-answer-file=openstack.txt //获得应答文件,去修改安装的参数
  5. [root@controller ~]# ls
  6. anaconda-ks.cfg openstack.txt
  7. [root@controller ~]# vi openstack.txt
  8. 19 CONFIG_MARIADB_INSTALL=y //mariadb数据库默认安装,是
  9. 22 CONFIG_GLANCE_INSTALL=y //glance镜像组件,开启
  10. 25 CONFIG_CINDER_INSTALL=y //cinder块存储,开启
  11. 29 CONFIG_MANILA_INSTALL=n //manila组件是openstack的扩展系统,默认是N,不需要更改
  12. 32 CONFIG_NOVA_INSTALL=y //nova计算组件,开启
  13. 35 CONFIG_NEUTRON_INSTALL=y //neutron网络组件,开启
  14. 38 CONFIG_HORIZON_INSTALL=y //horizon控制台组件,开启
  15. 41 CONFIG_SWIFT_INSTALL=n //swift对象存储,默认是Y,但是在生产环境中一般不装,选n
  16. 46 CONFIG_CEILOMETER_INSTALL=y //ceilometer计费服务,开启
  17. 50 CONFIG_AODH_INSTALL=n //aodh组件,改为n
  18. 53 CONFIG_PANKO_INSTALL=n //panko组件,n
  19. 60 CONFIG_HEAT_INSTALL=n //heat编排工具组件,默认是n,不该=改
  20. 94 CONFIG_CONTROLLER_HOST=172.16.100.10 //指定控制节点IP地址(根据实际情况填写主机ip)
  21. 97 CONFIG_COMPUTE_HOST=172.16.100.10 //指定计算节点(根据实际情况填写主机ip)
  22. 101 CONFIG_NETWORK_HOSTS=172.16.100.10 //指定网络节点(根据实际情况填写主机ip)
  23. 557 CONFIG_CINDER_VOLUMES_SIZE=5G //系统在创建cinder组件时会创建一个20G卷,虚拟机空间有限,放小一点
  24. 778 CONFIG_NEUTRON_METADATA_PW=123123 //修改网络metadata的密码
  25. 782 CONFIG_LBAAS_INSTALL=y //lbaas负载均衡组件,必须要装
  26. 790 CONFIG_NEUTRON_FWAAS=y //网络防火墙组件,必须要装
  27. 794 CONFIG_NEUTRON_VPNAAS=y //网络VPN组件,必须要装
  28. 817 CONFIG_NEUTRON_ML2_FLAT_NETWORKS=physnet1 //flat网络这边要设置物理网卡名字
  29. 862 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex //ovs_bridge_mappings这边要设置物理网卡的名字
  30. 873 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth1 //ovs_bridge_ifaces这边br-ex:eth1是网络节点的nat网卡
  31. 1185 CONFIG_PROVISION_DEMO=n //关闭在线下载一个demo测试的镜像,这里把它关掉

使用工具安装,密码是随机生成的 实验环境不方便 所以我们把密码统一改成000000

  1. [root@controller ~]# sed -i.bak -r 's/(.+_PW)=[0-9a-z]+/\1=000000/g' openstack.txt


自动糊部署安装

  1. [root@controller ~]# packstack --answer-file=openstack.txt