设为首页 收藏本站
查看: 1015|回复: 0

[经验分享] ubuntu12.04安装openstack(nova-network)

[复制链接]

尚未签到

发表于 2015-4-12 07:49:37 | 显示全部楼层 |阅读模式
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 /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.进入root权限,从始至终都使用root,工作目录为/root
    sudo su -;
    输入密码;
    cd  
  3.安装ntp服务和设置ip转发



1


apt-get install ntp;  
  在/etc/ntp.conf中加入以下三行:



1
2
3


server ntp.ubuntu.com
server 127.127.1.0
fudge 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.conf
echo 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 -ppassword
create database keystone
GRANT 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 = ADMIN
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
  重启和初始化数据库:



1
2


service keystone restart
keystone-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.sh
wget 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=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export SERVICE_PASSWORD=password
export 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 -ppassword
create database glance
grant  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/glance
admin_tenant_name = service
admin_user = glance
admin_password = password
  修改glance-api文件



1
2
3
4


#notifier_strategy = noop
notifier_strategy = rabbit
#rabbit_password = guest
rabbit_password = password
  执行以下命令:



1
2
3
4
5
6


cat /etc/glance/glance-api.conf
flavor = keystone+cachemanagement
EOF
cat /etc/glance/glance-registry.conf
flavor = keystone
EOF
  重启服务



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 interface
auto lo
iface lo inet loopback
# The primary network interface
auto br100
iface 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 9696
keystone service-list | grep quantum
  创建数据库并设置权限



1
2
3
4
5


mysql -uroot -ppassword
create 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_factory
auth_host = 192.168.0.55
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = password
signing_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/nova
state_path=/var/lib/nova
lock_path=/run/lock/nova
verbose=True
api_paste_config=/etc/nova/api-paste.ini
scheduler_driver=nova.scheduler.simple.SimpleScheduler
s3_host=192.168.0.55
ec2_host=192.168.0.55
ec2_dmz_host=192.168.0.55
rabbit_host=192.168.0.55
cc_host=192.168.0.55
metadata_host=192.168.0.55
metadata_listen=0.0.0.0
nova_url=http://192.168.0.55:8774/v1.1/
sql_connection=mysql://novaUser:novaPass@192.168.0.55/nova
ec2_url=http://192.168.0.55:8773/services/Cloud
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
   
# Auth
use_deprecated_auth=false
auth_strategy=keystone
keystone_ec2_url=http://192.168.0.55:5000/v2.0/ec2tokens
# Imaging service
glance_api_servers=192.168.0.55:9292
image_service=nova.image.glance.GlanceImageService
   
# Vnc configuration
novnc_enabled=true
novncproxy_base_url=http://:6080/vnc_auto.html
novncproxy_port=6080
vncserver_proxyclient_address=192.168.0.55
vncserver_listen=0.0.0.0
   
# 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.0.55
public_interface=br100
vlan_interface=eth0
flat_network_bridge=br100
flat_interface=eth0
#Note the different pool, this will be used for instance range
fixed_range=192.168.0.128/28
   
# Compute #
compute_driver=libvirt.LibvirtDriver
   
# Cinder #
volume_api_class=nova.volume.cinder.API
osapi_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 -ppassword
create 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_factory
service_protocol = http
service_host = 192.168.0.55
service_port = 5000
auth_host = 192.168.0.55
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = cinder
admin_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/sdb4
pvcreste /dev/sdb4
vgcreate cinder-volumes /dev/sdb4
  去掉开机挂载



1


sed -i '/nova-volume/s/^/#/' /etc/fstab
  设置重启iscsi



1
2
3


sed -i 's/false/true/g' /etc/default/iscsitarget
service iscsitarget restart
service 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 /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 ntp
sed -i 's/server ntp.ubuntu.com/server 192.168.0.55/' /etc/ntp.conf
service 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.conf
echo 1 > /proc/sys/net/ipv4/ip_forward
  检查是否开启ip转发



1


sysctl -p
  5.确定硬件支持虚拟化



1
2


apt-get install cpu-checker
kvm-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 default
virsh net-undefine default
  7.设置迁移
  在/etc/libvirt/libvirt.conf中设置



1
2
3


listen_tls = 0
listen_tcp = 1
auth_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 interface
auto lo
iface lo inet loopback
# The primary network interface
auto br100
iface 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_factory
auth_host = 192.168.0.55
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = password
signing_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/nova
state_path=/var/lib/nova
lock_path=/run/lock/nova
verbose=True
api_paste_config=/etc/nova/api-paste.ini
scheduler_driver=nova.scheduler.simple.SimpleScheduler
s3_host=192.168.0.55
ec2_host=192.168.0.55
ec2_dmz_host=192.168.0.55
rabbit_host=192.168.0.55
cc_host=192.168.0.55
metadata_host=192.168.0.89
metadata_listen=0.0.0.0
nova_url=http://192.168.0.55:8774/v1.1/
sql_connection=mysql://novaUser:novaPass@192.168.0.55/nova
ec2_url=http://192.168.0.55:8773/services/Cloud
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
   
# Auth
use_deprecated_auth=false
auth_strategy=keystone
keystone_ec2_url=http://192.168.0.55:5000/v2.0/ec2tokens
# Imaging service
glance_api_servers=192.168.0.55:9292
image_service=nova.image.glance.GlanceImageService
   
# Vnc configuration
novnc_enabled=true
novncproxy_base_url=http://192.168.0.55:6080/vnc_auto.html
novncproxy_port=6080
vncserver_proxyclient_address=192.168.0.89
vncserver_listen=0.0.0.0
   
# NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcpbridge=/usr/bin/nova-dhcpbridge
dhcpbridge_flagfile=/etc/nova/nova.conf
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
# Change my_ip to match each host
my_ip=192.168.0.89
public_interface=br100
vlan_interface=eth0
flat_network_bridge=br100
flat_interface=eth0
#Note the different pool, this will be used for instance range
fixed_range=192.168.1.0/24
   
# Compute #
compute_driver=libvirt.LibvirtDriver
   
# Cinder #
volume_api_class=nova.volume.cinder.API
osapi_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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-56143-1-1.html 上篇帖子: 玩转Openstack之Nova中的协同并发(一) 下篇帖子: [zz]为 OpenStack Nova 制作 Ubuntu 镜像
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表