close

首先要了解這個是什麼~
http://opennebula.org/about:about

了解一下這個計畫的主要目的與歷史,它是一個 open-source project,簡單來說它是用來建立與管理虛擬化企業資料中心與企業私有雲的解決方案 ~ 如果沒有操作過 VMware Vsphere、Citrix Xenserver、KVM、XEN 這一類的虛擬軟體,會覺得有點莫名奇妙。

接下來要說明的是有關安裝…

安裝前的計畫請看,看完就可以接著安裝了
http://opennebula.org/documentation:rel4.2:plan


 The basic components of an OpenNebula system are:

  • Front-end, executes the OpenNebula services.
  • Hosts, hypervisor-enabled hosts that provide the resources needed by the VMs.
  • Datastores hold the base images of the VMs.
  • Service Network, physical network used to support basic services: interconnection of the storage servers and OpenNebula control operations
  • VM Networks physical network that will support VLAN for the VMs.

Front-end 與 Hosts 之間、Hosts 與 Hosts 間最好可以以免密碼 SSH 方式登入 root。

Additionally you should be able to ssh passwordlessly to all the hosts (including itself, the frontend) from the frontend.

Additionally you should be able to ssh passwordlessly to all the hosts (including itself and the frontend) from each host.


如果沒有 shared FS,就無法使用虛擬化的功能了,像是 live migration。

OpenNebula can work without a Shared FS. This will force the deployment to always clone the images and you will only be able to do cold migration.


網路的設計方面則必需讓 Front-end 可以存取到 Hosts,VMs 可以有網路連接功能…等等。


 

開始安裝囉~文件是參考官網上的安裝手冊。
http://opennebula.org/documentation:rel4.2:ignc

 

首先準備兩台主機 都是用 CentOS 6.4 64Bits,一台是給 Front-end 用,一台是給 Hosts (With KVM Hypervisor) 用,Hosts 比較特別,是指有運行 Hypervisor (KVM、Xen、Vmware 都可以) 的主機。

 

@Front-end (192.168.157.131)

CentOS 安裝,請參考這 http://wiki.centos.org/Cloud/OpenNebula/QuickStart

[root@opennebula-frontend ~]# cd /etc/yum.repos.d/
[root@opennebula-frontend yum.repos.d]# curl -O http://dev.centos.org/centos/6/opennebula/opennebula-testing.repo
[root@opennebula-frontend yum.repos.d]# yum install opennebula-server opennebula-sunstone

設定並啟動 NFS
[root@opennebula-frontend yum.repos.d]# vi /etc/exports

/var/lib/one/datastores 192.168.157.0/24(rw,sync,no_subtree_check,root_squash)

啟動 OpenNebula 相關服務

[root@opennebula-frontend one]# /etc/init.d/opennebula start
Starting OpenNebula daemon: [ OK ]
[root@opennebula-frontend one]# /etc/init.d/opennebula-sunstone start
Starting Sunstone Server daemon: sunstone-server started    [ OK ]
[root@opennebula-frontend one]# /etc/init.d/opennebula-occi start
Starting OCCI Server: occi-server started   [ OK ]

 

@Hosts (192.168.157.132)

[root@opennebula-hosts ~]# cd /etc/yum.repos.d/
[root@opennebula-hosts yum.repos.d]# curl -O http://dev.centos.org/centos/6/opennebula/opennebula-testing.repo
[root@opennebula-hosts yum.repos.d]# yum install opennebula-node-kvm

檢查網路是否有虛擬網路卡,Bridged 到實體網路卡
[root@opennebula-hosts ~]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.5254006418a7 yes virbr0-nic

 

掛載 Front-end 的 NFS 分享
[root@opennebula-hosts one]# vi /etc/fstab

192.168.157.131:/var/lib/one/datastores  /var/lib/one/datastores  nfs   soft,intr,rsize=8192,wsize=8192,auto

[root@opennebula-hosts one]# mount -a

 

@Front-end (192.168.157.131)、Hosts (192.168.157.132)

需要在所有 node 中,建立 oneadmin 帳號互相登入免輸入密碼的環境 (ex:node1 登 node2),Front-end 也是一個 node 。

[root@opennebula-frontend ~]# su - oneadmin
[oneadmin@opennebula-frontend ~]$ cd .ssh/
[oneadmin@opennebula-frontend .ssh]$ ls
authorized_keys id_dsa id_dsa.pub known_hosts
[oneadmin@opennebula-frontend .ssh]$ cat id_dsa.pub > authorized_keys

取消把 key 加入known_hosts 的功能
[oneadmin@opennebula-hosts .ssh]$ vi config

 Host *
        StrictHostKeyChecking no
        UserKnownHostsFile /dev/null

接下來將 Front-end 的 /var/lib/one/.ssh 目錄複製到每個 node (hosts) 的 /var/lib/one 即可完成,注意目錄權限為drwx------,否則會登入失敗。

試登入
[oneadmin@opennebula-frontend ~]$ ssh oneadmin@192.168.157.132
Last login: Fri Aug 16 20:24:03 2013 from 192.168.157.131

註:這種方法比較快速,也就是說大家的 key-pair (id_dsa id_dsa.pub) 都相同。

 

另外有提供一個名為 Sunstone 的 WEB GUI ,可以操作先修改一下設定檔
[root@opennebula-frontend ~]# vi /etc/one/sunstone-server.conf
:host: 192.168.157.131
:port: 9869

修改管理者帳號 oneadmin 密碼 (非作業系統的密碼,而是用在 OpenNebula 的相關服務裡的)
[oneadmin@opennebula-frontend .one]$ oneuser passwd oneadmin 54321

如果發生怪異情況,像是 Sunstone 可以以新密碼登入,但 tty console 下指令會錯,
[oneadmin@opennebula-frontend ~]$ oneuser passwd oneadmin 54321
OpenNebula USER name not found, use the ID instead
command passwd: argument 0 must be one of userid
[oneadmin@opennebula-frontend ~]$ onevm list
[VirtualMachinePoolInfo] User couldn't be authenticated, aborting call.

這是因為 /var/lib/one/one.db 裡的密碼與家目錄 .one/one_auth 記錄的內容不一致,請
[oneadmin@opennebula-frontend ~]$ echo "oneadmin:54321" > ~/.one/one_auth
是因為帳號在下指令時,會檢查 .one/one_auth 的內容
請參考這 http://opennebula.org/documentation:rel4.2:manage_users

 

[oneadmin@opennebula-frontend ~]$ oneuser list
ID NAME GROUP AUTH VMS MEMORY CPU
0 oneadmin oneadmin core - - -
1 serveradmin oneadmin server_c

 

以 Browser 連接 http://192.168.157.131:9869
帳號:oneadmin
密碼:54321

opennebula-2013-08-16-16-15-21.png  

opennebula-2013-08-16-16-17-21.png  

 

 

arrow
arrow
    全站熱搜

    creative1223 發表在 痞客邦 留言(0) 人氣()