ubuntu12.04安装openstack(nova-network)
ubuntu12.04安装openstack(nova-network)
目标:在ubuntu12.04上安装openstack,folsom版本,网络是用的nova-network模块,单网卡模式。
机器:
Controller:192.168.0.55
Compute: 192.168.0.89
Admin_token设置为ADMIN
Admin_password设置为password
service_password设置为password
Mysql中的密码为
Keystone:keystoneUser,keystonePass
Nova:novaUser,novaPass
Glance:glanceUser,glancePass
Cinder:cinderUser,cinderPass
控制节点:
1.更新源:
|
1
2
3
4
5
|
cat <<EOF >>/etc/apt/sources.listdeb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-proposed/folsom maindeb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom mainEOFapt-get update; |
2.进入root权限,从始至终都使用root,工作目录为/root
sudo su -;
输入密码;
cd
3.安装ntp服务和设置ip转发
|
1
|
apt-get install ntp; |
在/etc/ntp.conf中加入以下三行:
|
1
2
3
|
server ntp.ubuntu.comserver 127.127.1.0fudge 127.127.1.0 stratum 10 |
重启ntp服务:
|
1
|
service ntp restart; |
设置ip转发
|
1
2
|
sed -i -r 's/^\s*#(net\.ipv4\.ip_forward=1.*)/\1/' /etc/sysctl.confecho 1 > /proc/sys/net/ipv4/ip_forward |
检查是否开启ip转发
|
1
|
sysctl -p |
4.安装mysql:
|
1
|
apt-get install mysql-server python-mysqldb |
安装过程中设置密码root的密码为password
设置mysql接受所有的请求:
|
1
|
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf |
重启mysql服务:
|
1
|
service mysql restart |
5.安装rabbitmq
|
1
|
apt-get -y install rabbitmq-server |
6.安装keystone
|
1
|
apt-get install keystone |
创建keystone的数据库
|
1
2
3
4
5
|
mysql -uroot -ppasswordcreate database keystoneGRANT ALL ON keystone.* TO 'keystoneUser'@'%' IDENTIFIED BY 'keystonePass';GRANT ALL ON keystone.* TO 'keystoneUser'@'localhostt' IDENTIFIED BY 'keystonePass';quit; |
修改keystone的数据库连接:
|
1
|
connection = mysql://keystoneUser:keystonePass@192.168.0.55/keystone |
修改keystone.conf中的其它选项:
|
1
2
3
4
5
6
7
8
9
|
admin_token = ADMINpublic_port = 5000admin_port = 35357compute_port = 8774verbose = Truedebug = Truelog_file = keystone.loglog_dir = /var/log/keystonelog_config = /etc/keystone/logging.conf |
重启和初始化数据库:
|
1
2
|
service keystone restartkeystone-manage db_sync |
利用脚本建立role,user,tenant,service,endpoint等
|
1
2
|
wget https://raw.github.com/nimbula/OpenStack-Folsom-Install-guide/master/Keystone_Scripts/Without%20Quantum/keystone_basic.shwget https://raw.github.com/nimbula/OpenStack-Folsom-Install-guide/master/Keystone_Scripts/Without%20Quantum/keystone_endpoints_basic.sh |
增加可执行权限:
|
1
|
chmod +x keystone_* |
修改keystone_basic.sh中的ip以及password,admin_password与service_password设置为password
修改keystone_endpoints_basic.sh中的ip设置
执行脚本:
|
1
2
|
./keystone_basic.sh./keystone_endpoint_basic.sh |
建立脚本设置环境变量:
gedit novarc
写入如下内容:
|
1
2
3
4
5
6
7
|
export OS_TENANT_NAME=adminexport OS_USERNAME=adminexport OS_PASSWORD=passwordexport SERVICE_PASSWORD=passwordexport OS_AUTH_URL="http://localhost:5000/v2.0/"export SERVICE_ENDPOINT="http://localhost:35357/v2.0"export SERVICE_TOKEN=ADMIN |
执行source novarc
7.安装glance
|
1
|
apt-get install glance |
创建数据库
|
1
2
3
4
5
|
mysql -uroot -ppasswordcreate database glancegrant all on glance.* to 'glanceUser'@'%' identified by 'glanceUser'grant all on glance.* to 'glanceUser'@'localhost' identified by 'glanceUser'quit; |
设置glance
在glance-api.conf与glance-registry.conf中修改
|
1
2
3
4
|
sql_connection = mysql://glanceUser:glancePass@192.168.0.55/glanceadmin_tenant_name = serviceadmin_user = glanceadmin_password = password |
修改glance-api文件
|
1
2
3
4
|
#notifier_strategy = noopnotifier_strategy = rabbit#rabbit_password = guestrabbit_password = password |
执行以下命令:
|
1
2
3
4
5
6
|
cat <<EOF >>/etc/glance/glance-api.confflavor = keystone+cachemanagementEOFcat <<EOF >>/etc/glance/glance-registry.conf flavor = keystoneEOF |
重启服务
|
1
|
service glance-api restart && service glance-registry restart |
同步数据库
|
1
|
glance-manage db_sync |
下载镜像
|
1
|
wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img |
上传镜像
|
1
|
glance image-create --name=cirros-0.3.0-x86_64 --public --container-format=bare --disk-format=qcow2 < /root/cirros-0.3.0-x86_64-disk.img |
8.设置网络
在/etc/network/interfaces里面写入下面的内容:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto br100iface br100 inet static address 192.168.0.55 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.254 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 172.16.0.16 dns-search mtv.nimbula.org bridge_ports eth0 bridge_stp off bridge_maxwait 0 bridge_fd 0 |
确定br100启动并且重启网络:
|
1
|
brctl addbr br100; /etc/init.d/networking restart |
9,安装nova
|
1
|
apt-get install -y nova-api nova-cert novnc nova-consoleauth nova-scheduler nova-novncproxy nova-network |
如果前面的脚本的版本中有建立quantum的服务和endpoint等,先删除
|
1
2
|
keystone endpoint-list | grep 9696keystone service-list | grep quantum |
创建数据库并设置权限
|
1
2
3
4
5
|
mysql -uroot -ppasswordcreate datebase nova;GRANT ALL ON nova.* TO 'novaUser'@'%' IDENTIFIED BY 'novaPass';GRANT ALL ON nova.* TO 'novaUser'@'localhost' IDENTIFIED BY 'novaPass';quit; |
修改api-paste.ini文件
|
1
2
3
4
5
6
7
8
9
|
[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factoryauth_host = 192.168.0.55auth_port = 35357auth_protocol = httpadmin_tenant_name = serviceadmin_user = novaadmin_password = passwordsigning_dirname = /tmp/keystone-signing-nova |
清空nova.conf中的内容写入以下内容
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
[DEFAULT]logdir=/var/log/novastate_path=/var/lib/novalock_path=/run/lock/novaverbose=Trueapi_paste_config=/etc/nova/api-paste.inischeduler_driver=nova.scheduler.simple.SimpleSchedulers3_host=192.168.0.55ec2_host=192.168.0.55ec2_dmz_host=192.168.0.55rabbit_host=192.168.0.55cc_host=192.168.0.55metadata_host=192.168.0.55metadata_listen=0.0.0.0nova_url=http://192.168.0.55:8774/v1.1/sql_connection=mysql://novaUser:novaPass@192.168.0.55/novaec2_url=http://192.168.0.55:8773/services/Cloudroot_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf # Authuse_deprecated_auth=falseauth_strategy=keystonekeystone_ec2_url=http://192.168.0.55:5000/v2.0/ec2tokens# Imaging serviceglance_api_servers=192.168.0.55:9292image_service=nova.image.glance.GlanceImageService # Vnc configurationnovnc_enabled=truenovncproxy_base_url=http://:6080/vnc_auto.htmlnovncproxy_port=6080vncserver_proxyclient_address=192.168.0.55vncserver_listen=0.0.0.0 # NETWORKnetwork_manager=nova.network.manager.FlatDHCPManagerforce_dhcp_release=Truedhcpbridge_flagfile=/etc/nova/nova.conffirewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver# Change my_ip to match each hostmy_ip=192.168.0.55public_interface=br100vlan_interface=eth0flat_network_bridge=br100flat_interface=eth0#Note the different pool, this will be used for instance rangefixed_range=192.168.0.128/28 # Compute #compute_driver=libvirt.LibvirtDriver # Cinder #volume_api_class=nova.volume.cinder.APIosapi_volume_listen_port=5900 |
写入数据库
|
1
|
nova-manage db_sync |
重启所有nova服务
|
1
|
cd /etc/init.d/; for i in $( ls nova-* ); do sudo service $i restart; done |
可以查看服务是否正常启动
|
1
|
nova-manage service list |
10.安装cinder
|
1
|
apt-get install cinder-api cinder-scheduler cinder-volume iscsitarget iscsitarget-dkms |
创建数据库
|
1
2
3
4
|
mysql -uroot -ppasswordcreate datebase cinder;grant all on cinder.* to 'cinderUser'@'%'identified by 'cinderPass';grant all on cinder.* to 'cinderUser'@'localhost'identified by 'cinderPass' |
修改api-paste.ini文件
|
1
2
3
4
5
6
7
8
9
10
11
|
[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factoryservice_protocol = httpservice_host = 192.168.0.55service_port = 5000auth_host = 192.168.0.55auth_port = 35357auth_protocol = httpadmin_tenant_name = serviceadmin_user = cinderadmin_password = password |
在conf文件中加入
|
1
|
sql_connection = mysql://cinderUser:cinderPass@192.168.0.55/cinder |
写入数据库
|
1
|
cinder-manage db_sync |
用sdb4用作cinder的volume
|
1
2
3
|
umount /dev/sdb4pvcreste /dev/sdb4vgcreate cinder-volumes /dev/sdb4 |
去掉开机挂载
|
1
|
sed -i '/nova-volume/s/^/#/' /etc/fstab |
设置重启iscsi
|
1
2
3
|
sed -i 's/false/true/g' /etc/default/iscsitargetservice iscsitarget restartservice open-iscsi restart |
11.安装dashboard
|
1
|
apt-get install openstack-dashboard memcached |
在/etc/openstack-dashboard/local_settings.py中注释掉以下内容
|
1
2
3
4
5
|
#Enable the Ubuntu theme if it is present.#try:# from ubuntu_theme import *#except ImportError:# pass |
重启服务
|
1
|
/etc/openstack-dashboard/local_settings.py |
compute节点
1.更新源
|
1
2
3
4
5
|
cat <<EOF >>/etc/apt/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 EOF apt-get update; |
2.安装ntp并设置
|
1
2
3
|
apt-get install ntpsed -i 's/server ntp.ubuntu.com/server 192.168.0.55/' /etc/ntp.confservice ntp restart |
3.安装网络控件
|
1
|
apt-get install vlan bridge-utils |
4.设置ip转发
|
1
2
|
sed -i -r 's/^\s*#(net\.ipv4\.ip_forward=1.*)/\1/' /etc/sysctl.confecho 1 > /proc/sys/net/ipv4/ip_forward |
检查是否开启ip转发
|
1
|
sysctl -p |
5.确定硬件支持虚拟化
|
1
2
|
apt-get install cpu-checkerkvm-ok |
6.安装虚拟化软件
|
1
|
apt-get install -y kvm libvirt-bin pm-utils |
在/etc/libvirt/qemu.conf中写入以下内容
|
1
2
3
4
5
6
|
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"] |
删除虚拟网桥
|
1
2
|
virsh net-destroy defaultvirsh net-undefine default |
7.设置迁移
在/etc/libvirt/libvirt.conf中设置
|
1
2
3
|
listen_tls = 0listen_tcp = 1auth_tcp = "none" |
在/etc/init/libvirt-bin.conf中设置
|
1
|
env libvirtd_opts="-d -l" |
在/etc/default/libvirt-bin中设置
|
1
|
libvirtd_opts="-d -l" |
重启服务
|
1
|
service libvirt-bin restart |
8.安装nova-network
|
1
|
apt-get install nova-network bridge-utils |
在/etc/network/interfaces写入
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto br100iface br100 inet static address 192.168.0.89 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.254 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 172.16.0.16 dns-search mtv.nimbula.org bridge_ports eth0 bridge_stp off bridge_maxwait 0 bridge_fd 0 |
重启网络服务
|
1
|
brctl addbr br100; /etc/init.d/networking restart |
在/etc/nova/api-paste.ini中设置
|
1
2
3
4
5
6
7
8
9
|
[filter:authtoken]paste.filter_factory = keystone.middleware.auth_token:filter_factoryauth_host = 192.168.0.55auth_port = 35357auth_protocol = httpadmin_tenant_name = serviceadmin_user = novaadmin_password = passwordsigning_dirname = /tmp/keystone-signing-nova |
在/etc/nova/nova.conf中设置
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
[DEFAULT]logdir=/var/log/novastate_path=/var/lib/novalock_path=/run/lock/novaverbose=Trueapi_paste_config=/etc/nova/api-paste.inischeduler_driver=nova.scheduler.simple.SimpleSchedulers3_host=192.168.0.55ec2_host=192.168.0.55ec2_dmz_host=192.168.0.55rabbit_host=192.168.0.55cc_host=192.168.0.55metadata_host=192.168.0.89metadata_listen=0.0.0.0nova_url=http://192.168.0.55:8774/v1.1/sql_connection=mysql://novaUser:novaPass@192.168.0.55/novaec2_url=http://192.168.0.55:8773/services/Cloudroot_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf # Authuse_deprecated_auth=falseauth_strategy=keystonekeystone_ec2_url=http://192.168.0.55:5000/v2.0/ec2tokens# Imaging serviceglance_api_servers=192.168.0.55:9292image_service=nova.image.glance.GlanceImageService # Vnc configurationnovnc_enabled=truenovncproxy_base_url=http://192.168.0.55:6080/vnc_auto.htmlnovncproxy_port=6080vncserver_proxyclient_address=192.168.0.89vncserver_listen=0.0.0.0 # NETWORKnetwork_manager=nova.network.manager.FlatDHCPManagerforce_dhcp_release=Truedhcpbridge=/usr/bin/nova-dhcpbridgedhcpbridge_flagfile=/etc/nova/nova.conffirewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver# Change my_ip to match each hostmy_ip=192.168.0.89public_interface=br100vlan_interface=eth0flat_network_bridge=br100flat_interface=eth0#Note the different pool, this will be used for instance rangefixed_range=192.168.1.0/24 # Compute #compute_driver=libvirt.LibvirtDriver # Cinder #volume_api_class=nova.volume.cinder.APIosapi_volume_listen_port=5900 |
写入数据库
|
1
|
nova-manage db sync |
启动所有的nova服务
|
1
|
cd /etc/init.d/; for i in $(ls nova-*); do sudo service $i restart; done |
posted on 2013-05-18 01:42 telnetning 阅读(557) 评论(0) 收藏 举报
浙公网安备 33010602011771号