zoukankan      html  css  js  c++  java
  • ubuntu12.04安装openstack(novanetwork)

    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.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 <<EOF >>/etc/glance/glance-api.conf
    flavor = keystone+cachemanagement
    EOF
    cat <<EOF >>/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 packageif 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 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 <<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 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 packageif 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 in $(ls nova-*); do sudo service $i restart; done
  • 相关阅读:
    测试websocket
    goreplay-测试app的真实流量
    apache -ab
    微信公众平台开发(69)百度地图导航
    微信公众平台开发(70)经济指标财经大事
    微信公众平台开发(68)苹果IMEI查询
    微信公众平台开发(67)百度百科
    微信公众平台开发(66)人品计算
    微信公众平台开发(65) 微博树洞
    微信公众平台开发(64)航班动态
  • 原文地址:https://www.cnblogs.com/telnetning/p/3084836.html
Copyright © 2011-2022 走看看