Openstack关于folsom安装

apt-get install -y python-software-properties
add-apt-repository ppa:openstack-ubuntu-testing/folsom-trunk-testing
add-apt-repository ppa:openstack-ubuntu-testing/folsom-deps-staging
apt-get update && apt-get -y dist-upgrade

reboot

============预配置网络==============
ip link set eth0 promisc on

修改网络配置文件/etc/network/interfaces
# The loopback network interface
-----------
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.5.151
netmask 255.255.255.0
gateway 192.168.5.254
dns-nameserver 218.104.111.122
                   
# Bridge network interface for VM networks
auto br100
iface br100 inet static
address 192.168.10.1
netmask 255.255.255.0
bridge_stp off
bridge_fd 0
---------------

apt-get install bridge-utils

brctl addbr br100

重启网络
/etc/init.d/networking restart
=================

安装ntp
apt-get install -y ntp

配置ntp服务
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

重启ntp服务
service ntp restart
=================安装mysql=======================
apt-get -y install mysql-server python-mysqldb

sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf

service mysql restart

mysql -u root -ppassword <<EOF
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'password';
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'password';
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'password';
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'password';
#CREATE DATABASE quantum;
#GRANT ALL PRIVILEGES ON quantum.* TO 'quantum'@'localhost' IDENTIFIED BY 'password';
#GRANT ALL PRIVILEGES ON quantum.* TO 'quantum'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EOF

==================安装rabbitMQ============================
编辑/etc/hosts文件添加本机全域名
sed '2 a192.168.5.151\tnode10.cgt.com\tnode10' -i /etc/hosts

安装rabbitMQ
apt-get -y install rabbitmq-server

修改rabbitmq中的guest账户密码为password
rabbitmqctl change_password guest password


==================安装配置keystone===========================
安装keystone软件包
apt-get -y install keystone python-keystone python-keystoneclient

修改keystone配置文件 /etc/keystone/keystone.conf :
[DEFAULT]
admin_token = password
bind_host = 0.0.0.0
public_port = 5000
admin_port = 35357
compute_port = 8774
verbose = True
debug = True
log_file = keystone.log
log_dir = /var/log/keystone
log_config = /etc/keystone/logging.conf
[sql]
connection = mysql://keystone:password@localhost:3306/keystone
idle_timeout = 200
[identity]
driver = keystone.identity.backends.sql.Identity
[catalog]
driver = keystone.catalog.backends.sql.Catalog

重启keystone服务
service keystone restart

同步keystone数据库
keystone-manage db_sync

生成环境变量文件
cat > novarc <<EOF
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export OS_AUTH_URL="http://localhost:5000/v2.0/"
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
export SERVICE_TOKEN=password
EOF

加载环境变量
. novarc

wget http://192.168.5.150/Folsom-script//keystone-data.sh
wget http://192.168.5.150/Folsom-script//keystone-endpoints.sh

编辑keystone-endpoints.sh中MASTER为192.168.5.151,并将其中的network服务取消掉
MASTER="192.168.5.151"

for i in compute volume image object-store identity ec2 ; do
  id=`mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" -ss -e "SELECT id FROM service WHERE type='"$i"';"` || exit 1
  create_endpoint $i $id
done

为脚本增加执行权限
chmod +x keystone-data.sh
chmod +x keystone-endpoints.sh

执行脚本
./keystone-data.sh
./keystone-endpoints.sh
====================安装配置glance=======================
安装glance软件包
apt-get -y install glance glance-api python-glanceclient glance-common

编辑 /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf

sql_connection = mysql://glance:password@localhost/glance
admin_tenant_name = service
admin_user = glance
admin_password = password

修改/etc/glance/glance-api.conf
notifier_strategy = rabbit
rabbit_password = password

重启glance服务
service glance-api restart && service glance-registry restart

同步glance数据库
glance-manage db_sync

下载glance镜像
wget http://192.168.5.150/cirros-0.3.0-x86_64-disk.img

上传glance镜像
glance add name="cirros" container_format=ovf disk_format=qcow2 is_public=true < cirros-0.3.0-x86_64-disk.img

====================安装配置nova=============================
安装nova相关组件
apt-get -y install nova-api nova-cert nova-compute nova-common nova-scheduler python-nova python-novaclient nova-consoleauth novnc nova-novncproxy nova-network

编辑/etc/nova/api-paste.ini
admin_tenant_name = service
admin_user = nova
admin_password = password

编辑 /etc/nova/nova.conf,修改为:
[DEFAULT]

dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
state_path=/var/lib/nova
lock_path=/var/lock/nova
force_dhcp_release=True
iscsi_helper=tgtadm
libvirt_use_virtio_for_bridges=True
connection_type=libvirt
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
ec2_private_dns_show_ip=True
api_paste_config=/etc/nova/api-paste.ini
#volumes_path=/var/lib/nova/volumes
enabled_apis=ec2,osapi_compute,metadata
verbose=True
logdir=/var/log/nova

# AUTHENTICATION
auth_strategy=keystone

# SCHEDULER
compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler

# VOLUMES
#volume_driver=nova.volume.driver.ISCSIDriver
#volume_group=nova-volumes
#volume_name_template=volume-%08x
#iscsi_helper=tgtadm
#volume_api_class=nova.volume.cinder.API

# Cinder #
volume_api_class=nova.volume.cinder.API
osapi_volume_listen_port=5900

# DATABASE
sql_connection=mysql://nova:password@localhost/nova

# COMPUTE
libvirt_type=kvm
compute_driver=libvirt.LibvirtDriver
instance_name_template=instance-%08x
api_paste_config=/etc/nova/api-paste.ini
allow_resize_to_same_host=True

# APIS
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
ec2_dmz_host=192.168.5.151
s3_host=192.168.5.151

# RABBITMQ
rabbit_host=192.168.5.151
rabbit_password=password

# GLANCE
image_service=nova.image.glance.GlanceImageService
glance_api_servers=192.168.5.151:9292

# NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcpbridge_flagfile=/etc/nova/nova.conf
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
# Change my_ip to match each host
my_ip=192.168.5.151
public_interface=br100
vlan_interface=eth0
flat_network_bridge=br100
flat_interface=eth0
fixed_range=192.168.10.0/24

# NOVNC CONSOLE
novncproxy_base_url=http://192.168.5.151:6080/vnc_auto.html
# Change vncserver_proxyclient_address and vncserver_listen to match each compute host
vncserver_proxyclient_address=192.168.5.151
vncserver_listen=192.168.5.151

[keystone_authtoken]
auth_host = 192.168.5.151
auth_port = 35357
auth_protocol = http
auth_uri = http://192.168.5.151:5000/
admin_tenant_name = service
admin_user = nova
admin_password = password


同步nova数据库
nova-manage db sync

重启nova相关服务
service nova-api restart
service nova-cert restart
service nova-consoleauth restart
service nova-scheduler restart
service novnc restart
service nova-network restart

创建fixed网络
nova-manage network create private --multi_host=T --fixed_range_v4=192.168.10.0/24 --bridge_interface=br100 --num_networks=1 --network_size=256

==============安装配置cinder=====================
安装cinder软件包
apt-get install -y cinder-api cinder-scheduler cinder-volume iscsitarget open-iscsi iscsitarget-dkms python-cinderclient

修改/etc/default/iscsitarget
sed -i 's/false/true/g' /etc/default/iscsitarget

重启iscsi相关服务
service iscsitarget start
service open-iscsi start

编辑/etc/cinder/cinder.conf ,修改为:
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
sql_connection = mysql://cinder:password@localhost:3306/cinder
iscsi_helper = ietadm
volume_group = cinder-volumes
rabbit_password = password
logdir = /var/log/cinder
verbose = true
auth_strategy = keystone

编辑/etc/cinder/api-paste.ini
admin_tenant_name = service
admin_user = cinder
admin_password = password

创建cinder-volumes逻辑卷组
Create the volume :
fdisk /dev/sdb
[Create a Linux partition]
pvcreate /dev/sdb1
vgcreate cinder-volumes /dev/sdb1

同步cinder数据库
cinder-manage db sync

重启cinder相关服务
service cinder-api restart
service cinder-scheduler restart
service cinder-volume restart

================安装配置horizon================
删除增加的源
rm -f /etc/apt/sources.list.d/*.*

更新源列表
apt-get update

增加folsom源
cat >/etc/apt/sources.list.d/folsom.list <<EOF
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main
EOF

apt-get install ubuntu-cloud-keyring

更新源列表
apt-get update

安装horizon软件包
apt-get -y install apache2 libapache2-mod-wsgi openstack-dashboard memcached python-memcache

----------修改dashboard中novnc分辨率-----------
备份文件
cp /usr/lib/python2.7/dist-packages/horizon/dashboards/nova/instances/templates/instances/_detail_vnc.html /usr/lib/python2.7/dist-packages/horizon/dashboards/nova/instances/templates/instances/_detail_vnc.html.bak

把分辨率从720*430,改成1280*1024
sed -i 's/width="728" height="436"/width="1280" height="1024"/g' /usr/lib/python2.7/dist-packages/horizon/dashboards/nova/instances/templates/instances/_detail_vnc.html

重启apache
service apache2 restart

你可能感兴趣的:(Openstack关于folsom安装)