Openstack Grizzily 单节点测试机安装( All In One CentOS/RHEL)

Openstack Grizzily版本已经相当完善,根据官方文档安装基本不存在什么问题,但是想快速测试了解Openstack功能的用户非常多,devstack的安 装需要check最新的代码,时常碰到一些bug。这里记录一下我的单节点安装日志,尽量合并,优化一些项目以减少复杂性:


1.安装操作系统: CentOS6.4/RHEL,打开ssh, 配置root,先更新一下yum update

2.6.4的已经包含openstack-grizzly的源:

 

3.更新系统

yum update

这次更新比较多,重启一下是个好习惯.

reboot

4.关闭SELINUX,这个导致的问题可不少。

 vi /etc/selinux/config
SELINUX=permissive

5.配置IP:

用setup工具更新

 

6.安装组件了,为了方便,一次将所有的包都装上,这里只列了一些关键包,根据依赖关系,其它的包应该都会自动装上:

yum  install ntp mysql mysql-server MySQL-python openstack-utils memcached qpid-cpp-server  openstack-nova-novncproxy openstack-utils openstack-keystone python-keystoneclient openstack-glance dnsmasq-utils openstack-cinder openstack-cinder-doc  iscsi-initiator-utils scsi-target-utils openstack-nova python-novaclient git-core memcached python-memcached mod_wsgi openstack-dashboard tomcat6

#如果不需要支持 vmware tomcat6 可以选

6.1. RedHat 下面需要chkconfig 设置所有服务启动模式

chkconfig mysqld on;
chkconfig libvirtd on;
chkconfig qpidd on;
for svc in keystone glance-api glance-registry nova-api nova-objectstore nova-compute nova-network nova-conductor nova-console nova-consoleauth nova-metadata-api nova-xvpvncproxy nova-scheduler nova-cert; do chkconfig openstack-$svc on ; done

 

 

 

 

7. 配置本地环境变量

vi ~/novarc
export OS_TENANT_NAME=admin
export OS_TENANT_ID=30387eb46b624012bce5172ac77ab407
export OS_USERNAME=admin
export OS_PASSWORD=password
export OS_AUTH_URL="http://127.0.0.1:35357/v2.0"
export OS_REGION_NAME=RegionOne
export OS_IDENTITY_API_VERSION=2.0
export SERVICE_TOKEN=ADMIN
export SERVICE_ENDPOINT="http://127.0.0.1:35357/v2.0"

echo "source ~/novarc" >> ~/.bashrc

允许ip转发

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

8.创建mysql数据库,一次创建所有的库,可以用http://10.51.166.16/phpmyadmin界面来创建:

keystone;glance;nova;cinder;quantum;

9.配置keystone

sed -i "s/sqlite:////var/lib/keystone/keystone.db/mysql://root:[email protected]/keystone/g" /etc/keystone/keystone.conf
keystone-manage pki_setup
chown -R keystone:keystone /etc/keystone/*
user script initiate keystone data

restart keystone

初始化各个组件的数据库,Redhat下有openstack-db脚本帮我们初始化很方便:

openstack-db --init --service keystone
keystone-manager db sync
openstack-db --init --service glance
glance-manage db sync
openstack-db --init --service nova
nova-manager db sync
openstack-db --init --service cinder
cinder-manager db sync

10.初始化keystone_db数据,创建用户和服务,这里使用一个脚本,粘到文件中运行,内容如下:

 

View Code

 

脚本执行完毕,正常输出:

View Code

 

将此id替换novarc文件中相应的值,并重新source

11. 配置glance服务

替换glance-registry.conf 和glance-api.conf中的相关变量

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/glance/glance-registry.conf
sed -i "s/%SERVICE_USER%/service/g" /etc/glance/glance-registry.conf
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/glance/glance-registry.conf
sed -i "s/#flavor=/flavor=keystone/g" /etc/glance/glance-registry.conf
sed -i "s/sqlite:\/\/\/\/var\/lib\/glance\/glance.sqlite/mysql:\/\/root:[email protected]\/glance/g" /etc/glance/glance-registry.conf

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/glance/glance-api.conf
sed -i "s/%SERVICE_USER%/service/g" /etc/glance/glance-api.conf
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/glance/glance-api.conf
sed -i "s/#flavor=/flavor=keystone/g" /etc/glance/glance-api.conf
sed -i "s/sqlite:\/\/\/\/var\/lib\/glance\/glance.sqlite/mysql:\/\/root:[email protected]\/glance/g" /etc/glance/glance-api.conf


restart glance-api
restart glance-registry

 

同步数据库



glance image-list

未输出东西则表示正常

12.配置libvirt

删除默认网桥

root@ubuntu:~# virsh net-destroy default
Network default destroyed

root@ubuntu:~# virsh net-undefine default
Network default has been undefined

修改libvirt支持tcp监听

sed -i "s/#listen_tls = 0/listen_tls = 0/g" /etc/libvirt/libvirtd.conf
sed -i "s/#listen_tcp = 1/listen_tcp = 1/g" /etc/libvirt/libvirtd.conf
sed -i "s/#auth_tcp = "sasl"/auth_tcp = "none"/g" /etc/libvirt/libvirtd.conf

sed -i "s/env libvirtd_opts=\"-d\"/env libvirtd_opts=\"-d -l\"/g" /etc/init/libvirt-bin.conf

vi /etc/libvirt/qemu.conf

cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc","/dev/hpet","/dev/net/tun"
]


restart libvirt-bin

13. 配置nova

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/nova/api-paste.ini
sed -i "s/%SERVICE_USER%/service/g" /etc/nova/api-paste.ini
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/nova/api-paste.ini

vi nova.conf

View Code

vi /etc/nova/nova-compute.conf

[DEFAULT]
libvirt_type=kvm
compute_driver=libvirt.LibvirtDriver
libvirt_ovs_bridge=br-int
libvirt_vif_type=ethernet
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
libvirt_use_virtio_for_bridges=True

同步nova 数据库

nova-manage db sync

 

14. 配置cinder

启用iscsi

sed -i 's/false/true/g' /etc/default/iscsitarget

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/cinder/api-paste.ini
sed -i "s/%SERVICE_USER%/service/g" /etc/cinder/api-paste.ini
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/cinder/api-paste.ini

echo "sql_connection = mysql://root:[email protected]/cinder" >> /etc/cinder/cinder.conf
echo "notification_driver=cinder.openstack.common.notifier.rpc_notifier" >> /etc/cinder/cinder.conf

cinder-manage db sync

如果没有未使用的分区或者磁盘,只能使用虚拟文件来代替

dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=2G
losetup /dev/loop2 cinder-volumes
fdisk /dev/loop2
#Type in the followings:
n
p
1
ENTER
ENTER
t
8e
w

创建cinder-volumes

pvcreate /dev/loop2
vgcreate cinder-volumes /dev/loop2

15.配置quantum

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/quantum/metadata_agent.ini
sed -i "s/%SERVICE_USER%/service/g" /etc/quantum/metadata_agent.ini
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/quantum/metadata_agent.ini

sed -i "s/%SERVICE_TENANT_NAME%/service/g" /etc/quantum/quantum.conf
sed -i "s/%SERVICE_USER%/service/g" /etc/quantum/quantum.conf
sed -i "s/%SERVICE_PASSWORD%/password/g" /etc/quantum/quantum.conf
#打开LB支持
sed -i "s/# service_plugins =/service_plugins = quantum.plugins.services.agent_loadbalancer.plugin.LoadBalancerPlugin/g" /etc/quantum/quantum.conf

 

sed -i "s/sqlite:\/\/\/\/var\/lib\/quantum\/ovs.sqlite/mysql:\/\/root:[email protected]\/quantum/g" /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini vi /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini

在尾部增加

[OVS]
tenant_network_type = gre
tunnel_id_ranges = 1:1000
enable_tunneling = True
integration_bridge = br-int
tunnel_bridge = br-tun
local_ip = 10.51.166.16

配置open-vswitch

ovs-vsctl add-br br-int
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex eth1

这部分可参考:

http://www.cnblogs.com/biangbiang/archive/2013/05/17/3083421.html


下面可以登录Dashboard使用了。

http://10.51.166.16/horizon

 

Ps:  VMware vCenter 支持的nova配置
compute_driver=vmwareapi.VMwareVCDriver
vmwareapi_host_ip=<vcenter host ip>
vmwareapi_host_username=root
vmwareapi_host_password=passw0rd
vmwareapi_vlan_interface=vmnic4 (change to actually use)
vmwareapi_wsdl_loc=http://127.0.0.1:8080/SDK/vsphere-ws/wsdl/vim25/vimService.wsdl

 

其它的Openstack命令

不能不说Redhat在openstack项目上后来居上,做的工作更细一下

比如openstackdb 命令

还有openstack-status 可以显示状态

[root@osee ~]# openstack-status
== Nova services ==
openstack-nova-api:           active
openstack-nova-cert:          active
openstack-nova-compute:       active
openstack-nova-network:       active
openstack-nova-scheduler:     active
openstack-nova-volume:        inactive (disabled on boot)
openstack-nova-conductor:     active
== Glance services ==
openstack-glance-api:         active (disabled on boot)
openstack-glance-registry:    active (disabled on boot)
== Keystone service ==
openstack-keystone:           active
== Horizon service ==
openstack-dashboard:          active
== Quantum services ==
quantum-server:               inactive (disabled on boot)
== Cinder services ==
openstack-cinder-api:         active
openstack-cinder-scheduler:   active
openstack-cinder-volume:      active
== Support services ==
mysqld:                       active
httpd:                        active
libvirtd:                     active
tgtd:                         active
qpidd:                        active (disabled on boot)
memcached:                    active
== Keystone users ==
+----------------------------------+--------+---------+------------------------+
|                id                |  name  | enabled |         email          |
+----------------------------------+--------+---------+------------------------+
| a1e75aad863a4549ba3cc27f3c14d7d6 |   U1   |   True  | [email protected] |
| d432c382498842f087f561f742dfa6e2 | admin  |   True  |    [email protected]    |
| 3e5d1b34aec04f40894a96625a01f0b8 | cinder |   True  |   [email protected]    |
| 6f55666830f148749a97dade6f36721a | glance |   True  |   [email protected]    |
| 69cde8f293e74881a277f635efdfc056 |  nova  |   True  |    [email protected]     |
+----------------------------------+--------+---------+------------------------+
== Glance images ==
ID                                   Name                           Disk Format          Container Format     Size
------------------------------------ ------------------------------ -------------------- -------------------- --------------
20733194-8515-4a37-9ca8-1a24da74dfe5 RHEL-SCO                       vmdk                 bare                      869815296
3831b19f-4bf1-4254-92c3-af0363dacf77 ReHat63_vmdk                   vmdk                 bare                      913870848
af141a7b-d9ad-4706-8217-e203e744cac3 Centos62                       qcow2                bare                     1458962432
bd4ded42-7e1a-4264-b3e9-8e27a7ddaeee Ubuntu1204                     qcow2                bare                      252641280
d310f3b6-459e-4f76-aa8a-5fa1a88d6009 RHEL63                         qcow2                bare                      248250368
03db12bc-1d54-4c23-bcfe-f5be0e06f821 cirros                         ami                  ami                        25165824
ae6129ce-5cc3-485e-bd78-b6ff2e5e614e cirros-ramdisk                 ari                  ari                         3714968
88d25fbe-2cfb-465b-86e1-c460f0ea67d7 cirros-kernel                  aki                  aki                         4955792
1691bc89-b1d1-4f8a-a8ce-3400b8cdb648 Cirros031                      qcow2                bare                       25165824
== Nova instance flavors ==
m1.medium: Memory: 4096MB, VCPUS: 2, Root: 40GB, Ephemeral: 0Gb, FlavorID: 3, Swap: 0MB, RXTX Factor: 1.0, public, ExtraSpecs {}
m1.large: Memory: 8192MB, VCPUS: 4, Root: 80GB, Ephemeral: 0Gb, FlavorID: 4, Swap: 0MB, RXTX Factor: 1.0, public, ExtraSpecs {}
m1.tiny: Memory: 512MB, VCPUS: 1, Root: 0GB, Ephemeral: 0Gb, FlavorID: 1, Swap: 0MB, RXTX Factor: 1.0, public, ExtraSpecs {}
m1.xlarge: Memory: 16384MB, VCPUS: 8, Root: 160GB, Ephemeral: 0Gb, FlavorID: 5, Swap: 0MB, RXTX Factor: 1.0, public, ExtraSpecs {}
m1.small: Memory: 2048MB, VCPUS: 1, Root: 20GB, Ephemeral: 0Gb, FlavorID: 2, Swap: 0MB, RXTX Factor: 1.0, public, ExtraSpecs {}
== Nova instances ==
+--------------------------------------+------+--------+-----------------------+
| ID                                   | Name | Status | Networks              |
+--------------------------------------+------+--------+-----------------------+
| f716147e-ce56-4e05-b3ae-053500af6cb6 | M1   | ACTIVE | private=192.168.100.3 |
| 0928dfce-edc6-455b-a570-8922fe64287a | aaa  | ACTIVE | private=192.168.100.2 |
+--------------------------------------+------+--------+-----------------------+
[root@osee ~]#

还有其它的命令

[root@osee ~]# openstack-
openstack-config                openstack-db2                   openstack-keystone-sample-data  openstack-status
openstack-db                    openstack-demo-install          openstack-obfuscate

 


你可能感兴趣的:(openstack)