Opennebula 雲平臺

官網安裝文檔

一、安裝步驟
  • 一、關閉SE
    • SELINUX=disabled
  • 二、配置epel源地和opennebula源
    • centos7
    cat << "EOT" > /etc/yum.repos.d/opennebula.repo
    [opennebula]
    name=opennebula
    baseurl=https://downloads.opennebula.org/repo/5.10/CentOS/7/$basearch
    enabled=1
    gpgkey=https://downloads.opennebula.org/repo/repo.key
    gpgcheck=1
    repo_gpgcheck=1
    EOT
    • centos8
    cat << "EOT" > /etc/yum.repos.d/opennebula.repo
    [opennebula]
    name=opennebula
    baseurl=https://downloads.opennebula.org/repo/5.10/CentOS/8/$basearch
    enabled=1
    gpgkey=https://downloads.opennebula.org/repo/repo.key
    gpgcheck=1
    repo_gpgcheck=1
    EOT
  • 三、安裝相關主控相關依賴包
    yum install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow -y
  • 四、Ruby 運行環境安裝(V5.10版本以後可選)
    查看:
    ls -lad /usr/share/one/gems*
    lrwxrwxrwx 1 root root    9 Aug 13 11:41 /usr/share/one/gems -> gems-dist
    drwxr-xr-x 9 root root 4096 Aug 13 11:41 /usr/share/one/gems-dist
    
    自動修復:
    test -L /usr/share/one/gems && unlink /usr/share/one/gems
    /usr/share/one/install_gems
    
    手動修復:
    sqlite3 development library
    mysql client development library
    curl development library
    libxml2 and libxslt development libraries
    ruby development library
    gcc and g++
    make
    以上安裝包
  • 五、mysql數據庫配置
    一、建立用戶
    GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY '<thepassword>';
    
    二、配置事務隔離級別
    SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
    
    三、配置oned.configuration
    # Sample configuration for MySQL
       DB = [ backend = "mysql",
       server  = "localhost",
       port    = 0,
       user    = "oneadmin",
       passwd  = "<thepassword>",
       db_name = "opennebula" ]
    四、按期清理索引
    alter table vm_pool drop index ftidx;
    alter table vm_pool add fulltext index ftidx (search_token);
    五、虛擬機自定義配置
  • 六、啓動OpenNebula
    一、使用 oneadmin 用戶
    su oneadmin
    二、修改默認密碼
    echo "oneadmin:mypassword" > ~/.one/one_auth
    三、啓動
    systemctl start opennebula
    systemctl start opennebula-sunstone
    四、出錯驗證Ruby環境是否有問題
  • 七、驗證安裝
    一、命令:oneuser show
    輸出:
    USER 0 INFORMATION
    ID              : 0
    NAME            : oneadmin
    GROUP           : oneadmin
    PASSWORD        : 3bc15c8aae3e4124dd409035f32ea2fd6835efc9
    AUTH_DRIVER     : core
    ENABLED         : Yes
    
    USER TEMPLATE
    TOKEN_PASSWORD="ec21d27e2fe4f9ed08a396cbd47b08b8e0a4ca3c"
    
    RESOURCE USAGE & QUOTAS
    二、網頁
    http://<frontend_address>:9869
    三、錯誤日誌
    /var/log/one/sunstone.log
    /var/log/one/sunstone.error
    四、程序說明
    Path	Description
    /etc/one/	Configuration Files
    /var/log/one/	Log files, notably: oned.log, sched.log, sunstone.log and <vmid>.log
    /var/lib/one/	oneadmin home directory
    /var/lib/one/datastores/<dsid>/	Storage for the datastores
    /var/lib/one/vms/<vmid>/	Action files for VMs (deployment file, transfer manager scripts, etc…)
    /var/lib/one/.one/one_auth	oneadmin credentials
    /var/lib/one/remotes/	Probes and scripts that will be synced to the Hosts
    /var/lib/one/remotes/hooks/	Hook scripts
    /var/lib/one/remotes/vmm/	Virtual Machine Manager Driver scripts
    /var/lib/one/remotes/auth/	Authentication Driver scripts
    /var/lib/one/remotes/im/	Information Manager (monitoring) Driver scripts
    /var/lib/one/remotes/market/	MarketPlace Driver scripts
    /var/lib/one/remotes/datastore/	Datastore Driver scripts
    /var/lib/one/remotes/vnm/	Networking Driver scripts
    /var/lib/one/remotes/tm/	Transfer Manager Driver scripts
    五、端口說明
    Port	Description
    9869	Sunstone server.
    29876	VNC proxy port, used for translating and redirecting VNC connections to the hypervisors.
    2633	OpenNebula daemon, main XML-RPC API endpoint.
    2474	OneFlow server. This port only needs to be opened if OneFlow server is used.
    5030	OneGate server. This port only needs to be opened if OneGate server is used.
    端口均可以自定義配置,或者代理。
  • 八、後續步驟
    一、重置密碼
    oneuser passwd 0 <PASSWORD>
    echo 'oneadmin:PASSWORD' > /var/lib/one/.one/one_auth
二、Opennedula 擴展應用
  • OneFlow
    • 說明
    用於將多個虛擬機應用程序定義和管理爲單個實體。OneFlow還讓您爲應用程序組件定義依賴關係和自動擴展策略。
    • 配置文件
    ################################################ #############################
    服務器配置
    ################## ################################################ #############
    
    
    #OpenNebula 守護程序聯繫信息#
    :one_xmlrpc : http:// localhost:2633 / RPC2
    
    #生命週期管理器步驟之間的時間(以秒爲單位)
    #
    :lcm_interval : 30
    
    #OneFlow服務器將運行的主機和端口
    :host : 127.0.0.1 
    :port : 2474
    
    ################################################ #############################
    默認值
    ################### ################################################ ############
    
    #縮放操做後的默認冷卻時間,以秒爲單位
    :default_cooldown : 300
    
    #默認關閉操做。值:'shutdown','shutdown-hard' 
    :shutdown_action : 'shutdown'
    
    #默認oneflow動做選項當只有一個被提供
    :action_number : 1 
    :action_period : 60
    
    #oneflow建立的虛擬機的默認名稱。您可使用
    如下
    #個
    佔位符中的任意一個:#$ SERVICE_ID #$ SERVICE_NAME 
    #$ ROLE_NAME 
    #$ VM_NUMBER
    
    :vm_name_template : '$ ROLE_NAME_ $ VM_NUMBER_(service_ $ SERVICE_ID)'
    
    ################################################ ########### 
    Auth 
    #################################### ########################
    
    #與OpenNebula核心進行通訊的身份驗證驅動程序
    #-密碼,用於令牌的對稱密碼加密
    #-x509,用於令牌的x509證書加密
    :core_auth : 密碼
    
    ################################################ #############################
    日誌
    ################## ################################################ ############
    
    #日誌調試級別
    #0 =錯誤,1 =警告,2 =信息,3 =調試
    #
    :debug_level : 2
    • 三、應用
    啓動:
    service opennebula-flow start
    日誌:
    /var/log/one/oneflow.error
    /var/log/one/oneflow.log
三、Opennedula node節點安裝
  • 一、要添加OpenNebula存儲庫,請以root用戶身份執行如下操做:
    cat << 「 EOT」 > /etc/yum.repos.d/opennebula.repo
     [ opennebula ] 
    名稱= opennebula
     baseurl = https://downloads.opennebula.org/repo/5.10/CentOS/7/ $ basearch 
    enabled = 1 
    gpgkey = https://downloads.opennebula.org/repo/repo.key
     gpgcheck = 1 
    repo_gpgcheck = 1 
    EOT
  • 二、安裝軟件
    sudo yum install opennebula-node-kvm
    sudo systemctl restart libvirtd
    qemu-kvm安裝
    sudo yum install  centos-release-qemu-ev
    sudo yum install qemu-kvm-ev
  • 三、禁用SElinux
    vim /etc/selinux/config
    SELINUX=disabled
  • 四、配置無密碼的SSH
    • 一、前端服務器之前端服務器,節點服務器爲參數,生成known_hosts文件
    ssh-keyscan <frontend> <node1> <node2> <node3> ... >> /var/lib/one/.ssh/known_hosts
    • 二、服務器分發文件
    scp -rp /var/lib/one/.ssh <node1>:/var/lib/one/
    scp -rp /var/lib/one/.ssh <node2>:/var/lib/one/
    scp -rp /var/lib/one/.ssh <node3>:/var/lib/one/
    ### FAQ
    選擇導入虛擬機後,會修改默認的/etc/libvirt/qemu.conf
    還原爲
    user = "qemu"
    group = "qemu"
    就能夠繼續使用命令行啓動
相關文章
相關標籤/搜索