VMWare上安装OpenStack(单网卡)
软件:
VMware? Workstation 9.0
ubuntu-12.04.1-server-amd64.iso
参考网址:
http://docs.openstack.org/essex/openstack-compute/starter/content/Server1-d1e537.html
一.创建虚拟机
注意:需要2块硬盘,一个30G,一个10G。
用于创建nova-volume和swift。
二.安装ubuntu-server
注意:选择手动分区,对30G的硬盘进行以下分区,10G的硬盘暂时不用操作
1.创建根分区,15GB
2.创建交换分区,2GB
3.剩余空间,创建逻辑分区,在文件系统中选择最后一项不使用,留着物理卷给nova-volume.
三.开始OpenStack安装(以下操作使用root)
由于脚本比较长,所以没列出来,请http://yuky1327.iteye.com/blog/1696604在下载附件的脚本,辅助执行。
1.开启并设置root密码
sudo passwd root
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet staticaddress 192.168.1.200netmask 255.255.255.0broadcast 192.168.1.255gateway 192.168.1.1dns-nameservers 192.168.1.1
sudo /etc/init.d/networking restart
sudo apt-get updatesudo apt-get upgradesudo apt-get install bridge-utils
sudo apt-get install ntp
server ntp.ubuntu.comserver 127.127.1.0fudge 127.127.1.0 stratum 10
sudo service ntp restart
sudo apt-get install mysql-server python-mysqldb
bind-address = 0.0.0.0
sudo restart mysql
sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE nova;'sudo mysql -uroot -pmygreatsecret -e 'CREATE USER novadbadmin;'sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%';"sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'novadbadmin'@'%' = PASSWORD('novasecret');"sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE glance;'sudo mysql -uroot -pmygreatsecret -e 'CREATE USER glancedbadmin;'sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%';"sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'glancedbadmin'@'%' = PASSWORD('glancesecret');"sudo mysql -uroot -pmygreatsecret -e 'CREATE DATABASE keystone;'sudo mysql -uroot -pmygreatsecret -e 'CREATE USER keystonedbadmin;'sudo mysql -uroot -pmygreatsecret -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystonedbadmin'@'%';"sudo mysql -uroot -pmygreatsecret -e "SET PASSWORD FOR 'keystonedbadmin'@'%' = PASSWORD('keystonesecret');"
sudo apt-get install keystone python-keystone python-keystoneclient
admin_token = ADMIN改为admin_token = admin
connection = sqlite:////var/lib/keystone/keystone.db改为connection = mysql://keystonedbadmin:keystonesecret@192.168.1.200/keystone
sudo service keystone restart
sudo keystone-manage db_sync
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"export SERVICE_TOKEN=admin
source .bashrc
./create_keystone_data.sh
sudo apt-get install glance glance-api glance-client glance-common glance-registry python-glance
admin_tenant_name = %SERVICE_TENANT_NAME%admin_user = %SERVICE_USER%admin_password = %SERVICE_PASSWORD%改为admin_tenant_name = serviceadmin_user = glanceadmin_password = glance
sql_connection = mysql://glancedbadmin:glancesecret@192.168.1.200/glance....#末尾追加[paste_deploy]flavor = keystone
[paste_deploy]flavor = keystone
sudo glance-manage version_control 0sudo glance-manage db_sync
sudo restart glance-apisudo restart glance-registry
export OS_TENANT_NAME=adminexport OS_USERNAME=adminexport OS_PASSWORD=adminexport OS_AUTH_URL="http://localhost:5000/v2.0/"
source .bashrc
glance index
sudo apt-get install nova-api nova-cert nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume rabbitmq-server novnc nova-consoleauth
./edit_nova_conf.sh
sudo pvcreate /dev/sda5
sudo vgcreate nova-volumes /dev/sda5
sudo chown -R nova:nova /etc/novasudo chmod 644 /etc/nova/nova.conf
admin_tenant_name = %SERVICE_TENANT_NAME%admin_user = %SERVICE_USER%admin_password = %SERVICE_PASSWORD%改为admin_tenant_name = serviceadmin_user = novaadmin_password = nova
sudo nova-manage db sync
sudo nova-manage network create private --fixed_range_v4=192.168.1.9/27 --num_networks=1 --bridge=br100 --bridge_interface=eth0 --network_size=32
sudo restart libvirt-bin; sudo restart nova-network; sudo restart nova-compute; sudo restart nova-api; sudo restart nova-objectstore; sudo restart nova-scheduler; sudo restart nova-volume; sudo restart nova-consoleauth;
sudo nova-manage service listBinary Host Zone Status State Updated_Atnova-network server1 nova enabled :-) 2012-04-20 08:58:43nova-scheduler server1 nova enabled :-) 2012-04-20 08:58:44nova-volume server1 nova enabled :-) 2012-04-20 08:58:44nova-compute server1 nova enabled :-) 2012-04-20 08:58:45nova-cert server1 nova enabled :-) 2012-04-20 08:58:43
sudo apt-get install openstack-dashboard
sudo service apache2 restart
sudo apt-get install swift swift-proxy swift-account swift-container swift-objectsudo apt-get install xfsprogs curl python-pastedeploy
root@begon:/dev# sudo fdisk /dev/sdbCommand (m for help): nPartition type: p primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): ePartition number (1-4, default 1): 3First sector (2048-20971519, default 2048): Using default value 2048Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): Using default value 20971519Command (m for help): nPartition type: p primary (0 primary, 1 extended, 3 free) l logical (numbered from 5)Select (default p): lAdding logical partition 5First sector (4096-20971519, default 4096): Using default value 4096Last sector, +sectors or +size{K,M,G} (4096-20971519, default 20971519): Using default value 20971519Command (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.
root@bogon:/dev# fdisk /dev/sdbCommand (m for help): pDisk /dev/sdb: 10.7 GB, 10737418240 bytes107 heads, 17 sectors/track, 11529 cylinders, total 20971520 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x937847e1 Device Boot Start End Blocks Id System/dev/sdb1 2048 20971519 10484736 5 Extended/dev/sdb5 4096 20971519 10483712 83 Linux
sudo mkfs.xfs -i size=1024 /dev/sdb5
sudo mkdir /mnt/swift_backend
/dev/sdb5 /mnt/swift_backend xfs noatime,nodiratime,nobarrier,logbufs=8 0 0
sudo mount /mnt/swift_backendpushd /mnt/swift_backendsudo mkdir node1 node2 node3 node4popdsudo chown swift.swift /mnt/swift_backend/*for i in {1..4}; do sudo ln -s /mnt/swift_backend/node$i /srv/node$i; done;sudo mkdir -p /etc/swift/account-server /etc/swift/container-server /etc/swift/object-server /srv/node1/device /srv/node2/device /srv/node3/device /srv/node4/devicesudo mkdir /run/swiftsudo chown -L -R swift.swift /etc/swift /srv/node[1-4]/ /run/swift
sudo mkdir /run/swiftsudo chown swift.swift /run/swift
RSYNC_ENABLE=true
# General stuffuid = swiftgid = swiftlog file = /var/log/rsyncd.logpid file = /run/rsyncd.pidaddress = 127.0.0.1# Account Server replication settings[account6012]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/account6012.lock[account6022]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/account6022.lock[account6032]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/account6032.lock[account6042]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/account6042.lock# Container server replication settings[container6011]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/container6011.lock[container6021]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/container6021.lock[container6031]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/container6031.lock[container6041]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/container6041.lock# Object Server replication settings[object6010]max connections = 25path = /srv/node1/read only = falselock file = /run/lock/object6010.lock[object6020]max connections = 25path = /srv/node2/read only = falselock file = /run/lock/object6020.lock[object6030]max connections = 25path = /srv/node3/read only = falselock file = /run/lock/object6030.lock[object6040]max connections = 25path = /srv/node4/read only = falselock file = /run/lock/object6040.lock
sudo service rsync restart
root@bogon:/srv# od -t x8 -N 8 -A n < /dev/random7736e3116c693239
[swift-hash]# random unique string that can never change (DO NOT LOSE). I'm using 7736e3116c693239. # od -t x8 -N 8 -A n < /dev/random# The above command can be used to generate random a string.swift_hash_path_suffix = 7736e3116c693239
[DEFAULT]bind_port = 8080user = swiftswift_dir = /etc/swift[pipeline:main]# Order of execution of modules defined belowpipeline = catch_errors healthcheck cache authtoken keystone proxy-server[app:proxy-server]use = egg:swift#proxyallow_account_management = trueaccount_autocreate = trueset log_name = swift-proxyset log_facility = LOG_LOCAL0set log_level = INFOset access_log_name = swift-proxyset access_log_facility = SYSLOGset access_log_level = INFOset log_headers = Trueaccount_autocreate = True[filter:healthcheck]use = egg:swift#healthcheck[filter:catch_errors]use = egg:swift#catch_errors[filter:cache]use = egg:swift#memcacheset log_name = cache[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factoryauth_protocol = httpauth_host = 127.0.0.1auth_port = 35357auth_token = adminservice_protocol = httpservice_host = 127.0.0.1service_port = 5000admin_token = adminadmin_tenant_name = serviceadmin_user = swiftadmin_password = swiftdelay_auth_decision = 0[filter:keystone]paste.filter_factory = keystone.middleware.swift_auth:filter_factoryoperator_roles = admin, swiftoperatoris_admin = true
./swift_account_server.sh./swift_container_server.sh./swift_object_server.sh
[container-sync]
pushd /etc/swiftsudo swift-ring-builder object.builder create 18 3 1sudo swift-ring-builder container.builder create 18 3 1sudo swift-ring-builder account.builder create 18 3 1sudo swift-ring-builder object.builder add z1-127.0.0.1:6010/device 1sudo swift-ring-builder object.builder add z2-127.0.0.1:6020/device 1sudo swift-ring-builder object.builder add z3-127.0.0.1:6030/device 1sudo swift-ring-builder object.builder add z4-127.0.0.1:6040/device 1sudo swift-ring-builder object.builder rebalancesudo swift-ring-builder container.builder add z1-127.0.0.1:6011/device 1sudo swift-ring-builder container.builder add z2-127.0.0.1:6021/device 1sudo swift-ring-builder container.builder add z3-127.0.0.1:6031/device 1sudo swift-ring-builder container.builder add z4-127.0.0.1:6041/device 1sudo swift-ring-builder container.builder rebalancesudo swift-ring-builder account.builder add z1-127.0.0.1:6012/device 1sudo swift-ring-builder account.builder add z2-127.0.0.1:6022/device 1sudo swift-ring-builder account.builder add z3-127.0.0.1:6032/device 1sudo swift-ring-builder account.builder add z4-127.0.0.1:6042/device 1sudo swift-ring-builder account.builder rebalance
sudo swift-init main startsudo swift-init rest start
sudo chown -R swift.swift /etc/swift
root@server1:~# swift -v -V 2.0 -A http://127.0.0.1:5000/v2.0/ -U service:swift -K swift statStorageURL: http://192.168.1.200:8080/v1/AUTH_4b0de95572044eb49345930225d81752Auth Token: e6955ec2e6ca4059aba6bafc6c0d6473 Account: AUTH_4b0de95572044eb49345930225d81752Containers: 0 Objects: 0 Bytes: 0Accept-Ranges: bytesX-Trans-Id: tx051c25a362534266a4583f49fa44558d