CentOS 6.2下安装 openstack 2012.1(essax)

现在 ubuntu 上安装已经比较方便,但是 CentOS 下安装 openstack 2012还是比较痛苦,我做了一个软件包,方便大家使用:

http://openstack.pubyun.com/centos/6/pubyun/x86_64/

安装方法如下:

wget -O /etc/yum.repos.d/pubyun.repo http://openstack.pubyun.com/centos/6/pubyun/x86_64/pubyun.repo

安装epel的源:
rpm -i http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

安装 kvm 虚拟机软件:
yum -y install kvm virt-manager libvirt libvirt-python python-virtinst libvirt-client bridge-utils

安装openstack 和相应的软件:
yum -y install openstack-nova openstack-glance openstack-keystone openstack-dashboard rabbitmq-server python-pip python-tempita ntp ntpdate

#升级 sqlalchemy
pip-python install -U sqlalchemy

启动 mysql server:
chkconfig mysqld on && service mysqld restart

设置和启动 libvritd:
perl -pi -e “s|#mdns_adv|mdns_adv|” /etc/libvirt/libvirtd.conf
perl -pi -e “s|#auth_unix_rw|auth_unix_rw|” /etc/libvirt/libvirtd.conf

chkconfig libvirtd on && service libvirtd restart
virsh net-autostart default –disable
virsh net-destroy default
启动 ntp 时间同步:
chkconfig ntpd on && service ntpd restart

 

设置用户密码,注意,域名一定要设置正确,否则 rabbitmq-server 无法正常启动。如果不能控制域名服务器:

vi /etc/sysconfig/network

#设置成你要的域名

HOSTNAME=nova.pubyun.com

vi  /etc/hosts

#正确配置域名服务器,或者将域名、IP写入 hosts文件

#IP是你当前机器的IP,域名是你刚才设置的域名

172.16.11.12  nova.pubyun.com nova

 

如果不想重新启动机器,则:

hostname  nova.pubyun.com

启动 rabbitmq-server:

chkconfig rabbitmq-server on && service rabbitmq-server restart
rabbitmqctl change_password guest nova

查看rabbitmq-server的状态:
rabbitmqctl list_exchanges
rabbitmqctl list_queues
rabbitmqctl list_bindings

 

设置 lvm for nova volume:
dd if=/dev/zero of=/var/lib/nova/nova-volumes.img bs=1M seek=20k count=0
vgcreate nova-volumes $(losetup –show -f /var/lib/nova/nova-volumes.img)

设置 nova 的一些参数:
openstack-config-set /etc/nova/nova.conf DEFAULT libvirt_type kvm
openstack-config-set /etc/nova/nova.conf DEFAULT rpc_backend nova.rpc.impl_kombu
openstack-config-set /etc/nova/nova.conf DEFAULT rabbit_host localhost
openstack-config-set /etc/nova/nova.conf DEFAULT rabbit_password nova
openstack-config-set /etc/nova/nova.conf DEFAULT auth_strategy keystone

设置 nova 的数据:
openstack-nova-db-setup

openstack-keystone-db-setup

设置用户名:
cat > keystonerc <<EOF
export ADMIN_TOKEN=$(openssl rand -hex 10)
export OS_USERNAME=admin
export OS_PASSWORD=nova
export OS_TENANT_NAME=admin
export OS_AUTH_URL=http://127.0.0.1:5000/v2.0/
EOF

. ./keystonerc

mkdir -p /var/run/keystone
chown keystone.keystone /var/run/keystone/

#启动 keystone
openstack-config-set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
chkconfig openstack-keystone on && service openstack-keystone restart

#导入keystone数据:
ADMIN_PASSWORD=$OS_PASSWORD openstack-keystone-sample-data

#查看一下,keystone是否工作:
keystone user-list
keystone tenant-list

#设置、启动 glance
openstack-config-set /etc/glance/glance-api.conf paste_deploy flavor keystone
openstack-config-set /etc/glance/glance-registry.conf paste_deploy flavor keystone
openstack-config-set /etc/glance/glance-api-paste.ini filter:authtoken admin_token $ADMIN_TOKEN
openstack-config-set /etc/glance/glance-registry-paste.ini filter:authtoken admin_token $ADMIN_TOKEN
for svc in api registry; do service openstack-glance-$svc start; done
for svc in api registry; do chkconfig openstack-glance-$svc on; done

for svc in api registry; do service openstack-glance-$svc status; done

grep -i error /var/log/glance/*.log
导入image:
curl http://images.ansolabs.com/tty.tgz | tar -xzv
glance add name=aki-tty is_public=true container_format=aki disk_format=aki < aki-tty/image
glance add name=ari-tty is_public=true container_format=ari disk_format=ari < ari-tty/image
glance add name=ami-tty is_public=true container_format=ami disk_format=ami \
“kernel_id=$(glance index | awk ‘/aki-tty/ {print $1}’)” \
“ramdisk_id=$(glance index | awk ‘/ari-tty/ {print $1}’)” \
< <(zcat –force ami-tty/image)

检查 glance 是否正常工作:
glance index

#启动 nova
sed -i -e ‘s/# \(pipeline = .*\keystone\)/\1/g’ /etc/nova/api-paste.ini
openstack-config-set /etc/nova/api-paste.ini filter:authtoken admin_token $ADMIN_TOKEN
for svc in api cert compute network objectstore scheduler volume; do service openstack-nova-$svc start; done
for svc in api cert compute network objectstore scheduler volume; do chkconfig openstack-nova-$svc on; done

#nova 是否正常工作
nova flavor-list
nova endpoints
. ./keystonerc
USER_ID=$(keystone user-list | awk ‘/admin / {print $2}’)
ACCESS_KEY=$(keystone ec2-credentials-list –user $USER_ID | awk ‘/admin / {print $4}’)
SECRET_KEY=$(keystone ec2-credentials-list –user $USER_ID | awk ‘/admin / {print $6}’)
cat > novarc <<EOF
export EC2_URL=http://localhost:8773/services/Cloud
export EC2_ACCESS_KEY=$ACCESS_KEY
export EC2_SECRET_KEY=$SECRET_KEY
EOF
chmod 600 novarc
. ./novarc

euca-add-keypair nova_key > nova_key.priv
euca-describe-keypairs
nova-manage network create private –multi_host=T –fixed_range_v4=10.9.0.0/16 –num_networks=1 –network_size=256 –bridge=br100 –bridge_interface=eth1

nova-manage floating create –ip_range=192.168.28.32/27

nova keypair-add   –pub_key refactor.pub refactor

nova keypair-list

nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 # to allow ping

nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 # to allow only SSH or do
nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0 # to allow all TCP
nova secgroup-add-rule default udp 1 65535 0.0.0.0/0 # and all UDP
nova secgroup-list-rules default # lists the rules

nova boot –flavor 1 –image  299982b4-97c2-4e1b-88d4-52ef8f0a5b5b –key_name refactor t1

nova floating-ip-create

nova add-floating-ip t1 192.168.28.33

mkdir /var/www/.novaclient

chkconfig httpd on && service httpd restart

 

 

此条目发表在OpenStack分类目录,贴了, 标签。将固定链接加入收藏夹。

CentOS 6.2下安装 openstack 2012.1(essax)》有 7 条评论

  1. Changliwei说:

    lvm创建nova-volumes 用法不对
    参考http://os.51cto.com/art/201109/289777.htm
    vpsee

  2. wendal说:

    还是很复杂,唉…

  3. Changliwei说:

    pip-python install -U sqlalchemy
    Downloading/unpacking sqlalchemy
    Downloading SQLAlchemy-0.7.6.tar.gz (2.6Mb): 2.6Mb downloaded
    Running setup.py egg_info for package sqlalchemy
    warning: no files found matching ‘*.jpg’ under directory ‘doc’
    no previously-included directories found matching ‘doc/build/output’
    Installing collected packages: sqlalchemy
    Found existing installation: SQLAlchemy 0.5.5
    Uninstalling SQLAlchemy:
    Successfully uninstalled SQLAlchemy
    Running setup.py install for sqlalchemy
    building ‘sqlalchemy.cprocessors’ extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-x86_64-2.6/lib/sqlalchemy/cextension/processors.o
    gcc -pthread -shared build/temp.linux-x86_64-2.6/lib/sqlalchemy/cextension/processors.o -L/usr/lib64 -lpython2.6 -o build/lib.linux-x86_64-2.6/sqlalchemy/cprocessors.so
    building ‘sqlalchemy.cresultproxy’ extension
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.6 -c lib/sqlalchemy/cextension/resultproxy.c -o build/temp.linux-x86_64-2.6/lib/sqlalchemy/cextension/resultproxy.o
    gcc -pthread -shared build/temp.linux-x86_64-2.6/lib/sqlalchemy/cextension/resultproxy.o -L/usr/lib64 -lpython2.6 -o build/lib.linux-x86_64-2.6/sqlalchemy/cresultproxy.so
    warning: no files found matching ‘*.jpg’ under directory ‘doc’
    no previously-included directories found matching ‘doc/build/output’
    Successfully installed sqlalchemy
    Cleaning up…
    [root@CentOS X11]#
    [root@CentOS X11]# rpm -qa | grep SQLAlchemy
    [root@CentOS X11]# rpm -qa | grep chemy
    python-sqlalchemy0.7-0.7.3-4.el6.x86_64
    python-sqlalchemy-0.5.5-3.el6_2.noarch

  4. SamSu说:

    我在Ubuntu上安装Essex RC1也是非常痛苦,有一些问题想求教,如果方便的话,能否告知你的联系方式(email到我的邮箱susltd.su@gmail.com,或论坛都行),多谢!

  5. Pingback引用通告: OpenStack 2012.1 “essex” 的改进 « 公云网博客

  6. Pingback引用通告: openstack 之 安装 | 编程X资讯

发表评论

电子邮件地址不会被公开。 必填项已用*标注