前言: 目前redhat推出了openstack的课程—CL210,主要针对企业的openstack的管理和应用,其目前应用于生产的版本是RHOSP6,即社区版的Juno,其中CL210中需要有4台虚拟机,分别是workstation、ceph、servera和serverb,对于机器的硬件要求较高,且需要有上课环境,本文主要针对CL210考试的人而准备,需要在上课所在环境download两个ISO,分别是:RHEL7OSP-6.0-2015-02-23.2-x86_64.iso和rhel-server-7.0-x86_64-dvd.iso(根据提供的版本而定)。
环境介绍:
系统: CentOS Linux release 7.0.1406 (Core)
配置: 2vcpu+4Gmemery+100Gdisk+2张nic
主机信息:eth0:10.16.4.59(管理网和外部网络) eth1(instance内部网络,采用vlan模式隔离) hostname:controller
软件版本:RHEL7OSP-6.0,对应社区办的Juno版,可通过RDO的方式安装,详情参考Juno手动安装http://happylab.blog.51cto.com/1730296/1704460
1. 构建软件仓库
1.1. 安装httpd服务器
[[email protected] ~]# yum install httpd -y [[email protected] ~]# systemctl restart httpd [[email protected] ~]# systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled) Active: active (running) since Thu 2015-10-29 10:55:30 CST; 3s ago Process: 15388 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) Main PID: 15393 (httpd) Status: "Processing requests..." CGroup: /system.slice/httpd.service ├─15393 /usr/sbin/httpd -DFOREGROUND ├─15394 /usr/sbin/httpd -DFOREGROUND ├─15395 /usr/sbin/httpd -DFOREGROUND ├─15396 /usr/sbin/httpd -DFOREGROUND ├─15397 /usr/sbin/httpd -DFOREGROUND └─15398 /usr/sbin/httpd -DFOREGROUND
1.2 挂载ISO到系统中(将准备的ISO放置到系统的某个目录下,本文假定放在/data1目录下)
[[email protected] ~]# vim /etc/fstab /data1/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7.0 iso9660 defaults 0 0 /data1/RHEL7OSP-6.0-2015-02-23.2-x86_64.iso /var/www/html/rhel7osp iso9660 defaults 0 0 #创建挂载目录 [[email protected] ~]# mkdir -p /var/www/html/rhel7.0 [[email protected] ~]# mkdir -p /var/www/html/rhel7osp #执行挂载 [[email protected] ~]# mount -a [[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda3 8.6G 1.3G 7.3G 15% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.4M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/vda1 497M 90M 408M 18% /boot /dev/vdc1 100G 4.1G 96G 5% /data1 /dev/loop0 3.5G 3.5G 0 100% /var/www/html/rhel7.0 /dev/loop1 515M 515M 0 100% /var/www/html/rhel7osp
说明:此时可以测试下http服务器中的yum源是否可用,可以通过浏览器或者elinks字符工具测试,如下为测试的方法:
[[email protected] ~]# elinks --dump http://10.16.4.59/rhel7.0 ##测试rhel7基本仓库的yum源 Index of /rhel7.0 [1][ICO] [2]Name [3]Last [4]Size [5]Description modified ---------------------------------------------------------------------------- [6][PARENTDIR] [7]Parent Directory - [8][DIR] [9]EFI/ 2014-05-07 - 15:58 [10][TXT] [11]EULA 2014-04-04 8.1K [[email protected] ~]# elinks --dump http://10.16.4.59/rhel7osp ##测试openstack的yum源 Index of /rhel7osp [1][ICO] [2]Name [3]Last [4]Size [5]Description modified --------------------------------------------------------------------------- [6][PARENTDIR] [7]Parent Directory - [8][DIR] [9]RH7-RHOS-6.0-Installer/ 2015-02-24 - 09:58 [10][DIR] [11]RH7-RHOS-6.0/ 2015-02-24 - 09:55 [12][DIR] [13]RHEL-7-RHSCL-1.2/ 2015-02-24 - 10:01 [14][DIR] [15]RHEL7-Errata/ 2015-02-14 - 00:05 [16][TXT] [17]version.txt 2015-02-24 58 10:01 ---------------------------------------------------------------------------
1.3 配置yum客户端
[[email protected] ~]# cat /etc/yum.repos.d/rhel7.0.repo #基本仓库 [rhel7.0] name=redhat rhel7.0 base reposity baseurl=http://10.16.4.59/rhel7.0 enabled=1 gpgcheck=http://10.16.4.59/rhel7.0/RPM-GPG-KEY-redhat-release gpgcheck=0 [[email protected] ~]# cat /etc/yum.repos.d/rhel7.0.repo #openstack仓库,有四个个安装频道 [rhel7.0] name=redhat rhel7.0 base reposity baseurl=http://10.16.4.59/rhel7.0 enabled=1 gpgcheck=http://10.16.4.59/rhel7.0/RPM-GPG-KEY-redhat-release gpgcheck=0 [[email protected] ~]# cat /etc/yum.repos.d/rhel7.0.repo [rhel7.0] name=redhat rhel7.0 base reposity baseurl=http://10.16.4.59/rhel7.0 enabled=1 gpgcheck=http://10.16.4.59/rhel7.0/RPM-GPG-KEY-redhat-release gpgcheck=0 [[email protected] ~]# cat /etc/yum.repos.d/rhel7osp.repo [RH7-RHOS-6.0] name=redhat openstack 6 RH7-RHOS-6.0 reposity baseurl=http://10.16.4.59/rhel7osp/RH7-RHOS-6.0 enabled=1 gpgcheck=0 [RH7-RHOS-6.0-Installer] name=RH7-RHOS-6.0-Installer baseurl=http://10.16.4.59/rhel7osp/RH7-RHOS-6.0-Installer enabled=1 gpcheck=0 [RHEL7-Errata] name=RHEL7-Errata baseurl=http://10.16.4.59/rhel7osp/RHEL7-Errata enabled=1 gpgcheck=0 [RHEL-7-RHSCL-1.2] name=RHEL-7-RHSCL-1.2 baseurl=http://10.16.4.59/rhel7osp/RHEL-7-RHSCL-1.2 enabled=1 gpgcheck=0 #测试yum仓库是否可用, [[email protected] ~]# yum repolist Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile repo id repo name status RH7-RHOS-6.0 redhat openstack 6 RH7-RHOS-6.0 reposity 393 RH7-RHOS-6.0-Installer RH7-RHOS-6.0-Installer 194 RHEL-7-RHSCL-1.2 RHEL-7-RHSCL-1.2 1,766 RHEL7-Errata RHEL7-Errata 11 rhel7.0 redhat rhel7.0 base reposity 4,305 repolist: 6,669 注意事项:如果yum源不可用,请校验firewalld,校验httpd服务配置是否正确,挂载路径,是否有其他的仓库影响(建议将其他仓库删除),如果发现由上面所注册的5个频道,说明yum源配置完毕,下面可以开启redhat openstack之juno之旅了!
2. 通过packstack构建all-in-one环境—neutron
packstack是redhat推出的一款自动化部署和配置openstack的管理工具,其底层基于puppet来实现。此外,openstack中neutron可以用多种模式实现网络的隔离,如vlan,vxlan,gre,flat,此处采用vlan的模式部署(eth1网卡用于tenant instance的网络,eth0网卡用于管理网和instance外部网络)。
2.1,安装和配置packstack
[[email protected] ~]# yum install openstack-packstack -y [[email protected] ~]# packstack --gen-answer-file /root/answer.txt #生成应答文件 Packstack changed given value to required value /root/.ssh/id_rsa.pub
修改应答文件内容:
[[email protected] ~]# vim /root/answer.txt 67 CONFIG_NTP_SERVERS=ntp服务器地址 ntp服务器地址,一般指向局域网内的ntp服务器,或者是controller 246 CONFIG_KEYSTONE_ADMIN_PW=redhat admin管理员的密码 249 CONFIG_KEYSTONE_DEMO_PW=redhat demo用户的密码 282 CONFIG_CINDER_VOLUMES_CREATE=y 是否创建VG,上课环境已经有cinder-volumes,应设置为n,自己搭建的环境没有,应保留为yes 485 CONFIG_LBAAS_INSTALL=y 是否启用LBaaS功能,默认关闭,有需要可以启用 489 CONFIG_NEUTRON_METERING_AGENT_INSTALL=n Ceilometer监控的agent 492 CONFIG_NEUTRON_FWAAS=y 是否要启用FWaaS功能 496 CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vlan 配置OVS网络驱动类型为vlan,多个可以用逗号分隔 501 CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES=vlan 设置tenant能够使用的网络类型,多种类型,可用逗号,分隔 506 CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS=openvswitch 使用OVS网络机制驱动,保障网络命名空间 517 CONFIG_NEUTRON_ML2_VLAN_RANGES=physnet1:1:1000 定义物理网卡的vlan id范围,其中physnet1需要和某个网桥关联,网桥需要和某个外部接口关联 545 CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-eth1 定义physnet1和网桥br-eth1关联,网卡和网桥br-eth1关联 549 CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-eth1:eth1 定义网卡和网桥br-eth1关联,操作命令为:ovs-vsctl add-port br-eth1 eth1 629 CONFIG_PROVISION_DEMO=n 关闭自动测试功能
开始安装,基于应答文件来实现:
[[email protected] ~]# packstack --answer-file /root/answer.txt Welcome to the Packstack setup utility The installation log file is available at: /var/tmp/packstack/20151029-141031-iTUrA5/openstack-setup.log Installing: Clean Up [ DONE ] Setting up ssh keys [ DONE ] Discovering hosts‘ details [ DONE ] Adding pre install manifest entries [ DONE ] Installing time synchronization via NTP [ DONE ] Preparing servers [ DONE ] Adding AMQP manifest entries [ DONE ] Adding MariaDB manifest entries [ DONE ] Adding Keystone manifest entries [ DONE ] Adding Glance Keystone manifest entries [ DONE ] Adding Glance manifest entries [ DONE ] Adding Cinder Keystone manifest entries [ DONE ] Checking if the Cinder server has a cinder-volumes vg[ DONE ] Adding Cinder manifest entries [ DONE ] Adding Nova API manifest entries [ DONE ] Adding Nova Keystone manifest entries [ DONE ] Adding Nova Cert manifest entries [ DONE ] Adding Nova Conductor manifest entries [ DONE ] Creating ssh keys for Nova migration [ DONE ] Gathering ssh host keys for Nova migration [ DONE ] Adding Nova Compute manifest entries [ DONE ] Adding Nova Scheduler manifest entries [ DONE ] Adding Nova VNC Proxy manifest entries [ DONE ] Adding OpenStack Network-related Nova manifest entries[ DONE ] Adding Nova Common manifest entries [ DONE ] Adding Neutron API manifest entries [ DONE ] Adding Neutron Keystone manifest entries [ DONE ] Adding Neutron L3 manifest entries [ DONE ] Adding Neutron L2 Agent manifest entries [ DONE ] Adding Neutron DHCP Agent manifest entries [ DONE ] Adding Neutron LBaaS Agent manifest entries [ DONE ] Adding Neutron Metering Agent manifest entries [ DONE ] Adding Neutron Metadata Agent manifest entries [ DONE ] Checking if NetworkManager is enabled and running [ DONE ] Adding OpenStack Client manifest entries [ DONE ] Adding Horizon manifest entries [ DONE ] Adding Swift Keystone manifest entries [ DONE ] Adding Swift builder manifest entries [ DONE ] Adding Swift proxy manifest entries [ DONE ] Adding Swift storage manifest entries [ DONE ] Adding Swift common manifest entries [ DONE ] Adding MongoDB manifest entries [ DONE ] Adding Redis manifest entries [ DONE ] Adding Ceilometer manifest entries [ DONE ] Adding Ceilometer Keystone manifest entries [ DONE ] Adding Nagios server manifest entries [ DONE ] Adding Nagios host manifest entries [ DONE ] Adding post install manifest entries [ DONE ] 说明:可能会遇到openstack-selinux无法安装的问题,解决方法:到光盘中找到该对应的包,然后使用rpm -ivh openstack-selinux.*.rpm --nodeps的方式将其安装,如下: [[email protected] ~]# rpm -ivh /var/www/html/rhel7osp/RH7-RHOS-6.0/Packages/openstack-selinux-0.6.23-1.el7ost.noarch.rpm --nodeps warning: /var/www/html/rhel7osp/RH7-RHOS-6.0/Packages/openstack-selinux-0.6.23-1.el7ost.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ################################# [100%] Updating / installing... 1:openstack-selinux-0.6.23-1.el7ost################################# [100%]
关于packstack选项的说明:
- 通用配置选项
7 CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub SSH公钥所在路径,packstack用该公钥实现远程无密码登陆,需要输入远程主机的root密码(如部署多个compute时使用)
12 CONFIG_DEFAULT_PASSWORD= 设置所有服务的密码,设置之后,将会覆盖掉所有认证相关的密码,比如admin,database,keystone密码
15 CONFIG_MARIADB_INSTALL=y 是否安装DB
19 CONFIG_GLANCE_INSTALL=y 是否安装glance
23 CONFIG_CINDER_INSTALL=y 是否安装cinder
27 CONFIG_NOVA_INSTALL=y 是否安装nova
31 CONFIG_NEUTRON_INSTALL=y 是否安装neutron,设置为n则安装nova-network
35 CONFIG_HORIZON_INSTALL=y 是否安装dashboard
39 CONFIG_SWIFT_INSTALL=y 是否安装swift
43 CONFIG_CEILOMETER_INSTALL=y 是否安装ceilometor