OpenStack Grizzly详细安装指导

一、环境介绍:

控制节点 eth0 (10.10.10.51), eth1 (192.168.100.51)
网络节点 eth0 (10.10.10.52), eth1 (10.20.20.52), eth2 (192.168.100.52)
计算节点 eth0 (10.10.10.53), eth1 (10.20.20.53)




说明1: 使用 dpkg -s <packagename> to 确保 grizzly packages (version : 2013.1)

说明2: 你可以添加比较多的计算节点,下面是网络结构

 



二、控制节点

2.1. Ubuntu准备

安装64位 Ubuntu 12.04 或则13.04 Server ,切换sudo模式

  1. sudo su
复制代码


添加 Grizzly 源 [Only for Ubuntu 12.04]:

  1. apt-get install -y ubuntu-cloud-keyring
  2. echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main >> /etc/apt/sources.list.d/grizzly.list
复制代码

对于上面命令不了解,可参考
安装openstack过程中:如何添加源,echo,<<分别代表什么意思?

更新系统:

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get dist-upgrade -y
复制代码

 



2.2. 网络配置
只有一个网卡接入互联网

  1. #For Exposing OpenStack API over the internet
  2. auto eth1
  3. iface eth1 inet static
  4. address 192.168.100.51
  5. netmask 255.255.255.0
  6. gateway 192.168.100.1
  7. dns-nameservers 8.8.8.8
  8. #Not internet connected(used for OpenStack management)
  9. auto eth0
  10. iface eth0 inet static
  11. address 10.10.10.51
  12. netmask 255.255.255.0
复制代码


重新启动网络

  1. service networking restart
复制代码


2.3. MySQL & RabbitMQ安装


安装 MySQL:

  1. apt-get install -y mysql-server python-mysqldb
复制代码

 


出现这个界面是输入MySQL的密码

配置mysql

  1. sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
  2. service mysql restart
复制代码

对于上面命令不了解可以参考下面内容:

安装openstack过程中:sed命令的作用是什么

学习openstack之linux mysql 操作命令汇总

2.4. RabbitMQ

安装 RabbitMQ:

  1. apt-get install -y rabbitmq-server
复制代码


安装 NTP service:

  1. apt-get install -y ntp
复制代码


创建数据库:

  1. mysql -u root -p
  2. #Keystone
  3. CREATE DATABASE keystone;
  4. GRANT ALL ON keystone.* TO 'keystoneUser'@'%' IDENTIFIED BY 'keystonePass';
  5. #Glance
  6. CREATE DATABASE glance;
  7. GRANT ALL ON glance.* TO 'glanceUser'@'%' IDENTIFIED BY 'glancePass';
  8. #Quantum
  9. CREATE DATABASE quantum;
  10. GRANT ALL ON quantum.* TO 'quantumUser'@'%' IDENTIFIED BY 'quantumPass';
  11. #Nova
  12. CREATE DATABASE nova;
  13. GRANT ALL ON nova.* TO 'novaUser'@'%' IDENTIFIED BY 'novaPass';
  14. #Cinder
  15. CREATE DATABASE cinder;
  16. GRANT ALL ON cinder.* TO 'cinderUser'@'%' IDENTIFIED BY 'cinderPass';
  17. quit;
复制代码

对于上面命令不了解可以参考下面内容:

安装openstack过程中:RabbitMQ与NTP是什么


学习openstack之linux mysql 操作命令汇总


2.5. 其他


安装其它服务:

  1. apt-get install -y vlan bridge-utils
复制代码


启动 IP_Forwarding:

  1. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
  2. # To save you from rebooting, perform the following
  3. sysctl net.ipv4.ip_forward=1
复制代码


2.6. Keystone

安装Keystone

  1. apt-get install -y keystone
复制代码


在文件 /etc/keystone/keystone.conf  中添加如下语句

  1. connection = mysql://keystoneUser:keystonePass@10.10.10.51/keystone
复制代码

上面的配置可能大家的理解不一样这里给出图示:
 


上面connection注释掉,替换为上面链接如下图所示
 




重新启动Keystone,同步数据库

  1. service keystone restart
  2. keystone-manage db_sync
复制代码


下载keystone_basic.sh,keystone_endpoints_basic.sh并执行脚本

  1. #Modify the **HOST_IP** and **EXT_HOST_IP** variables before executing the scripts
  2. wget https://raw.github.com/mseknibilel/OpenStack-Grizzly-Install-Guide/OVS_MultiNode/KeystoneScripts/keystone_basic.sh
  3. wget https://raw.github.com/mseknibilel/OpenStack-Grizzly-Install-Guide/OVS_MultiNode/KeystoneScripts/keystone_endpoints_basic.sh
  4. chmod +x keystone_basic.sh
  5. chmod +x keystone_endpoints_basic.sh
  6. ./keystone_basic.sh
  7. ./keystone_endpoints_basic.sh
复制代码




注释与说明:
查看脚本keystone_basic.sh内容:
 


上面ip为控制节点的ip

查看脚本keystone_endpoints_basic.sh内容:
 


上面HOST_IP分别为控制节点的eth0,eth1两个网卡ip。
当脚本./keystone_basic.sh执行时,没有任何输出说明脚本执行成功。
执行./keystone_endpoints_basic.sh脚本时,会看到如下输出:

 


创建证书,后面不会遇到麻烦:(其实这里是环境变量的配置,我们在后面的操作中,就不需要每次都输入用户名密码等)

  1. nano creds
  2. #Paste the following:
  3. export OS_TENANT_NAME=admin
  4. export OS_USERNAME=admin
  5. export OS_PASSWORD=admin_pass
  6. export OS_AUTH_URL="http://192.168.100.51:5000/v2.0/"
  7. # Load it:
  8. source creds
复制代码


使用CLI命令,测试使用安装成功

  1. keystone user-list
复制代码


2.7. Glance

安装Glance

  1. apt-get install -y glance
复制代码

更新/etc/glance/glance-api-paste.ini 文件

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. delay_auth_decision = true
  4. auth_host = 10.10.10.51
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = glance
  9. admin_password = service_pass
复制代码



注释与说明:


即使找到上面[filter:authtoken],然后把相关内容进行粘帖。
 

替换为如下:
 


更新 /etc/glance/glance-registry-paste.ini文件

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = glance
  8. admin_password = service_pass
复制代码
  1. [paste_deploy]
  2. flavor = keystone
复制代码




操作同上,也是内容的替换。

替换/etc/glance/glance-api.conf文件

  1. sql_connection = mysql://glanceUser:glancePass@10.10.10.51/glance
复制代码


注释与说明:
 
同样是将原先sql_connection注释掉,替换为sql_connection = mysql://glanceUser:glancePass@10.10.10.51/glance

更新 /etc/glance/glance-registry.conf:

  1. sql_connection = mysql://glanceUser:glancePass@10.10.10.51/glance
复制代码
  1. [paste_deploy]
  2. flavor = keystone
复制代码


到这里我们是否找到一个规律就是无论是替换还是新增加内容,我们只要找到相关标签即可。如果有内容即替换,无内容则添加。

重启glance-api 与 glance-registry services:

  1. service glance-api restart; service glance-registry restart
复制代码


同步 glance 数据库:

  1. glance-manage db_sync
复制代码


导入img

  1. glance image-create --name myFirstImage --is-public true --container-format bare --disk-format qcow2 --location http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
复制代码


测试安装是否成功

  1. glance image-list
复制代码

我们看到下图,说明安装成功
 


2.8. Quantum 安装Quantum

  1. apt-get install -y quantum-server
复制代码


更新 the OVS plugin configuration 文件 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:

  1. #Under the database section
  2. [DATABASE]
  3. sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum
  4. #Under the OVS section
  5. [OVS]
  6. tenant_network_type = gre
  7. tunnel_id_ranges = 1:1000
  8. enable_tunneling = True
  9. #Firewall driver for realizing quantum security group function
  10. [SECURITYGROUP]
  11. firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
复制代码


注释与说明:
 



我们看到上面链接替换为sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum即可。下面操作同理





编辑 /etc/quantum/api-paste.ini

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = quantum
  8. admin_password = service_pass
复制代码


更新 /etc/quantum/quantum.conf:

  1. [keystone_authtoken]
  2. auth_host = 10.10.10.51
  3. auth_port = 35357
  4. auth_protocol = http
  5. admin_tenant_name = service
  6. admin_user = quantum
  7. admin_password = service_pass
  8. signing_dir = /var/lib/quantum/keystone-signing
复制代码


重启 quantum server:

  1. service quantum-server restart
复制代码




2.9. Nova

安装 nova 组件

  1. apt-get install -y nova-api nova-cert novnc nova-consoleauth nova-scheduler nova-novncproxy nova-doc nova-conductor
复制代码


修改/etc/nova/api-paste.ini 中authtoken 部分

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = nova
  8. admin_password = service_pass
  9. signing_dirname = /tmp/keystone-signing-nova
  10. # Workaround for https://bugs.launchpad.net/nova/+bug/1154809
  11. auth_version = v2.0
复制代码


修改 the /etc/nova/nova.conf:

  1. [DEFAULT]
  2. logdir=/var/log/nova
  3. state_path=/var/lib/nova
  4. lock_path=/run/lock/nova
  5. verbose=True
  6. api_paste_config=/etc/nova/api-paste.ini
  7. compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
  8. rabbit_host=10.10.10.51
  9. nova_url=http://10.10.10.51:8774/v1.1/
  10. sql_connection=mysql://novaUser:novaPass@10.10.10.51/nova
  11. root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
  12. # Auth
  13. use_deprecated_auth=false
  14. auth_strategy=keystone
  15. # Imaging service
  16. glance_api_servers=10.10.10.51:9292
  17. image_service=nova.image.glance.GlanceImageService
  18. # Vnc configuration
  19. novnc_enabled=true
  20. novncproxy_base_url=http://192.168.100.51:6080/vnc_auto.html
  21. novncproxy_port=6080
  22. vncserver_proxyclient_address=10.10.10.51
  23. vncserver_listen=0.0.0.0
  24. # Network settings
  25. network_api_class=nova.network.quantumv2.api.API
  26. quantum_url=http://10.10.10.51:9696
  27. quantum_auth_strategy=keystone
  28. quantum_admin_tenant_name=service
  29. quantum_admin_username=quantum
  30. quantum_admin_password=service_pass
  31. quantum_admin_auth_url=http://10.10.10.51:35357/v2.0
  32. libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
  33. linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver
  34. #If you want Quantum + Nova Security groups
  35. firewall_driver=nova.virt.firewall.NoopFirewallDriver
  36. security_group_api=quantum
  37. #If you want Nova Security groups only, comment the two lines above and uncomment line -1-.
  38. #-1-firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
  39. #Metadata
  40. service_quantum_metadata_proxy = True
  41. quantum_metadata_proxy_shared_secret = helloOpenStack
  42. # Compute #
  43. compute_driver=libvirt.LibvirtDriver
  44. # Cinder #
  45. volume_api_class=nova.volume.cinder.API
  46. osapi_volume_listen_port=5900
复制代码


同步数据库:

  1. nova-manage db sync
复制代码




重启与nova有关的所有服务:

  1. cd /etc/init.d/; for i in $( ls nova-* ); do sudo service $i restart; done
复制代码


对于上面命令不了解,可以查看:
安装openstack过程中:Linux for循环的作用是什么?

检查安装是否成功

  1. nova-manage service list
复制代码

当我们看到下图时候,说明安装成功
 


2.10. Cinder安装所需要的 packages:

  1. apt-get install -y cinder-api cinder-scheduler cinder-volume iscsitarget open-iscsi iscsitarget-dkms
复制代码

对于上面命令新手可能会不理解,含义是分别安装
cinder-api ,cinder-scheduler,cinder-volume等包。详细可查看
新手安装openstack之命令apt-get install -y vlan bridge-utils的作用是什么

配置iSCSI 

  1. sed -i 's/false/true/g' /etc/default/iscsitarget
复制代码

上面命令的含义是在文件iscsitarget中新的一行插入s/false/true/g
详细可查看安装openstack过程中:sed命令的作用是什么



为保证生效,重启服务:

  1. service iscsitarget start
  2. service open-iscsi start
复制代码


配置 /etc/cinder/api-paste.ini 

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. service_protocol = http
  4. service_host = 192.168.100.51
  5. service_port = 5000
  6. auth_host = 10.10.10.51
  7. auth_port = 35357
  8. auth_protocol = http
  9. admin_tenant_name = service
  10. admin_user = cinder
  11. admin_password = service_pass
  12. signing_dir = /var/lib/cinder
复制代码


编辑 /etc/cinder/cinder.conf 文件

  1. [DEFAULT]
  2. rootwrap_config=/etc/cinder/rootwrap.conf
  3. sql_connection = mysql://cinderUser:cinderPass@10.10.10.51/cinder
  4. api_paste_config = /etc/cinder/api-paste.ini
  5. iscsi_helper=ietadm
  6. volume_name_template = volume-%s
  7. volume_group = cinder-volumes
  8. verbose = True
  9. auth_strategy = keystone
  10. iscsi_ip_address=10.10.10.51
复制代码


同步数据库

  1. cinder-manage db sync
复制代码


创建一个卷组命名为cinder-volumes:

  1. dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=2G
  2. losetup /dev/loop2 cinder-volumes
  3. fdisk /dev/loop2
  4. #Type in the followings:
  5. n
  6. p
  7. 1
  8. ENTER
  9. ENTER
  10. t
  11. 8e
  12. w
复制代码


注释与说明:首先执行
第一步:
 

第二步:
 

第三部:执行fdisk /dev/loop2会有相应命令输入,
 

只要按照下面命令输入就可以。

  1. n
  2. p
  3. 1
  4. ENTER
  5. ENTER
  6. t
  7. 8e
  8. w
复制代码



创建物理卷和卷组:

  1. pvcreate /dev/loop2
  2. vgcreate cinder-volumes /dev/loop2
复制代码

创建成功如下图:

 

注意: 重启后卷组不会自动挂载 (点击`这个点此`_ 设置在重启后自动挂载)

重启cinder 服务:

  1. cd /etc/init.d/; for i in $( ls cinder-* ); do sudo service $i restart; done
复制代码

查看cinder服务状态

  1. cd /etc/init.d/; for i in $( ls cinder-* ); do sudo service $i status; done
复制代码

看到下图所示:
 


2.11. Horizon


安装Horizon

  1. apt-get install -y openstack-dashboard memcached
复制代码


可以删掉默认的ubuntu的them

  1. dpkg --purge openstack-dashboard-ubuntu-theme
复制代码


重启Apache和memcached服务:

  1. service apache2 restart; service memcached restart
复制代码


这时候可以打开 http://192.168.100.51/horizon. 
登录用户名:admin
密码:admin_pass

 

3. 网络节点

准备节点
安装 64位 Ubuntu 12.04 or 13.04 Server, 切换sudo 模式:

  1. sudo su
复制代码


添加Grizzly库(适用于 Ubuntu 12.04):

  1. apt-get install -y ubuntu-cloud-keyring
  2. echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main >> /etc/apt/sources.list.d/grizzly.list
复制代码


更新系统:

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get dist-upgrade -y
复制代码


安装 ntp 服务:

  1. apt-get install -y ntp
复制代码


配置NTP保持与控制节点时间同步:

  1. #Comment the ubuntu NTP servers
  2. sed -i 's/server 0.ubuntu.pool.ntp.org/#server 0.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  3. sed -i 's/server 1.ubuntu.pool.ntp.org/#server 1.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  4. sed -i 's/server 2.ubuntu.pool.ntp.org/#server 2.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  5. sed -i 's/server 3.ubuntu.pool.ntp.org/#server 3.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  6. #Set the network node to follow up your conroller node
  7. sed -i 's/server ntp.ubuntu.com/server 10.10.10.51/g' /etc/ntp.conf
  8. service ntp restart
复制代码


安装vlan 与网桥配置工具bridge-utils

  1. apt-get install -y vlan bridge-utils
复制代码


启动 IP_Forwarding:

  1. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
  2. # To save you from rebooting, perform the following
  3. sysctl net.ipv4.ip_forward=1
复制代码


3.2.网络配置

3 网卡配置如下:

  1. # OpenStack management
  2. auto eth0
  3. iface eth0 inet static
  4. address 10.10.10.52
  5. netmask 255.255.255.0
  6. # VM Configuration
  7. auto eth1
  8. iface eth1 inet static
  9. address 10.20.20.52
  10. netmask 255.255.255.0
  11. # VM internet Access
  12. auto eth2
  13. iface eth2 inet static
  14. address 192.168.100.52
  15. netmask 255.255.255.0
复制代码


3.3 OpenVSwitch (Part1)


安装 openVSwitch:

  1. apt-get install -y openvswitch-switch openvswitch-datapath-dkms
复制代码


添加 bridges:

  1. #br-int will be used for VM integration
  2. ovs-vsctl add-br br-int
  3. #br-ex is used to make to VM accessible from the internet
  4. ovs-vsctl add-br br-ex
复制代码


3.4. Quantum

安装  Quantum openvswitch 代理, l3 代理 and dhcp 代理组件:

  1. apt-get -y install quantum-plugin-openvswitch-agent quantum-dhcp-agent quantum-l3-agent quantum-metadata-agent
复制代码


编辑 /etc/quantum/api-paste.ini:

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = quantum
  8. admin_password = service_pass
复制代码


编辑 the OVS plugin 配置文件 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:

  1. #Under the database section
  2. [DATABASE]
  3. sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum
  4. #Under the OVS section
  5. [OVS]
  6. tenant_network_type = gre
  7. tunnel_id_ranges = 1:1000
  8. integration_bridge = br-int
  9. tunnel_bridge = br-tun
  10. local_ip = 10.20.20.52
  11. enable_tunneling = True
  12. #Firewall driver for realizing quantum security group function
  13. [SECURITYGROUP]
  14. firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
复制代码


更新/etc/quantum/metadata_agent.ini:

  1. # The Quantum user information for accessing the Quantum API.
  2. auth_url = http://10.10.10.51:35357/v2.0
  3. auth_region = RegionOne
  4. admin_tenant_name = service
  5. admin_user = quantum
  6. admin_password = service_pass
  7. # IP address used by Nova metadata server
  8. nova_metadata_ip = 10.10.10.51
  9. # TCP Port used by Nova metadata server
  10. nova_metadata_port = 8775
  11. metadata_proxy_shared_secret = helloOpenStack
复制代码


更新文件 /etc/quantum/quantum.conf,确保rabbitMQ IP指向了控制节点 

  1. rabbit_host = 10.10.10.51
  2. #And update the keystone_authtoken section
  3. [keystone_authtoken]
  4. auth_host = 10.10.10.51
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = quantum
  9. admin_password = service_pass
  10. signing_dir = /var/lib/quantum/keystone-signing
复制代码

编辑 /etc/sudoers.d/quantum_sudoers 

  1. nano /etc/sudoers.d/quantum_sudoers
  2. #Modify the quantum user
  3. quantum ALL=NOPASSWD: ALL
复制代码

注释与说明:上面配置的作用是quantum用户执行任何命令都不需要密码

重启quantum的所有服务

  1. cd /etc/init.d/; for i in $( ls quantum-* ); do sudo service $i restart; done
复制代码


3.4. OpenVSwitch (第二部分)

编辑 eth2   /etc/network/interfaces:

  1. # VM internet Access
  2. auto eth2
  3. iface eth2 inet manual
  4. up ifconfig $IFACE 0.0.0.0 up
  5. up ip link set $IFACE promisc on
  6. down ip link set $IFACE promisc off
  7. down ifconfig $IFACE down
复制代码



建立虚拟网桥与物理网口的链接

  1. #Internet connectivity will be lost after this step but this won't affect OpenStack's work
  2. ovs-vsctl add-port br-ex eth2
  3. #If you want to get internet connection back, you can assign the eth2's IP address to the br-ex in the /etc/network/interfaces file.
复制代码


4.计算节点

4.1. 准备环境

准备节点
安装 64位 Ubuntu 12.04 or 13.04 Server, 切换sudo 模式:

  1. sudo su
复制代码


添加Grizzly库(适用于 Ubuntu 12.04):

  1. apt-get install -y ubuntu-cloud-keyring
  2. echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main >> /etc/apt/sources.list.d/grizzly.list
复制代码


更新系统:

  1. apt-get update -y
  2. apt-get upgrade -y
  3. apt-get dist-upgrade -y
复制代码


安装 ntp 服务:

  1. apt-get install -y ntp
复制代码


配置NTP保持与控制节点时间同步:

  1. #Comment the ubuntu NTP servers
  2. sed -i 's/server 0.ubuntu.pool.ntp.org/#server 0.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  3. sed -i 's/server 1.ubuntu.pool.ntp.org/#server 1.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  4. sed -i 's/server 2.ubuntu.pool.ntp.org/#server 2.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  5. sed -i 's/server 3.ubuntu.pool.ntp.org/#server 3.ubuntu.pool.ntp.org/g' /etc/ntp.conf
  6. #Set the compute node to follow up your conroller node
  7. sed -i 's/server ntp.ubuntu.com/server 10.10.10.51/g' /etc/ntp.conf
  8. service ntp restart
复制代码


安装vlan 与网桥配置工具bridge-utils

  1. apt-get install -y vlan bridge-utils
复制代码


启动 IP_Forwarding:

  1. sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf
复制代码


4.2.网络配置

  1. # OpenStack management
  2. auto eth0
  3. iface eth0 inet static
  4. address 10.10.10.53
  5. netmask 255.255.255.0
  6. # VM Configuration
  7. auto eth1
  8. iface eth1 inet static
  9. address 10.20.20.53
  10. netmask 255.255.255.0
复制代码


4.3 KVM

确保你的硬件支持虚拟化:

  1. apt-get install -y cpu-checker
  2. kvm-ok
复制代码

上面命令分别执行,当我们看到如下信息时,其实可以的。因为虽然不支持加速,但是是可以使用的。

 


如果上面是好的,我们安装和配置KVM

  1. apt-get install -y kvm libvirt-bin pm-utils
复制代码


添加 cgroup_device_acl 数组到文 /etc/libvirt/qemu.conf:

  1. cgroup_device_acl = [
  2. "/dev/null", "/dev/full", "/dev/zero",
  3. "/dev/random", "/dev/urandom",
  4. "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
  5. "/dev/rtc", "/dev/hpet","/dev/net/tun"
  6. ]
复制代码


如下图所示

 



删除virtual bridge(执行下面命令即可)

  1. virsh net-destroy default
  2. virsh net-undefine default
复制代码


更新文件 /etc/libvirt/libvirtd.conf:

  1. listen_tls = 0
  2. listen_tcp = 1
  3. auth_tcp = "none"
复制代码


注释与说明:
上面可以找到相应的注释,去掉注释即可。

 


这里面因为注释内容比较多,可以使用查询如下图所示:我们输入/listten_tls回车即可找到相应内容。
 


在文件 /etc/init/libvirt-bin.conf中添加 libvirtd_opts 变量:

  1. env libvirtd_opts="-d -l"
复制代码


注释与说明:
如下图位置所示
 



编辑 /etc/default/libvirt-bin 文件

  1. libvirtd_opts="-d -l"
复制代码

如下图红色箭头所示,我们只要在libvirtd_opts="-d"中添加-1即可,即为libvirtd_opts="-d -l"
 



重 libvirt service与 service libvirt-bin:

  1. service dbus restart && service libvirt-bin restart
复制代码

看到如下信息:
 


4.4. OpenVSwitch

安装 openVSwitch:

  1. apt-get install -y openvswitch-switch openvswitch-datapath-dkms
复制代码


创建 bridges:


  1. #br-int will be used for VM integration
  2. ovs-vsctl add-br br-int
复制代码


4.5. Quantum

安装 Quantum openvswitch 代理:

  1. apt-get -y install quantum-plugin-openvswitch-agent
复制代码

编辑 the OVS plugin配置文件 /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:

  1. #Under the database section
  2. [DATABASE]
  3. sql_connection = mysql://quantumUser:quantumPass@10.10.10.51/quantum
  4. #Under the OVS section
  5. [OVS]
  6. tenant_network_type = gre
  7. tunnel_id_ranges = 1:1000
  8. integration_bridge = br-int
  9. tunnel_bridge = br-tun
  10. local_ip = 10.20.20.53
  11. enable_tunneling = True
  12. #Firewall driver for realizing quantum security group function
  13. [SECURITYGROUP]
  14. firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
复制代码

注释与说明:
注意上面的文件不能一次性全部复制到文件中,需要找到相应的标签,如下图所示为ovs的配置
 




确保你的 rabbitMQ IP  在 /etc/quantum/quantum.conf文件中配置指向控制节点:

  1. rabbit_host = 10.10.10.51
  2. #And update the keystone_authtoken section
  3. [keystone_authtoken]
  4. auth_host = 10.10.10.51
  5. auth_port = 35357
  6. auth_protocol = http
  7. admin_tenant_name = service
  8. admin_user = quantum
  9. admin_password = service_pass
  10. signing_dir = /var/lib/quantum/keystone-signing
复制代码

注释与说明:
同理上面的内容也是相应的内容放到相应的标签下面。切忌全部复制。

重启服务:

  1. service quantum-plugin-openvswitch-agent restart
复制代码




4.6. Nova

安装nova所需要组件:

  1. apt-get install -y nova-compute-kvm
复制代码


修改文件  /etc/nova/api-paste.ini   authtoken 部分   

  1. [filter:authtoken]
  2. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  3. auth_host = 10.10.10.51
  4. auth_port = 35357
  5. auth_protocol = http
  6. admin_tenant_name = service
  7. admin_user = nova
  8. admin_password = service_pass
  9. signing_dirname = /tmp/keystone-signing-nova
  10. # Workaround for https://bugs.launchpad.net/nova/+bug/1154809
  11. auth_version = v2.0
复制代码


编辑文件 /etc/nova/nova-compute.conf  

  1. [DEFAULT]
  2. libvirt_type=kvm
  3. libvirt_ovs_bridge=br-int
  4. libvirt_vif_type=ethernet
  5. libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
  6. libvirt_use_virtio_for_bridges=True
复制代码


修改文件 /etc/nova/nova.conf如下:

  1. [DEFAULT]
  2. logdir=/var/log/nova
  3. state_path=/var/lib/nova
  4. lock_path=/run/lock/nova
  5. verbose=True
  6. api_paste_config=/etc/nova/api-paste.ini
  7. compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
  8. rabbit_host=10.10.10.51
  9. nova_url=http://10.10.10.51:8774/v1.1/
  10. sql_connection=mysql://novaUser:novaPass@10.10.10.51/nova
  11. root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
  12. # Auth
  13. use_deprecated_auth=false
  14. auth_strategy=keystone
  15. # Imaging service
  16. glance_api_servers=10.10.10.51:9292
  17. image_service=nova.image.glance.GlanceImageService
  18. # Vnc configuration
  19. novnc_enabled=true
  20. novncproxy_base_url=http://192.168.100.51:6080/vnc_auto.html
  21. novncproxy_port=6080
  22. vncserver_proxyclient_address=10.10.10.53
  23. vncserver_listen=0.0.0.0
  24. # Network settings
  25. network_api_class=nova.network.quantumv2.api.API
  26. quantum_url=http://10.10.10.51:9696
  27. quantum_auth_strategy=keystone
  28. quantum_admin_tenant_name=service
  29. quantum_admin_username=quantum
  30. quantum_admin_password=service_pass
  31. quantum_admin_auth_url=http://10.10.10.51:35357/v2.0
  32. libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
  33. linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver
  34. #If you want Quantum + Nova Security groups
  35. firewall_driver=nova.virt.firewall.NoopFirewallDriver
  36. security_group_api=quantum
  37. #If you want Nova Security groups only, comment the two lines above and uncomment line -1-.
  38. #-1-firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
  39. #Metadata
  40. service_quantum_metadata_proxy = True
  41. quantum_metadata_proxy_shared_secret = helloOpenStack
  42. # Compute #
  43. compute_driver=libvirt.LibvirtDriver
  44. # Cinder #
  45. volume_api_class=nova.volume.cinder.API
  46. osapi_volume_listen_port=5900
  47. cinder_catalog_info=volume:cinder:internalURL
复制代码



注释与说明:
我们打开文件会看到如下内容:把文件内容清空,添加上面内容即可。
 


重启 nova所有服务:

  1. cd /etc/init.d/; for i in $( ls nova-* ); do sudo service $i restart; done
复制代码

查看是否安装成功:

  1. nova-manage service list
复制代码


 

posted @ 2017-04-28 11:33  TyrantMaster  阅读(675)  评论(0编辑  收藏  举报