本文为双节点搭建,分为计算(IP1)和控制节点(IP2)
说明:
计算节点组件:
1、mysql
2、keystone
3、Nova
4、glance
5、rabbitmq
控制节点组件:
1、cinder
2、dashboard
一、修改主机名及静态IP
1、vim /etc/hostname
xxctrl(xxctrl改为目标名)
2、vim /etc/hosts
IP xxctrl(目标名)
3、hostname xxctrl (使改名生效,也可重启虚拟)
二、配置网络接口
1、vim /etc/network/interfaces
auto eth0
iface eth0 inet static
address XX.XX.XX.XX(修改为自己IP1)
netmask 255.255.240.0
network XX.XX.0.0
broadcast 10.18.0.255
gateway 10.18.0.254
dns-nameservers 61.139.2.69
2、/etc/init.d/networking restart (使网络配置生效)
三、修改为163源(可选),并更新系统及内核
1、cd /etc/apt vim sources.list
这里给大家贴出12.04的163的源,速度比较快,大家可根据自己需求选择其他的源,只要版本统一。
deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
2、更新系统及内核
apt-get update && apt-get upgrade && apt-get dist-upgrade
3、增加F版源
vim sources.list
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/folsom main
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main
4、apt-get install ubuntu-cloud-keyring
5、apt-get update
四、配置IPv4 包转发
1、vim /etc/sysctl.conf
net.ipv4.ip_forward=1
2、 sysctl -p(执行使配置生效)
五、安装并配置NTP 服务
1、apt-get install ntp
2、sed -i ‘s/server ntp.ubuntu.com/server ntp.ubuntu.com\nserver 127.127.1.0\nfudge 127.127.1.0 stratum 10/g‘ /etc/ntp.conf
3、 重启服务: service ntp restart
六、安装并配置MySQL 数据库
1、apt-get install -y mysql-server python-mysqldb
2、sed -i "s/127.0.0.1/0.0.0.0/" /etc/mysql/my.cnf
3、 service mysql restart
4、创建数据库并设置权限
mysql -uroot -pxxxx(自己的密码)
CREATE DATABASE nova;
CREATE DATABASE glance;
CREATE DATABASE keystone;
CREATE DATABASE cinder;
grant all privileges on *.* to [email protected]‘%‘ identified by ‘pwd‘;
grant all privileges on nova.* to [email protected]‘%‘ identified by ‘pwd‘;
grant all privileges on glance.* to [email protected]‘%‘ identified by ‘pwd‘;
grant all privileges on keystone.* to [email protected]‘%‘ identified by ‘pwd‘;
grant all privileges on cinder.* to [email protected]‘%‘ identified by ‘pwd‘;
FLUSH PRIVILEGES;
exit;
重启数据库服务:service mysql restart
七、安装并配置RabbitMQ服务
1、vim sources.list
deb http://www.rabbitmq.com/debian/ kitten main
2、wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
3、apt-key add rabbitmq-signing-key-public.asc
4、apt-get update
5、apt-get install -y rabbitmq-server
6、查看服务状态
service rabbitmq-server status
八、安装并配置Keystone服务
1. 生成一个随机值在初始的配置中作为管理员的令牌(token)。
openssl rand -hex 10
2、安装keystack
apt-get install keystone
3、编辑 /etc/keystone/keystone.conf,并完成下列操作:
a. 在 [DEFAULT] 段中,对管理员令牌进行配置。
admin_token = ADMIN_TOKEN //将 ADMIN_TOKEN替换为上一步中生成的随机字符串。
b. 在 [database] 段,配置数据库访问相关参数:
[database]
connection = mysql://keystone:[email protected]/keystone
4、初始化身份认证服务的数据库,建立好的数据库是空的,需要初始化Keystone 数据库的表结构。
service keystone restart
keystone-manage db_sync
5、通过脚本创建租户、用户和角色并定义Services 和API Endpoints
a. 配置管理员令牌:
export OS_SERVICE_TOKEN=ADMIN_TOKEN //将其中的 ADMIN_TOKEN 替换为管理员令牌。例如:export OS_SERVICE_TOKEN=294a4c8a8a475f9b9836
b.下载脚本文件
wget https://raw.github.com/nimbula/OpenStack-Folsom-Install-guide/master/Keystone_Scripts/Without%20Quantum/keystone_basic.sh
wget https://raw.github.com/nimbula/OpenStack-Folsom-Install-guide/master/Keystone_Scripts/Without%20Quantum/keystone_endpoints_basic.sh
6、设置环境变量
vi /etc/profile
export OS_NO_CACHE=1
export SERVICE_TOKEN=ADMIN
export OS_TENANT_NAME=admin
export OS_USERNAME=admin(登录用户名)
export OS_PASSWORD=pass(登录密码)
export OS_AUTH_URL=http://IP1:5000/v2.0/
export SERVICE_ENDPOINT=http://IP1:35357/v2.0/
7、source /etc/profile
8.修改脚本文件:
vim keystone_basic.sh
HOST_IP=${HOST_IP:-IP1}
ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin_pass}
SERVICE_PASSWORD=${SERVICE_PASSWORD:-service_pass}
vim keystone_endpoints_basic.sh
# Host address
HOST_IP=IP1
EXT_HOST_IP=IP1
# MySQL definitions
MYSQL_USER=keystone
MYSQL_DATABASE=keystone
MYSQL_PASSWORD=keystack_dbpass
9.修改文件执行权限
chmod +x keystone_basic.sh
chmod +x keystone_endpoints_basic.sh
10、执行脚本文件:
./keystone_basic.sh
./keystone_endpoints_basic.sh
11、验证服务
apt-get install curl openssl
curl http://IP:35357/v2.0/endpoints -H ‘x-auth-token: cloud‘ | python -m json.tool
12、查看服务列表
keystone user-list
keystone service-list
keystone endpoint-list
九、安装并配置Glance服务
1. 安装软件包:
apt-get install glance
2. 修改配置文件
vi /etc/glance/glance-api-paste.ini
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
auth_host = IP
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = pass
vi /etc/glance/glance-api.conf
verbose = True
sql_connection = mysql://glance:[email protected]/glance
notifier_strategy = noop
rabbit_host = IP
rabbit_port = 5672
rabbit_use_ssl = false
rabbit_userid = guest
rabbit_password = guest
rabbit_virtual_host = /
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
auth_host = IP
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = cloud
[paste_deploy]
flavor = keystone
vi /etc/glance/glance-registry.conf
verbose = True
sql_connection = mysql://glance: [email protected]/glance
[keystone_authtoken]
auth_host = IP
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = service_pass
[paste_deploy]
flavor = keystone
vi /etc/glance/glance-registry-paste.ini
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
auth_host=IP1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = cloud
重启glance相关服务以及初始化数据库
service glance-api restart; service glance-registry restart
glance-manage db_sync
3. 验证操作
wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
source admin-openrc.sh
glance image-create --name cloud --is-public true --container-format bare --disk-format qcow2 < cirros-0.3.0-x86_64-disk.img
glance image-list
十、安装并配置nova服务
1、安装Nova软件包
apt-get install nova-api nova-cert novnc nova-consoleauth nova-scheduler nova-novncproxy
nova-doc nova-conductor nova-network
2、修改配置文件
vim /etc/nova/api-paste.ini
[filter:authtoken]
auth_host = IP1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = service_pass
signing_dirname = /tmp/keystone-signing-nova
vim /etc/nova/nova.conf (配置nova)
3、初始化数据库并重启nova服务
nova-manage db sync
cd /etc/init.d/; for i in $(ls nova-*); do sudo service $i restart; done
4、查看服务状态及镜像
nova-manage service list
Binary Host Zone Status State Updated_At
nova-cert ctrl nova enabled :-) 2015-11-26 05:03:41
nova-consoleauth ctrl nova enabled :-) 2015-11-26 05:03:48
nova-scheduler ctrl nova enabled :-) 2015-11-26 05:03:45
nova-network ctrl nova enabled :-) 2015-11-26 05:03:46
运行Nova 的客户端命令,列出当前可用的镜像,测试是否能正常运行:
nova image-list
十一、安装和配置控制节点网络
1. 安装软件包
apt-get install -y bridge-utils
2. 修改配置文件
vi /etc/network/interfaces
auto br100
iface br100 inet static
address IP2
netmask 255.255.255.0
network XX.XX.XX.XX
broadcast 10.18.0.255
gateway 10.18.0.254
dns-nameservers 61.139.2.69
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
3、 重启网络服务
brctl addbr br100
十二、安装并配置cinder服务
1、安装cinder软件包 没装
apt-get install cinder-api cinder-scheduler cinder-volume iscsitarget iscsitarget-dkms
2、修改配置文件
vim /etc/cinder/api-paste.ini
vim /etc/cinder/cinder.conf
3、初始化数据库
cinder-manage db sync
4、验证服务组件
cinder list
5、重启cinder服务
service cinder-api restart
service cinder-scheduler restart
service cinder-volume restart
6、增加磁盘分区、创建卷组和卷
创建物理卷pvcreate
创建卷组 vgcreate
十三、安装dashboard软件包
apt-get install openstack-dashboard memcached