在安裝完基本的 CentOS 6.0 系統後(最小化安裝)升級和更新整個系統,然後關閉 SELINUX 後重啟,為了簡單方便最好也關閉 iptables:
# yum update # yum upgrade # vi /etc/sysconfig/selinux SELINUX=disabled # chkconfig iptables off # service iptables stop # shutdown -r now
下載和安裝 OpenStack 源:
# wget http://yum.griddynamics.net/yum/diablo-3/openstack/openstack-repo-2011.3-0.3.noarch.rpm # rpm -ivh openstack-repo-2011.3-0.3.noarch.rpm
# yum install libvirt # chkconfig libvirtd on # service libvirtd start
# yum install euca2ools openstack-nova-node-full unzip
# yum install openstack-nova-node-compute
OpenStack Nova 需要數據庫的支持,這裡用的是 MySQL:
# service mysqld start # chkconfig mysqld on # service rabbitmq-server start # chkconfig rabbitmq-server on
# vi /etc/my.cnf ... #bind-address = 127.0.0.1 bind-address = 0.0.0.0 ... # service mysql restart
# mysql -uroot -ppassword -e 'CREATE DATABASE nova;' # mysql -uroot -ppassword -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;" # mysql -uroot -ppassword -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('password');"
$ sudo vi /etc/nova/nova.conf --verbose=false --ec2_url=http://172.16.39.111:8773/services/Cloud --s3_host=172.16.39.111 --cc_host=172.16.39.111 --rabbit_host=172.16.39.111 --sql_connection=mysql://nova:[email protected]/nova --glance_api_servers=172.16.39.111:9292 --use_s3=true --libvirt_type=kvm --use_syslog=false --node_availability_zone=nova --logdir=/var/log/nova --logging_context_format_string=%(asctime)s %(name)s: %(levelname)s [%(request_id)s %(user)s %(project)s] %(message)s --logging_default_format_string=%(asctime)s %(name)s: %(message)s --logging_debug_format_suffix= --use_cow_images=true --auth_driver=nova.auth.dbdriver.DbDriver --network_manager=nova.network.manager.VlanManager --scheduler_driver=nova.scheduler.zone.ZoneScheduler --image_service=nova.image.glance.GlanceImageService --use_ipv6=false --ca_path=/var/lib/nova/CA --keys_path=/var/lib/nova/keys --images_path=/var/lib/nova/images --buckets_path=/var/lib/nova/buckets --instances_path=/var/lib/nova/instances --networks_path=/var/lib/nova/networks --dhcpbridge_flagfile=/etc/nova/nova.conf --dhcpbridge=/usr/bin/nova-dhcpbridge --injected_network_template=/usr/share/nova/interfaces/ --libvirt_xml_template=/usr/share/nova/libvirt.xml.template --vpn_client_template=/usr/share/nova/client.ovpn.template --credentials_template=/usr/share/nova/novarc.template --state_path=/var/lib/nova --lock_path=/var/lib/nova/tmp --vnc_enabled=true --vncproxy_url=http://172.16.39.111:6080 --vncserver_host=0.0.0.0 --vnc_token_ttl=300
# vi nova-restart-all.sh #!/bin/bash for n in api compute network objectstore scheduler vncproxy; do service openstack-nova-$n restart; done service openstack-glance-api restart service openstack-glance-registry restart # chmod +x nova-restart-all.sh # ./nova-restart-all.sh
# nova-manage db sync # nova-manage network create 192.168.0.0/24 1 255 # nova-manage floating create 10.10.10.2 10.10.10.224/27 # nova-manage user admin vpsee # nova-manage project create mycloud vpsee
# mkdir /home/vpsee/creds # nova-manage project zipfile mycloud vpsee /home/vpsee/creds/novacreds.zip # cd /home/vpsee/creds # unzip novacreds.zip # chown -R vpsee:vpsee /home/vpsee/creds/ # source /home/vpsee/creds/novarc
# ./nova-restart-all.sh
# euca-describe-availability-zones verbose AVAILABILITYZONE nova available AVAILABILITYZONE |- node00 AVAILABILITYZONE | |- nova-network enabled :-) 2011-08-16 19:28:13 AVAILABILITYZONE | |- nova-compute enabled :-) 2011-08-16 19:28:22 AVAILABILITYZONE | |- nova-scheduler enabled :-) 2011-08-16 19:28:14