基础部署
1.IP地址设置
首先将系统安装完成,然后按照架构设置中配置计算节点的网卡
编辑 /etc/network/interfaces
写入如下内容
vi /etc/network/interfaces auto eth0 iface eth0 inet static address 10.0.1.20 netmask 255.255.255.0 auto eth1 iface eth1 inet static address 10.0.2.20 netmask 255.255.255.0 auto eth2 iface eth2 inet static address 10.0.3.20 netmask 255.255.255.0 auto eth3 iface eth3 inet static address 192.168.100.20 netmask 255.255.255.0 gateway 192.168.100.2
然后重启网络,并启用网卡
service network restart ifup eth0 ifup eth1 ifup eth2 ifup eth3
查看网卡配置是否正确
ifconfig eth0 ifoonfig eth1 ifoonfig eth2 ifoonfig eth3
2.设置HOSTS
将四个节点的主机名分别写入到/etc/hosts中
rm -rfv /etc/hosts echo "127.0.0.1 localhost" >> /etc/hosts echo "10.0.1.10 controller" >> /etc/hosts echo "10.0.1.20 compute" >> /etc/hosts echo "10.0.1.30 network" >> /etc/hosts echo "10.0.1.40 storage" >> /etc/hosts
3.设置DNS
这里使用114的DNS,将DNS写入到/etc/resolv.conf中
echo "nameserver 114.114.114.114" >> /etc/resolv.conf
4.测试网络连通性
依次Ping 四个节点以及百度,测试外网是否通畅
ping -c 2 controller|grep "64 bytes from" ping -c 2 compute|grep "64 bytes from" ping -c 2 network|grep "64 bytes from" ping -c 2 storage|grep "64 bytes from" ping -c 2 www.baidu.com|grep "64 bytes from"
5.升级系统
更新软件源,升级系统
apt-get update apt-get upgrade
6.安装 NTP 时间同步
apt-get -y install ntp
删除/var/lib/ntp/ntp.conf.dhcp
rm -rfv /var/lib/ntp/ntp.conf.dhcp
编辑/etc/ntp.conf
删除里面的所有server
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
ntp.ubuntu.com
新加一个server指向controller
sed -i 's/server 0.ubuntu.pool.ntp.org//g' /etc/ntp.conf sed -i 's/server 1.ubuntu.pool.ntp.org//g' /etc/ntp.conf sed -i 's/server 2.ubuntu.pool.ntp.org//g' /etc/ntp.conf sed -i 's/server 3.ubuntu.pool.ntp.org//g' /etc/ntp.conf sed -i "s/server ntp.ubuntu.com/server controller iburst/g" /etc/ntp.conf
重新启动ntp服务
service ntp restart
7.配置 OpenStack 安装包源
安装Openstack的密钥环
apt-get -y install ubuntu-cloud-keyring
添加Openstack Kilo版本的安装源
echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu" "trusty-updates/kilo main">/etc/apt/sources.list.d/cloudarchive-kilo.list
这里因为openstack的官方源速度太酸爽,所以我花了一天时间把这个源的amd64版本全部同步下来了,在本地开启一个HTTP服务,将ubuntu-cloud.archive.canonical.com.tar.gz解开,放置到Web根目录下,在节点上的HOSTS里写入域名指向即可
打包下载地址:http://pan.baidu.com/s/118iEa 密码: 9hmd
echo "10.0.1.200 ubuntu-cloud.archive.canonical.com" >> /etc/hosts
更新源,然后升级系统
apt-get -y update apt-get -y dist-upgrade
至此,基础服务部署完成
计算服务 Nova
1.安装 Nova
apt-get -y install nova-compute sysfsutils
2.设置 Nova 配置文件
首先将nova的配置去掉注释和空行,备份一份
mv /etc/nova/nova.conf /etc/nova/nova.conf.bak cat /etc/nova/nova.conf.bak|grep -v "^#"|grep -v "^$">/etc/nova/nova.conf
编辑/etc/nova/nova.conf
vi /etc/nova/nova.conf # ----------------------------------------- [DEFAULT] #显示详细日志输出 verbose = True #指定消息队列使用RabbitMQ rpc_backend = rabbit #指定认证使用keystone auth_strategy = keystone #指定计算节点的IP地址,我这里为10.0.1.20 my_ip = 10.0.1.20 #指定VNC处于开启状态 vnc_enabled = True #指定VNC代理监听地址,0.0.0.0为任意地址可连接 vncserver_listen = 0.0.0.0 #指定VNC代理地址,这里为计算节点的IP vncserver_proxyclient_address = 10.0.1.20 #指定VNC代理的访问地址 novncproxy_base_url = http://controller:6080/vnc_auto.html # ----------------------------------------- [database] #数据库链接信息 connection = mysql://nova:NOVA_DBPASS@controller/nova # ----------------------------------------- [keystone_authtoken] #使用5000和35357端口进行身份校验 auth_uri = http://controller:5000 auth_url = http://controller:35357 #校验方式为密码(password) auth_plugin = password #指定项目和用户域为 defalut project_domain_id = default user_domain_id = default #指定项目名称为service project_name = service #指定用户名为nova username = nova #指定密码为密码表中的NOVA_PASS password = NOVA_PASS # ----------------------------------------- [glance] #指定镜像服务的位置 host = controller # ----------------------------------------- [oslo_messaging_rabbit] #消息队列RabbitMQ的主机 rabbit_host = controller #消息队列RabbitMQ的账号 rabbit_userid = openstack #消息队列RabbitMQ的密码,该密码可查询密码表的RABBIT_PASS获得 rabbit_password = RABBIT_PASS # ----------------------------------------- [oslo_concurrency] #指定nova锁的路径 lock_path = /var/lock/nova # -----------------------------------------
3.检查计算节点是否支持硬件虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo
如返回一个大于0的则为支持硬件虚拟化,无须任何操作,跳过此步骤
如返回的为0,则证明CPU不支持硬件虚拟化,需要把虚拟化技术改为QEMU软件虚拟化
一般物理服务器基本都是支持硬件虚拟化的,Inter Virtual Technology(V-T)或是AMD Virtualization(AMD-V)
我这里使用的是VMware虚拟机,所以虚拟机是不支持硬件虚拟化的,所以这里我需要将虚拟化技术改为QEMU
编辑/etc/nova/nova-compute.conf
vi /etc/nova/nova-compute.conf # ----------------------------------------- [libvirt] #指定虚拟化技术为qemu virt_type = qemu # -----------------------------------------
4.重启 Nova 服务
service nova-compute restart
5.删除 Nova 自带的 SQLite 数据库
rm -f /var/lib/nova/nova.sqlite
至此,计算节点的Nova安装完成,可以转向到控制节点进行验证了
网络服务 Neutron
1.调整网络节点的网络参数
备份配置
mv /etc/sysctl.conf /etc/sysctl.conf.bak cat /etc/sysctl.conf.bak|grep -v "^#"|grep -v "^$">/etc/sysctl.conf
设置网络参数,编辑/etc/sysctl.conf
vi /etc/sysctl.conf # ----------------------------------------- #开启ipv4上所有的反向过滤 net.ipv4.conf.all.rp_filter = 0 #开启ipv4上默认的反向过滤 net.ipv4.conf.default.rp_filter = 0 # -----------------------------------------
生效配置
sysctl -p
2.安装 Neutron
apt-get -y install neutron-plugin-ml2 neutron-plugin-openvswitch-agent
3.配置 Neutron
首先去掉配置文件的注释和空行,并且进行备份
mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak cat /etc/neutron/neutron.conf.bak|grep -v "^#"|grep -v "^$">/etc/neutron/neutron.conf mv /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak cat /etc/neutron/plugins/ml2/ml2_conf.ini.bak|grep -v "^#"|grep -v "^$">/etc/neutron/plugins/ml2/ml2_conf.ini
编辑/etc/neutron/neutron.conf
vi /etc/neutron/neutron.conf # ----------------------------------------- [DEFAULT] #消息队列使用RabbitMQ rpc_backend = rabbit #指定认证使用keystone auth_strategy = keystone #指定核心插件为ml2 core_plugin = ml2 #指定开启路由服务 service_plugins = router #指定允许IP地址重叠 allow_overlapping_ips = True #显示详细日志输出 verbose = True # ----------------------------------------- [keystone_authtoken] #注释掉之前的内容 #auth_uri = http://127.0.0.1:35357/v2.0/ #identity_uri = http://127.0.0.1:5000 #admin_tenant_name = %SERVICE_TENANT_NAME% #admin_user = %SERVICE_USER% #admin_password = %SERVICE_PASSWORD% #使用5000和35357端口进行身份校验 auth_uri = http://controller:5000 auth_url = http://controller:35357 #校验方式为密码(password) auth_plugin = password #指定项目和用户域为 defalut project_domain_id = default user_domain_id = default #指定项目名称为service project_name = service #指定认证用户名为neutron username = neutron #指定认证密码为NEUTRON_PASS password = NEUTRON_PASS # ----------------------------------------- # 注释掉数据库连接参数 [database] #connection = sqlite:////var/lib/neutron/neutron.sqlite # ----------------------------------------- [oslo_messaging_rabbit] #消息队列RabbitMQ的主机 rabbit_host = controller #消息队列RabbitMQ的账号 rabbit_userid = openstack #消息队列RabbitMQ的密码,该密码可查询密码表的RABBIT_PASS获得 rabbit_password = RABBIT_PASS # -----------------------------------------
编辑 /etc/neutron/plugins/ml2/ml2_conf.ini
vi /etc/neutron/plugins/ml2/ml2_conf.ini # ----------------------------------------- [ml2] #启用的网络驱动 type_drivers = flat,vlan,gre,vxlan #指定租户使用的网络类型 tenant_network_types = gre #指定OVS驱动 mechanism_drivers = openvswitch # ----------------------------------------- [ml2_type_gre] #指定隧道ID范围 tunnel_id_ranges = 1:1000 # ----------------------------------------- [securitygroup] #指定开启安全组 enable_security_group = True #指定开启IPSET设置 enable_ipset = True #指定OVS iptables的防火墙驱动 firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver # ----------------------------------------- # 这里的IP填写与网络节点相连的IP地址 [ovs] #指定本地IP,这里的IP填写与计算节点相连的IP地址 #我这里按照拓扑为10.0.3.20 local_ip = 10.0.3.20 # ----------------------------------------- [agent] #指定隧道类型 tunnel_types = gre # -----------------------------------------
4.重启Neutron
service openvswitch-switch restart
5.配置 Nova 使用 Neutron 网络
首先备份配置并清除其中注释和空行
mv /etc/nova/nova.conf /etc/nova/nova.conf.bak cat /etc/nova/nova.conf.bak|grep -v "^#"|grep -v "^$"> /etc/nova/nova.conf
编辑/etc/nova/nova.conf
vi /etc/nova/nova.conf # ----------------------------------------- [DEFAULT] #指定neutron使用的APIs network_api_class = nova.network.neutronv2.api.API security_group_api = neutron #指定网络驱动 linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver #指定防火墙驱动 firewall_driver = nova.virt.firewall.NoopFirewallDriver # ----------------------------------------- #原本里面试没有neutron这个子配置的,新添加进去就行 [neutron] #使用9696端口进行身份校验 url = http://controller:9696 #指定认证使用keystone auth_strategy = keystone #指定认证URL admin_auth_url = http://controller:35357/v2.0 #指定认证的租户 admin_tenant_name = service #指定用户名 admin_username = neutron #指定密码为密码表中的NEUTRON_PASS admin_password = NEUTRON_PASS # -----------------------------------------
6.重启计算服务和网络服务
service nova-compute restart service neutron-plugin-openvswitch-agent restart
至此,计算节点安装完成