基于网上的安装文档,根据自己的环境做出一些更改,并加入安装出错处理方法。
1. 计划
Eth0 |
10.0.0.2 |
Eth1 |
192.168.66.168 |
安装方式 |
单机双网卡在虚拟机中安装 |
切换用户
改为soho源
cp /etc/apt/source.list
/etc/apt/source.list_back
然后将源替换成下面的源
deb http://mirrors.sohu.com/ubuntu/
raring mainrestricted
deb-src http://mirrors.sohu.com/ubuntu/
raring mainrestricted
deb http://mirrors.sohu.com/ubuntu/
raring-updates mainrestricted
deb-src http://mirrors.sohu.com/ubuntu/
raring-updatesmain restricted
deb http://mirrors.sohu.com/ubuntu/
raring universe
deb-src http://mirrors.sohu.com/ubuntu/
raring universe
deb http://mirrors.sohu.com/ubuntu/
raring-updatesuniverse
deb-src http://mirrors.sohu.com/ubuntu/
raring-updatesuniverse
deb http://mirrors.sohu.com/ubuntu/
raring multiverse
deb-src http://mirrors.sohu.com/ubuntu/
raring multiverse
deb http://mirrors.sohu.com/ubuntu/
raring-updatesmultiverse
deb-src http://mirrors.sohu.com/ubuntu/
raring-updatesmultiverse
deb http://mirrors.sohu.com/ubuntu/
raring-backports mainrestricted universe
multiverse
deb-src http://mirrors.sohu.com/ubuntu/
raring-backportsmain restricted universe
multiverse
deb http://mirrors.sohu.com/ubuntu/
raring-security mainrestricted
deb-src http://mirrors.sohu.com/ubuntu/
raring-securitymain restricted
deb http://mirrors.sohu.com/ubuntu/
raring-securityuniverse
deb-src http://mirrors.sohu.com/ubuntu/
raring-securityuniverse
deb http://mirrors.sohu.com/ubuntu/
raring-securitymultiverse
deb-src http://mirrors.sohu.com/ubuntu/
raring-securitymultiverse
deb http://extras.ubuntu.com/ubuntu
raring main
deb-src http://extras.ubuntu.com/ubuntu
raring main
升级系统:
apt-get update
apt-get upgrade
apt-get dist-upgrade
2.2网络设置编辑/etc/network/interfaces
设置好后重启网络:service networking restart
2.3 安装MySQL & RabbitMQ安装MySQL:
apt-get install -y
mysql-serverpython-mysqldb
配置并重启MySQL:
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
service mysql restart
安装RabbitMQ:
apt-get install -y rabbitmq-server
安装时若提示Startingrabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
需在/etc/hosts中加入本机IP和主机名
安装NTP:
2.4 其他
apt-get install -y vlan
bridge-utils
配置/etc/sysctl.conf
sed
-i's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/'
/etc/sysctl.conf
安装并检查状态:
apt-get install -y keystone
建立数据库(蓝色标记的用户名和密码可改):
mysql -u root -p修改/etc/keystone/keystone.conf中的数据库连接
connection
=mysql://keystoneUser:keystonePass@10.0.0.2/keystone
重启并同步数据库:
同步时若提示"Access denied foruser…”,检查数据库访问权限
用下面两个脚本去填充keystone数据库,也就是增加user,tenant,role和service以及service的endpoint
#Modify the HOST_IP and HOST_IP_EXT variables before executing the scripts修改keystone_basic.sh中的HOST_IP为自己的Eth0的IP
修改keystone_endpoints_basic.sh中的HOST_IP和EXT_HOST_IP,同时将连接keystone数据库的的用户名和密码进行修改:
./keystone_basic.sh
WARNING: Bypassing authentication using a token& endpoint (authentication credentials are being ignored).此提示可忽略
编辑文件creds
export OS_TENANT_NAME=admin引入环境变量中:
source creds
或者可以直接加入root(cat creds >> /root/.bashrc)的环境变量,这样重启后就无需再次引入了
查看创建的user
keystone user-list
若出现如下错误:Unable to communicate with identity service:{"error": {"message": "The request you have maderequires authentication.", "code": 401, "title":"Not Authorized"}}. (HTTP 401)可删除数据库keystone后重新创建keystone,从keystone-manage db_sync 开始重试一次
4. Glanceapt-get install -y glance
service glance-api status
service glance-registry status
建立glance数据库(用户名和密码可改):
GRANT ALL ON glance.* TO 'glanceUser'@'%' IDENTIFIED BY 'glancePass';修改/etc/glance/glance-api-paste.ini
和/etc/glance/glance-registry-paste.ini文件
注:红色为必须要修改(核对)的地方,建议把提到的这几项都核对一下:
[filter:authtoken]编辑/etc/glance/glance-api.conf和/etc/glance/glance-registry.conf,修改数据库连接:
sql_cOnnection=mysql://glanceUser:glancePass@10.0.0.2/glance
并且在[paste_deploy]下加上flavor = keystone
[paste_deploy]重启服务
service glance-api restart; serviceglance-registry restart
同步数据库:
再次重启服务
service glance-registry restart; serviceglance-api restart
上传镜像测试glance的安装情况:
glance image-create--name myFirstImage--is-public true --container-format bare --disk-format qcow2 -?locationhttps://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
查看镜像:
2013.7.11更新
5. Quantum 5.1. OpenVSwitch安装OpenVSwitch
apt-get install -y openvswitch-switch
openvswitch-datapath-dkms
建立网桥br-int和br-ex:
#br-int will be used for VM integration
#br-ex is used to make to access the internet(not covered
in this guide)
apt-get install -y quantum-server
quantum-plugin-openvswitchquantum-plugin-openvswitch-agent dnsmasq
quantum-dhcp-agent quantum-l3-agent
创建quantum数据库(用户名和密码可修改):
GRANT ALL ON quantum.* TO 'quantumUser'@'%'IDENTIFIED BY
'quantumPass';
查看Quantum-*组件状态
cd /etc/init.d/; for i in $( ls quantum-* ); do sudo service $i status;done
编辑 /etc/quantum/api-paste.ini
paste.filter_factory
=keystoneclient.middleware.auth_token:filter_factory
admin_tenant_name = service
admin_password = service_pass
#Under the database section
sql_connection =
mysql://quantumUser:quantumPass@10.0.0.2/quantum
tenant_network_type = gre
tunnel_id_ranges = 1:1000
integration_bridge = br-int
编辑 /etc/quantum/metadata_agent.ini
# The Quantum user information for accessingthe Quantum API.
auth_url = http://10.0.0.2:35357/v2.0
admin_tenant_name = service
admin_password = service_pass
# IP address used by Nova metadata server
nova_metadata_ip = 127.0.0.1
# TCP Port used by Nova metadata server
nova_metadata_port = 8775
metadata_proxy_shared_secret = helloOpenStack
编辑 /etc/quantum/quantum.conf
admin_tenant_name = service
admin_password = service_pass
signing_dir = /var/lib/quantum/keystone-signing
cd /etc/init.d/; for i in $( ls quantum-* ); dosudo service $i restart; done
6. Nova确保硬件支持虚拟化:
apt-get install cpu-checker
若在虚拟机中安装,以下错误可忽略:
apt-get install -y kvm libvirt-bin pm-utils
编辑/etc/libvirt/qemu.conf文件,使得cgroup_device_acl与下面相同:
"/dev/null", "/dev/full","/dev/zero",
"/dev/random","/dev/urandom",
"/dev/ptmx", "/dev/kvm","/dev/kqemu",
"/dev/rtc","/dev/hpet","/dev/net/tun"
删除默认的网桥(也可以不删除,不会有影响)
virsh net-destroy default
virsh net-undefine default
编辑 /etc/libvirt/libvirtd.conf 文件以便支持动态迁移:
修改/etc/init/libvirt-bin.conf 中的libvirtd_opts变量
env libvirtd_opts="-d -l"
修改/etc/default/libvirt-bin中的libvirtd_opts变量
重启libvirt 服务使得修改生效
service libvirt-bin restart
6.2 Nova-*安装nova组件:
apt-get install -y nova-api nova-cert novnc nova-consoleauthnova-scheduler nova-novncproxy nova-doc nova-conductor nova-compute-kvm
cd /etc/init.d/; for i in $( ls nova-* ); do service $i status; cd; done
GRANT ALL ON nova.* TO 'novaUser'@'%' IDENTIFIED BY
'novaPass';
修改/etc/nova/api-paste.ini文件::
paste.filter_factory =
keystoneclient.middleware.auth_token:filter_factory
admin_tenant_name = service
admin_password = service_pass
signing_dirname = /tmp/keystone-signing-nova
# Workaround for
https://bugs.launchpad.net/nova/+bug/1154809
修改 /etc/nova/nova.conf 文件(最好是把原来的文件备份,然后新建和下面一样的文件):
api_paste_cOnfig=/etc/nova/api-paste.ini
nova_url=http://10.0.0.2:8774/v1.1/
root_helper=sudo nova-rootwrap
/etc/nova/rootwrap.conf
use_deprecated_auth=false
glance_api_servers=10.0.0.2:9292
vncserver_proxyclient_address=10.0.0.2
quantum_url=http://10.0.0.2:9696
quantum_auth_strategy=keystone
quantum_admin_tenant_name=service
quantum_admin_username=quantum
quantum_admin_password=service_pass
service_quantum_metadata_proxy = True
quantum_metadata_proxy_shared_secret =
helloOpenStack
metadata_listen = 127.0.0.1
metadata_listen_port = 8775
compute_driver=libvirt.LibvirtDriver
volume_api_class=nova.volume.cinder.API
osapi_volume_listen_port=5900
编辑 /etc/nova/nova-compute.conf:
#libvirt_type=kvm(物理机)
libvirt_ovs_bridge=br-int
libvirt_vif_type=ethernet
libvirt_use_virtio_for_bridges=True
cd /etc/init.d/; for i in $( ls nova-* ); do sudo service $i restart; done
检查nova-*各项服务是否工作正常(笑脸为正常)
7. Cinder安装Cinder以及必须的软件包
sudo apt-get install cinder-api
cinder-scheduler cinder-volume open-iscsi
python-cinderclient tgt
sed -i 's/false/true/g' /etc/default/iscsitarget
GRANT ALL ON cinder.* TO 'cinderUser'@'%' IDENTIFIED BY
'cinderPass';
修改/etc/cinder/api-paste.ini:
paste.filter_factory =
keystoneclient.middleware.auth_token:filter_factory
service_host = 192.168.66.168
admin_tenant_name = service
admin_password = service_pass
编辑 /etc/cinder/cinder.conf :
rootwrap_cOnfig=/etc/cinder/rootwrap.conf
sql_connection =
mysql://cinderUser:cinderPass@10.0.0.2/cinder
api_paste_config = /etc/cinder/api-paste.ini
volume_name_template = volume-%s
volume_group = cinder-volumes
#osapi_volume_listen_port=5900
state_path=/var/lib/cinder
volumes_dir=/var/lib/cinder/volumes
dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=2G
losetup /dev/loop2 cinder-volumes
vgcreate cinder-volumes /dev/loop2
为了重启后逻辑组cinder-volumes还在,可以在/etc/rc.local的exit 0之前加入
losetup /dev/loop2 cinder-volumes
cd /etc/init.d/; for i in $( ls cinder-* ); do sudo service $i restart;done
apt-get install openstack-dashboard memcached
如果不喜欢OpenStack ubuntu的主题页面,可以去除改包:
dpkg --purge openstack-dashboard-ubuntu-theme
重启apache2 和memcached 服务
service apache2 restart; service memcached restart
然后就可以从网页上访问192.168.66.168/horizon
如果没有改,则默认的账号和密码是:admin:admin_pass.