OpenStack Folsom手动安装过程记录

以下手动安装的步骤基本是按照OpenStack Document里Folsom版本的帮助文档,同时也参考了广大OpenStack爱好者的分享。
控制节点(Controller)安装的组件包括:MySql、keystone、glance、nova、horizon,计算节点(Compute Node)仅安装nova组件(其中的Nova-compute、Nova-network)。
网络部分使用的仍是Nova-network(FlatDHCP),并未使用Quantum。
未使用Cinder、Swift。

一、Controller
1、更新源
2、配置网络
3、安装NTP
4、安装Mysql和创建相关数据库
5、安装配置keystone
6、安装和配置glance
7、安装和配置nova
8、安装dashboard

二、ComputeNode
1、更新源
2、配置网络
3、安装NTP
4、安装和配置nova


一、Controller
1、更新源
#使用Ubuntu提供的OpenStack Folsom源
#[vim /etc/apt/sources.list.d/folsom.list]

deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main
sudo apt-get install ubuntu-cloud-keyring
sudo apt-get update
sudo apt-get upgrade

#安装必需包

sudo apt-get install vlan bridge-utils rabbitmq-server

#启用ip转发 Enable the ip_forwarding

sed -i -r 's/^\s*#(net\.ipv4\.ip_forward=1.*)/\1/' /etc/sysctl.conf
echo 1 > /proc/sys/net/ipv4/ip_forward

#[vim /etc/sysctl.conf]
# Uncomment the next line to enable packet forwarding for IPv4

net.ipv4.ip_forward=1

#Update the configuration

sudo sysctl -p

 

2、配置网络
#以静态ip设置双网卡
#[vim /etc/network/interfaces]

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.100.1
netmask 255.255.0.0
broadcast 192.168.255.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1

auto eth1
iface eth1 inet static
address 172.20.100.1
netmask 255.255.255.0
network 172.20.100.0
broadcast 172.20.100.255
sudo /etc/init.d/networking restart

 

3、安装NTP

sudo apt-get install -y ntp

#[vim /etc/ntp.conf]

server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
sudo service ntp restart

 

4、安装Mysql和创建相关数据库

apt-get install python-mysqldb mysql-server
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
service mysql restart
mysql -u root -popenstack -e "create database nova;"
mysql -u root -popenstack -e "create database glance;"
mysql -u root -popenstack -e "create database cinder;"
mysql -u root -popenstack -e "create database keystone;"
mysql -u root -popenstack -e "create database ovs_quantum;"

#mysql -uroot -popenstack登陆mysql,创建用户、分配权限

grant all privileges on nova.* to nova@"%" identified by "openstack";
grant all privileges on nova.* to nova@"localhost" identified by "openstack";
grant all privileges on glance.* to glance@"%" identified by "openstack";
grant all privileges on glance.* to glance@"localhost" identified by "openstack";
grant all privileges on cinder.* to cinder@"%" identified by "openstack";
grant all privileges on cinder.* to cinder@"localhost" identified by "openstack";
grant all privileges on keystone.* to keystone@"%" identified by "openstack";
grant all privileges on keystone.* to keystone@"localhost" identified by "openstack";
grant all privileges on ovs_quantum.* to ovs_quantum@"%" identified by "openstack";
grant all privileges on ovs_quantum.* to ovs_quantum@"localhost" identified by "openstack";

 

5、安装配置keystone

apt-get install -y keystone python-keystone python-keystoneclient
rm /var/lib/keystone/keystone.db

#[vim /etc/keystone/keystone.conf]

admin_token = ADMIN 改为 admin_token = admin
connection = mysql://keystone:openstack@127.0.0.1/keystone
idle_timeout = 200
service keystone restart
keystone-manage db_sync

#设置环境变量(注销后失效,在/etc/profile中加入并重启后可永久保存)

export SERVICE_TOKEN=admin
export SERVICE_ENDPOINT=http://localhost:35357/v2.0
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_AUTH_URL=http://localhost:5000/v2.0/
export ENABLE_SWIFT=true
export ENABLE_QUANTUM=false
export ENABLE_ENDPOINTS=true

#导入数据
#修改登录dashboard的admin的密码
#ADMIN_PASSWORD=${ADMIN_PASSWORD:-openstack}
#运行脚本
#chmod +x sample_data.sh

./sample_data.sh

 

6、安装和配置glance

apt-get install -y glance glance-api glance-common python-glanceclient glance-registry python-glance
rm /var/lib/glance/glance.sqlite

#[vim /etc/glance/glance-registry.conf]

[DEFAULT]
sql_connection = mysql://glance:openstack@127.0.0.1/glance
[keystone_authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = openstack
[paste_deploy]
flavor = keystone

#[vim /etc/glance/glance-api.conf]

[DEFAULT]
sql_connection = mysql://glance:openstack@127.0.0.1/glance
notifier_strategy = rabbit
rabbit_password = guest
[keystone_authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = openstack
[paste_deploy]
flavor = keystone
service glance-api restart && service glance-registry restart
glance-manage version_control 0
glance-manage db_sync
service glance-api restart && service glance-registry restart

#下载CirrOS的image作为测试使用,只有10M,User:cirros,Pwd:cubswin:)。

wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-i386-disk.img

#上传image

glance image-create --name=cirros-0.3.0-i386 --public --container-format=bare --disk-format=qcow2 < /root/cirros-0.3.0-i386-disk.img

 

7、安装和配置nova

sudo apt-get install -y nova-api nova-cert nova-compute nova-compute-qemu nova-doc nova-network nova-objectstore nova-scheduler nova-volume novnc nova-consoleauth nova-novncproxy nova-ajax-console-proxy

#设置目录权限

chown -R nova:nova /etc/nova
chmod 640 /etc/nova/nova.conf

#[vim /etc/nova/nova.conf] –nova(192.168.100.1)_nova-network.conf
#在虚拟机中安装OpenStack时,libvirt_type使用qemu

#[vim /etc/nova/nova-compute.conf]

libvirt_type=kvm

#[vim /etc/nova/api-paste.ini]

admin_tenant_name = service
admin_user = nova
admin_password = openstack

#重启服务

stop nova-api;stop nova-compute;stop nova-scheduler;stop nova-novncproxy;stop nova-network;stop nova-volume;stop nova-objectstore;stop nova-consoleauth;stop libvirt-bin;

nova-manage db sync;

start nova-api;start nova-compute;start nova-scheduler;start nova-novncproxy;start nova-network;start nova-volume;start nova-objectstore;start nova-consoleauth;start libvirt-bin;/etc/init.d/rabbitmq-server restart

#创建fix ip(内网ip)

nova-manage network create private --multi_host=T --fixed_range_v4=172.20.200.0/24 --num_networks=1 --bridge=br100 --bridge_interface=eth1 --network_size=256 --vlan=0

#创建floating IP(公网ip)

nova-manage floating create --ip_range=192.168.200.0/16

#重启服务(restart出现unkown instance时,可能是instance未启动,先start之)

restart nova-api;restart nova-compute;restart nova-scheduler;restart nova-novncproxy;restart nova-network;restart nova-volume;restart nova-objectstore;restart nova-consoleauth;restart libvirt-bin;/etc/init.d/rabbitmq-server restart

#开放远程连接端口

nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

 

8、安装dashboard

apt-get install -y openstack-dashboard

#重启apache

service apache2 restart

#http://192.168.100.1/horizon

 

二、ComputeNode
1、更新源
#同Controller
2、配置网络
#同Controller,为每个计算节点设置不同的静态ip地址
3、安装NTP

sudo apt-get install -y ntp

#[vim /etc/ntp.conf]
#指向控制节点

server 192.168.100.1
sudo service ntp restart

 

4、安装和配置nova

apt-get -y install nova-api-metadata nova-compute-kvm novnc nova-novncproxy nova-network

#设置目录权限

chown -R nova:nova /etc/nova
chmod 640 /etc/nova/nova.conf

#nova.conf配置与Controller相同,但是vncserver_proxyclient_address、vncserver_listen、my_ip需要修改为计算节点的ip
#[vim /etc/nova/nova.conf] –nova(192.168.100.1)_nova-network.conf
#在虚拟机中安装OpenStack时,libvirt_type使用qemu
#[vim /etc/nova/nova-compute.conf]

libvirt_type=kvm

#[vim /etc/nova/api-paste.ini]

auth_host = 192.168.100.1
admin_tenant_name = service
admin_user = nova
admin_password = openstack

#重启服务

restart nova-api-metadata;restart nova-novncproxy;restart nova-compute;restart nova-network;




Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>