openstack devstack 脚本安装(多结点,计算结点安装)

本文介绍如何在实验室环境中安装配置OpenStack。首先通过apt-get安装必要的软件包并设置静态IP地址,然后创建DevStack用户并赋予sudo权限。接着,通过SSH密钥实现节点间免密码登录,并更新源列表以获取OpenStack相关组件。最后,在各节点上配置本地环境变量并运行stack.sh脚本来启动OpenStack服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值