现在ubuntu上安装已经比较方便,但是CentOS下安装openstack2012还是比较痛苦,我做了一个软件包,方便大家使用:http://openstack.pubyun.com/centos/6/pubyun/x86_64/安装方法如下:wget-O/etc/yum.repos.d/pubyun.repohtt
现在 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 <
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
glance add name=ari-tty is_public=true container_format=ari
disk_format=ari
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 <
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