文中列出的脚本代码是为了方便阅读学习,执行安装可以跳过。1、服务器:4核CPU、8G内存、双硬盘、双网卡(必须的)我在vmware8.0上创建了一个虚拟机,x86双核CPU,仅支持32位,挂载2个10G硬盘,双网卡(一个桥接模式,一个NAT模式),4G内存2、第一个硬盘
文中列出的脚本代码是为了方便阅读学习,执行安装可以跳过。
1、 服务器:4核CPU、8G内存、双硬盘、双网卡(必须的)
我在vmware8.0上创建了一个虚拟机,x86双核CPU,仅支持32位,挂载2个10G硬盘,双网卡(一个桥接模式,一个NAT模式),4G内存
2、
第一个硬盘分两个区:swap区尺寸8G,有资料说为内存的2倍,但用于生产的话,尽可能大一些,测试就无所谓了。剩下的空间给ex4。安装一套的干净的Ubuntu
12.04 LTS系统,记住装上ssh组件。第二个硬盘不管它,后面会有操作将其设置为LVM。
3、 ……原文是让你准备一瓶野兽般的饮料 :-)
以root身份登录,更新系统
# apt-get update
# apt-get install git
下载Github上的StackGeek脚本
# git clone git://github.com/StackGeek/openstackgeek.git
# cd openstackgeek
安装第一个脚本
# ./openstack_base_1.sh
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
# install time server
apt-get install ntp
service ntp restart
# modify timeserver configuration
sed -e "
/^server ntp.ubuntu.com/i server 127.127.1.0
/^server ntp.ubuntu.com/i fudge 127.127.1.0 stratum 10
/^server ntp.ubuntu.com/s/^.*$/server ntp.ubutu.com iburst/;
" -i /etc/ntp.conf
# install tgt
apt-get install tgt
service tgt start
# openiscsi-client
apt-get install open-iscsi open-iscsi-utils
# turn on forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "#################################################################################################
Go edit your /etc/network/interfaces file to look something like this:
auto eth0
iface eth0 inet static
address 10.0.1.20
network 10.0.1.0
netmask 255.255.255.0
broadcast 10.0.1.255
gateway 10.0.1.1
dns-nameservers 8.8.8.8
auto eth1
After you are done, do a '/etc/init.d/networking restart', then run './openstack_base_2.sh'
#################################################################################################
"
exit
修改网络配置文件/etc/network/interfaces,IP地址为可访问公网的地址。
# vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.132
gateway 192.168.3.254
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
dns-search 192.168.3.254
dns-nameservers 8.8.8.8
重启网络服务,运行下第2个脚本:
# /etc/init.d/networking restart
# ./openstack_base_2.sh
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
# bridge stuff
apt-get install bridge-utils
# rabbit food
apt-get install rabbitmq-server
memcached python-memcache
# kvm
apt-get install kvm libvirt-bin
echo "#################################################################################################
You'll need a LVM for 'nova-volumes'. This assumes you have an empty disk spinning at /dev/sdb:
fdisk /dev/sdb
Create a new partition by hitting 'n' then 'p'. Use the defaults. Type 't' then '8e' to set the
partition to the LVM type. Hit 'w' to write and exit.
Next, do a:
pvcreate -ff /dev/sdb1
vgcreate nova-volumes /dev/sdb1
NOTE: You should use whatever device handle your system has. Be careful!
When you are done, run './openstack_
mysql.sh'
#################################################################################################
"
exit
这个脚本运行完毕后,需要设置nova逻辑卷,以便创建快照和存储卷。Nova是OpenStack的计算控制模块。
查看硬盘信息:
# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bc170
Device Boot Start End Blocks Id System
/dev/sda1 2048 1953791 975872 82 Linux swap / Solaris
/dev/sda2 * 1953792 11718655 4882432 83 Linux
/dev/sda3 11718656 20969471 4625408 8e Linux LVM
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
sdb是一个已经挂载还没启用的硬盘,我们对它操作
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa754db16.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
创建"nova-volumes"卷标(名称可自定义):
# pvcreate -ff /dev/sdb1
Physical volume "/dev/sdb1" successfully created
# vgcreate nova-volumes /dev/sdb1
Volume group "nova-volumes" successfully created
OpenStack组件使用MySQL,运行下面脚本:
# ./openstack_mysql.sh
脚本提示输入密码:“qwer1234”,MySQL安装过程中提示输入数据库管理密码:“qwer1234”,安装完毕后,再次提示输入密码:“qwer1234”验证数据库。
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
read -p "Enter a password to be used for the OpenStack services to talk to MySQL (users nova, glance, keystone): " service_pass
echo "#######################################################################################"
echo "Setting up MySQL now. You will be prompted for an admin password by the setup process."
echo "#######################################################################################"
echo ""
# mysql
apt-get install -y mysql-server python-mysqldb
# make mysql listen on 0.0.0.0
sudo sed -i '/^bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
# restart
service mysql restart
# wait for restart
sleep 4
echo "#######################################################################################"
echo "Creating OpenStack databases and users. Use your database password when prompted."
echo ""
echo "Run './openstack_keystone.sh' when the script exits."
echo "#######################################################################################"
mysql -u root -p <
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$service_pass';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '$service_pass';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$service_pass';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '$service_pass';
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '$service_pass';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '$service_pass';
EOF
echo "Done creating users and databases!"
MySQL运行后,用以下命令验证OpenStack用户是否存在:
# mysql -u root - pqwer1234
# mysql -u nova - pqwer1234 nova
# mysql -u keystone - pqwer1234 keystone
# mysql -u glance - pqwer1234 glance
Keystone是OpenStack的认证组件:
# ./openstack_keystone.sh
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
# get keystone
apt-get install keystone python-keystone python-keystoneclient
read -p "Enter a token for the OpenStack services to auth with keystone: " token
read -p "Enter the password you used for the MySQL users (nova, glance, keystone): " password
read -p "Enter the email address for service accounts (nova, glance, keystone): " email
# set up env variables for testing
cat > stackrc <
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=$password
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
export ADMIN_PASSWORD=$password
export SERVICE_PASSWORD=$password
export SERVICE_TOKEN=$token
export SERVICE_ENDPOINT="http://127.0.0.1:35357/v2.0"
export SERVICE_TENANT_NAME=service
EOF
. ./stackrc
# edit keystone conf file to use templates and mysql
cp /etc/keystone/keystone.conf /etc/keystone/keystone.conf.orig
sed -e "
/^admin_token = ADMIN/s/^.*$/admin_token = $token/
/^driver = keystone.catalog.backends.sql.Catalog/d
/^\[catalog\]/a driver = keystone.catalog.backends.templated.TemplatedCatalog
/^\[catalog\]/a template_file = /etc/keystone/default_catalog.templates
/^connection =.*$/s/^.*$/connection = mysql:\/\/keystone:$password@127.0.0.1\/keystone/
" -i /etc/keystone/keystone.conf
# create db tables and restart
keystone-manage db_sync
service keystone restart
# sleep a bit before we whack on it
sleep 5
ADMIN_PASSWORD=$password
SERVICE_PASSWORD=$password
export SERVICE_TOKEN=$token
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
SERVICE_TENANT_NAME="service"
function get_id () {
echo `$@ | awk '/ id / { print $4 }'`
}
# Tenants
ADMIN_TENANT=$(get_id keystone tenant-create --name=admin)
SERVICE_TENANT=$(get_id keystone tenant-create --name=$SERVICE_TENANT_NAME)
DEMO_TENANT=$(get_id keystone tenant-create --name=demo)
INVIS_TENANT=$(get_id keystone tenant-create --name=invisible_to_admin)
# Users
ADMIN_USER=$(get_id keystone user-create --name=admin \
--pass="$ADMIN_PASSWORD" \
--email=$email)
DEMO_USER=$(get_id keystone user-create --name=demo \
--pass="$ADMIN_PASSWORD" \
--email=$email)
# Roles
ADMIN_ROLE=$(get_id keystone role-create --name=admin)
KEYSTONEADMIN_ROLE=$(get_id keystone role-create --name=KeystoneAdmin)
KEYSTONESERVICE_ROLE=$(get_id keystone role-create --name=KeystoneServiceAdmin)
# ANOTHER_ROLE demonstrates that an arbitrary role may be created and used
# TODO(sleepsonthefloor): show how this can be used for rbac in the future!
ANOTHER_ROLE=$(get_id keystone role-create --name=anotherrole)
# Add Roles to Users in Tenants
keystone user-role-add --user $ADMIN_USER --role $ADMIN_ROLE --tenant_id $ADMIN_TENANT
keystone user-role-add --user $ADMIN_USER --role $ADMIN_ROLE --tenant_id $DEMO_TENANT
keystone user-role-add --user $DEMO_USER --role $ANOTHER_ROLE --tenant_id $DEMO_TENANT
# TODO(termie): these two might be dubious
keystone user-role-add --user $ADMIN_USER --role $KEYSTONEADMIN_ROLE --tenant_id $ADMIN_TENANT
keystone user-role-add --user $ADMIN_USER --role $KEYSTONESERVICE_ROLE --tenant_id $ADMIN_TENANT
# The Member role is used by Horizon and Swift so we need to keep it:
MEMBER_ROLE=$(get_id keystone role-create --name=Member)
keystone user-role-add --user $DEMO_USER --role $MEMBER_ROLE --tenant_id $DEMO_TENANT
keystone user-role-add --user $DEMO_USER --role $MEMBER_ROLE --tenant_id $INVIS_TENANT
# Configure service users/roles
NOVA_USER=$(get_id keystone user-create --name=nova \
--pass="$SERVICE_PASSWORD" \
--tenant_id $SERVICE_TENANT \
--email=$email)
keystone user-role-add --tenant_id $SERVICE_TENANT \
--user $NOVA_USER \
--role $ADMIN_ROLE
GLANCE_USER=$(get_id keystone user-create --name=glance \
--pass="$SERVICE_PASSWORD" \
--tenant_id $SERVICE_TENANT \
--email=$email)
keystone user-role-add --tenant_id $SERVICE_TENANT \
--user $GLANCE_USER \
--role $ADMIN_ROLE
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
SWIFT_USER=$(get_id keystone user-create --name=swift \
--pass="$SERVICE_PASSWORD" \
--tenant_id $SERVICE_TENANT \
--email=$email)
keystone user-role-add --tenant_id $SERVICE_TENANT \
--user $SWIFT_USER \
--role $ADMIN_ROLE
# Nova needs ResellerAdmin role to download images when accessing
# swift through the s3 api. The admin role in swift allows a user
# to act as an admin for their tenant, but ResellerAdmin is needed
# for a user to act as any tenant. The name of this role is also
# configurable in swift-proxy.conf
RESELLER_ROLE=$(get_id keystone role-create --name=ResellerAdmin)
keystone user-role-add --tenant_id $SERVICE_TENANT \
--user $NOVA_USER \
--role $RESELLER_ROLE
fi
if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
QUANTUM_USER=$(get_id keystone user-create --name=quantum \
--pass="$SERVICE_PASSWORD" \
--tenant_id $SERVICE_TENANT \
--email=$email)
keystone user-role-add --tenant_id $SERVICE_TENANT \
--user $QUANTUM_USER \
--role $ADMIN_ROLE
fi
echo "######################################################################################"
echo "Time to test keystone. Do a '. ./stackrc' then a 'keystone user-list'."
echo "Assuming you get a user list back, go on to install glance with './openstack_glance.sh'."
echo "######################################################################################"
安装过程中提示输入令牌、密码和电子邮件地址:
Enter a token for the OpenStack services to auth wth keystone: admin
Enter the password you used for the MySQL users (nova, glance, keystone): qwer1234
Enter the email address for service accounts (nova, glance, keystone): yiwence@126.com
测试Keystone: # . ./stackrc
# keystone user-list
+----------------------------------+---------+-----------------+--------+
| id | enabled | email | name |
+----------------------------------+---------+-----------------+--------+
| 1e0d7eb9a24a4cf98e99ce1a3b78d562 | True | yiwence@126.com | nova |
| 1f2ee23d907441318afa19800b899a8c | True | yiwence@126.com | admin |
| 7a4ca7db12994a3c9ff8a003702f35ec | True | yiwence@126.com | demo |
| 818ef2aacaf94f65aeaf698b60527f7d | True | yiwence@126.com | glance |
+----------------------------------+---------+-----------------+--------+
显示了用户信息,进入下一步骤。
Glance是OpenStack的镜像管理组件:
# ./openstack_glance.sh
忽略“SADeprecationWarning”警告。
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
# get glance
apt-get install glance glance-api glance-client glance-common glance-registry python-glance
. ./stackrc
password=$SERVICE_PASSWORD
# edit glance api conf files
if [ -f /etc/glance/glance-api-paste.ini.orig ]
then
echo "#################################################################################################"
echo "Not changing config files. If you want to edit, they are in /etc/glance/"
echo "#################################################################################################"
else
# copy before editing
cp /etc/glance/glance-api-paste.ini /etc/glance/glance-api-paste.ini.orig
cp /etc/glance/glance-registry-paste.ini /etc/glance/glance-registry-paste.ini.orig
cp /etc/glance/glance-registry.conf /etc/glance/glance-registry.conf.orig
sed -e "
/^sql_connection =.*$/s/^.*$/sql_connection = mysql:\/\/glance:$password@127.0.0.1\/glance/
" -i /etc/glance/glance-registry.conf
sed -e "
s,%SERVICE_TENANT_NAME%,admin,g;
s,%SERVICE_USER%,admin,g;
s,%SERVICE_PASSWORD%,$password,g;
" -i /etc/glance/glance-registry-paste.ini
sed -e "
s,%SERVICE_TENANT_NAME%,admin,g;
s,%SERVICE_USER%,admin,g;
s,%SERVICE_PASSWORD%,$password,g;
" -i /etc/glance/glance-api-paste.ini
# do not unindent!
echo "
[paste_deploy]
flavor = keystone
" >> /etc/glance/glance-api.conf
# do not unindent!
echo "
[paste_deploy]
flavor = keystone
" >> /etc/glance/glance-registry.conf
echo "#################################################################################################"
echo "Backups of configs for glance are in /etc/glance/"
echo "#################################################################################################"
fi
# create db tables and restart
glance-manage version_control 0
glance-manage db_sync
sleep 4
service glance-api restart
service glance-registry restart
sleep 4
# add ubuntu image
if [ -f images/ubuntu-12.04-server-cloudimg-amd64-disk1.img ]
then
glance add name="Ubuntu 12.04 LTS" is_public=true container_format=ovf disk_format=qcow2 < images/ubuntu-12.04-server-cloudimg-amd64-disk1.img
else
wget http://stackgeek.s3.amazonaws.com/ubuntu-12.04-server-cloudimg-amd64-disk1.img
mv ubuntu-12.04-server-cloudimg-amd64-disk1.img images
glance add name="Ubuntu 12.04 LTS" is_public=true container_format=ovf disk_format=qcow2 < images/ubuntu-12.04-server-cloudimg-amd64-disk1.img
fi
sleep 4
glance index
echo "#################################################################################################"
echo "You can now run './openstack_nova.sh' to set up Nova."
echo "#################################################################################################"
~
这个脚本从StackGeek’s S3 bucket下载Ubuntu 12.04 LTS的云镜像,安装完毕后可以获取一个镜像列表:
# glance index
ID Name Disk Format Container Format Size
------------------------------------ ------------------------------ -------------------- -------------------- --------------
ec70f942-15c1-4273-84f4-5f0354c7416c Ubuntu 12.04 LTS qcow2 ovf 226426880
Nova是OpenStack的计算及网络组件,负责启动实例、创建快照和存储卷、管理网络:
# ./openstack_nova.sh
脚本代码:
#!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
host_ip=$(/sbin/ifconfig eth0| sed -n 's/.*inet *addr:\([0-9\.]*\).*/\1/p')
echo "#############################################################################################################"
echo "The IP address for eth0 is probably $host_ip". Keep in mind you need an eth1 for this to work.
echo "#############################################################################################################"
read -p "Enter the primary ethernet interface IP: " host_ip_entry
read -p "Enter the fixed network (eg. 10.0.2.32/27): " fixed_range
read -p "Enter the fixed starting IP (eg. 10.0.2.33): " fixed_start
echo "#######################################################################################"
echo "The floating range can be a subset of your current network. Configure your DHCP server"
echo "to block out the range before you choose it here. An example would be 10.0.1.224-255"
echo "#######################################################################################"
read -p "Enter the floating network (eg. 10.0.1.224/27): " floating_range
read -p "Enter the floating netowrk size (eg. 32): " floating_size
# get nova
apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-vncproxy nova-volume python-nova python-novaclient
. ./stackrc
password=$SERVICE_PASSWORD
# hack up the nova paste file
sed -e "
s,%SERVICE_TENANT_NAME%,admin,g;
s,%SERVICE_USER%,admin,g;
s,%SERVICE_PASSWORD%,$password,g;
" -i /etc/nova/api-paste.ini
# write out a new nova file
echo "
--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--state_path=/var/lib/nova
--lock_path=/var/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=$host_ip_entry
--ec2_host=$host_ip_entry
--rabbit_host=$host_ip_entry
--cc_host=$host_ip_entry
--nova_url=http://$host_ip_entry:8774/v1.1/
--routing_source_ip=$host_ip_entry
--glance_api_servers=$host_ip_entry:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.22
--sql_cOnnection=mysql://nova:$password@127.0.0.1/nova
--ec2_url=http://$host_ip_entry:8773/services/Cloud
--keystone_ec2_url=http://$host_ip_entry:5000/v2.0/ec2tokens
--api_paste_cOnfig=/etc/nova/api-paste.ini
--libvirt_type=kvm
--libvirt_use_virtio_for_bridges=true
--start_guests_on_host_boot=true
--resume_guests_state_on_host_boot=true
--vnc_enabled=true
--vncproxy_url=http://$host_ip_entry:6080
--vnc_console_proxy_url=http://$host_ip_entry:6080
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=$fixed_range
--floating_range=$floating_range
--network_size=$floating_size
--flat_network_dhcp_start=$fixed_start
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose
" > /etc/nova/nova.conf
# sync db
nova-manage db sync
# restart nova
./openstack_restart_nova.sh
# no clue why we have to do this when it's in the config?
nova-manage network create private --fixed_range_v4=$fixed_range --num_networks=1 --bridge=br100 --bridge_interface=eth1 --network_size=$fixed_size
nova-manage floating create --ip_range=$floating_range
# do we need this?
chown -R nova:nova /etc/nova/
echo "#######################################################################################"
echo "'nova list' and a 'nova image-list' to test. Do './openstack_horizon.sh' next."
echo "#######################################################################################"
7.1 注意事项
这个脚本会提示几个输入项,主要是针对eth1(内网)做好设置,包括现有的网络接口的IP地址、固定的网络地址、漂浮池地址:
# ./openstack_nova.sh
#############################################################################################################
The IP address for eth0 is probably 192.168.3.132. Keep in mind you
need an eth1 for this to work.
#############################################################################################################
Enter the primary ethernet interface IP: 192.168.3.132 Enter the
fixed network (eg. 10.0.2.32/27): 10.0.2.32/27 Enter the fixed
starting IP (eg. 10.0.2.33): 10.0.2.33
#######################################################################################
The floating range can be a subset of your current network.
Configure your DHCP server to block out the range before you choose
it here. An example would be 10.0.1.224-255
#######################################################################################
Enter the floating network (eg. 10.0.1.224/27): 192.168.3.224/27
Enter the floating netowrk size (eg. 32): 32
这个脚本会提示输入参数,不能使用默认参数,所以要特别小心,如果搞砸了可以重来。这里有个很好的子网计算器,例如计算器中“/27”以上为掩码位。
固定网络是一组本地计算节点的IP地址,用于内部实例通信。如果计划使用更大的网络,可以规划成这个样子:“10.0.4.0/24”,起始地址“10.0.4.1”
漂浮网络是一个地址池,用于分配给运行中的实例。例如,可以启动一个web服务器,分配外网地址,在互联网上提供服务。本例中我们使用私有网络,也可以通过外部路由器指定IP运行OpenStack实例。
7.2 验证nova
# nova image-list
+--------------------------------------+------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+------------------+--------+--------+
| ec70f942-15c1-4273-84f4-5f0354c7416c | Ubuntu 12.04 LTS | ACTIVE | |
+--------------------------------------+------------------+--------+--------+
这就是我要结果,搞定nova!!
Horizon是OpenStack的用户界面和仪表盘组件: # ./openstack_horizon.sh
脚本代码: #!/bin/bash
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "You need to be 'root' dude." 1>&2
exit 1
fi
# get horizon
apt-get install libapache2-mod-wsgi openstack-dashboard
# restart apache
service apache2 restart
. ./stackrc
password=$SERVICE_PASSWORD
host_ip=$(/sbin/ifconfig eth0| sed -n 's/.*inet *addr:\([0-9\.]*\).*/\1/p')
echo "#######################################################################################"
echo "The horizon dashboard should be at http://$host_ip/. Login with admin/$password"
echo "#######################################################################################"
安装完毕后,会提示一个管理地址,以“admin”身份登录,如果忘记密码,可以这样查询:
# env |grep OS_PASSWORD
以下省略1万字:-)