Install a couple of packages to bootstrap configuration:
apt-get install -y git sudo
Network Configuration
The first iteration of the lab uses OpenStack's FlatDHCP network controller so only a single network will be required. It should be on its own subnet without DHCP; the host IPs and floating IP pool(s) will come out of this block. This example uses the following:
Gateway: 192.168.42.1
Physical nodes: 192.168.42.11-192.168.42.99
Floating IPs: 192.168.42.128-192.168.42.254
Configure each node with a static IP in /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 192.168.42.11
netmask 255.255.255.0
gateway 192.168.42.1
Installation shake and bake
Add the DevStack User
OpenStack runs as a non-root user that has sudo access to root. There is nothing special about the name, we'll use stack here. Every node must use the same name and preferably uid. If you created a user during the OS install you can use it and give it sudo priviledges below. Otherwise create the stack user:
groupadd stack
useradd -g stack -s /bin/bash -d /opt/stack -m stack
This user will be making many changes to your system during installation and operation so it needs to have sudo priviledges to root without a password:
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
From here on use the stack user. Logout and login as the stack user.
Set Up Ssh
Set up the stack user on each node with an ssh key for access:
mkdir ~/.ssh; chmod 700 ~/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyYjfgyPazTvGpd8OaAvtU2utL8W6gWC4JdRS1J95GhNNfQd657yO6s1AH5KYQWktcE6FO/xNUC2reEXSGC7ezy+sGO1kj9Limv5vrvNHvF1+wts0Cmyx61D2nQw35/Qz8BvpdJANL7VwP/cFI/p3yhvx2lsnjFE3hN8xRB2LtLUopUSVdBwACOVUmH2G+2BWMJDjVINd2DPqRIA4Zhy09KJ3O1Joabr0XpQL0yt/I9x8BVHdAx6l9U0tMg9dj5+tAjZvMAFfye3PJcYwwsfJoFxC8w/SLtqlFX7Ehw++8RtvomvuipLdmWCy+T9hIkl+gHYE4cS3OIqXH7f49jdJf jesse@spacey.local" > ~/.ssh/authorized_keys
###################################################################
cd /etc/apt/
wget http://mirrors.163.com/.help/sources.list.precise
mv sources.list sources.list_copy
mv sources.list.precise sources.list
cat >>sources.list<<EOF
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/folsom main
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main
EOF
cat sources.list_copy >> sources.list
########################################
更新操作:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA
apt-get update
Download DevStack
Grab the latest version of DevStack from github:
git clone git://github.com/openstack-dev/devstack.git
cd devstack
Up to this point all of the steps apply to each node in the cluster. From here on there are some differences between the cluster controller (aka 'head node') and the compute nodes.
####################
Configure Compute Nodes
The compute nodes only run the OpenStack worker services. For additional machines, create a localrc with:
HOST_IP=192.168.42.12 # change this per compute node
FLAT_INTERFACE=eth0
FIXED_RANGE=10.4.128.0/20
FIXED_NETWORK_SIZE=4096
FLOATING_RANGE=192.168.42.128/25
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD=labstack
MYSQL_PASSWORD=supersecret
RABBIT_PASSWORD=supersecrete
SERVICE_PASSWORD=supersecrete
SERVICE_TOKEN=xyzpdqlazydog
MYSQL_HOST=192.168.42.11
RABBIT_HOST=192.168.42.11
GLANCE_HOSTPORT=192.168.42.11:9292
ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol
cinder:
pvcreate /dev/sda6
vgcreate stack-volumes /dev/sda6
Fire up OpenStack:
./stack.sh
A stream of activity ensues. When complete you will see a summary of stack.sh's work, including the relevant URLs, accounts and passwords to poke at your shiny new OpenStack. The most recent log file is available in stack.sh.log.
apt-get install -y git sudo
Network Configuration
The first iteration of the lab uses OpenStack's FlatDHCP network controller so only a single network will be required. It should be on its own subnet without DHCP; the host IPs and floating IP pool(s) will come out of this block. This example uses the following:
Gateway: 192.168.42.1
Physical nodes: 192.168.42.11-192.168.42.99
Floating IPs: 192.168.42.128-192.168.42.254
Configure each node with a static IP in /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 192.168.42.11
netmask 255.255.255.0
gateway 192.168.42.1
Installation shake and bake
Add the DevStack User
OpenStack runs as a non-root user that has sudo access to root. There is nothing special about the name, we'll use stack here. Every node must use the same name and preferably uid. If you created a user during the OS install you can use it and give it sudo priviledges below. Otherwise create the stack user:
groupadd stack
useradd -g stack -s /bin/bash -d /opt/stack -m stack
This user will be making many changes to your system during installation and operation so it needs to have sudo priviledges to root without a password:
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
From here on use the stack user. Logout and login as the stack user.
Set Up Ssh
Set up the stack user on each node with an ssh key for access:
mkdir ~/.ssh; chmod 700 ~/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyYjfgyPazTvGpd8OaAvtU2utL8W6gWC4JdRS1J95GhNNfQd657yO6s1AH5KYQWktcE6FO/xNUC2reEXSGC7ezy+sGO1kj9Limv5vrvNHvF1+wts0Cmyx61D2nQw35/Qz8BvpdJANL7VwP/cFI/p3yhvx2lsnjFE3hN8xRB2LtLUopUSVdBwACOVUmH2G+2BWMJDjVINd2DPqRIA4Zhy09KJ3O1Joabr0XpQL0yt/I9x8BVHdAx6l9U0tMg9dj5+tAjZvMAFfye3PJcYwwsfJoFxC8w/SLtqlFX7Ehw++8RtvomvuipLdmWCy+T9hIkl+gHYE4cS3OIqXH7f49jdJf jesse@spacey.local" > ~/.ssh/authorized_keys
###################################################################
cd /etc/apt/
wget http://mirrors.163.com/.help/sources.list.precise
mv sources.list sources.list_copy
mv sources.list.precise sources.list
cat >>sources.list<<EOF
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/folsom main
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main
EOF
cat sources.list_copy >> sources.list
########################################
更新操作:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA
apt-get update
Download DevStack
Grab the latest version of DevStack from github:
git clone git://github.com/openstack-dev/devstack.git
cd devstack
Up to this point all of the steps apply to each node in the cluster. From here on there are some differences between the cluster controller (aka 'head node') and the compute nodes.
####################
Configure Compute Nodes
The compute nodes only run the OpenStack worker services. For additional machines, create a localrc with:
HOST_IP=192.168.42.12 # change this per compute node
FLAT_INTERFACE=eth0
FIXED_RANGE=10.4.128.0/20
FIXED_NETWORK_SIZE=4096
FLOATING_RANGE=192.168.42.128/25
MULTI_HOST=1
LOGFILE=/opt/stack/logs/stack.sh.log
ADMIN_PASSWORD=labstack
MYSQL_PASSWORD=supersecret
RABBIT_PASSWORD=supersecrete
SERVICE_PASSWORD=supersecrete
SERVICE_TOKEN=xyzpdqlazydog
MYSQL_HOST=192.168.42.11
RABBIT_HOST=192.168.42.11
GLANCE_HOSTPORT=192.168.42.11:9292
ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol
cinder:
pvcreate /dev/sda6
vgcreate stack-volumes /dev/sda6
Fire up OpenStack:
./stack.sh
A stream of activity ensues. When complete you will see a summary of stack.sh's work, including the relevant URLs, accounts and passwords to poke at your shiny new OpenStack. The most recent log file is available in stack.sh.log.