JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

OpenNebula 建置在 Ubuntu 11.10 上


前提假設你已經安裝並建置好Ubuntu 11.10(我是使用x64的版本!,可參考http://simefirmi-work.blogspot.tw/2012/03/opennebulaopennebula-32-install-guide.html)後,分成兩個部分做安裝:
I、Front-End Install

1) 建立oneadmin帳戶與cloud群組(最後用oneadmin做驗證,從這邊之後#表root、$表oneadmin)
#mkdir -p /srv/cloud/
#groupadd -g 1001 cloud
#useradd -u 1001 -g cloud -m oneadmin -d /srv/cloud/one -s /bin/bash
#passwd oneadmin
#chown -R oneadmin:cloud /srv/cloud
#su - oneadmin
$pwd
$echo $SHELL
$id

2) 設定SSH免密碼登入(Remote_IP請改成自己的!)
$ssh-keygen -t rsa
$cat ~/.ssh/*.pub | ssh oneadmin@Remote_IP "cat >> .ssh/authorized_keys"

上述可用$ssh-copy-id -i ~/.ssh/id_rsa.pub oneadmin@Remote_IP來替代
$ssh oneadmin@Remote_IP
$chmod 711 ~/.ssh
$chmod 644 ~/.ssh/authorized_keys
$echo “StrictHostKeyChecking no” > ~/.ssh/config -> 省去第一次不詢問是否要寫至known_hosts
$ssh-add -> 如果Private Key沒有Load進來時可用,加上選項L可做Display
$exit

3) NFS Server的安裝與設定
#apt-get install nfs-kernel-server
#vi /etc/exports
/srv/cloud *(rw,fsid=0,nohide,sync,root_squash,no_subtree_check)
#/etc/init.d/nfs-kernel-server start

4) 安裝ONE所需要的額外套件
#apt-get install gcc
#apt-get install libsqlite3-dev libxmlrpc-c3-dev g++ ruby libruby libssl-dev ruby-dev
#apt-get install libxml2-dev libmysqlclient-dev libmysql++-dev libsqlite3-ruby libexpat1-dev
#apt-get install rake rubygems libxml-parser-ruby1.8 libxslt1-dev genisoimage scons

若在安裝scons出現如下的錯誤時,因為Ubuntu已經預先安裝Python 2.6,但scons需要版本2.7以上,所以解決方式如下:
There is a Problem you meet about the following statements ,and Solution is under the Problem
Errors were encountered while processing:
udev
initramfs-tools
dmsetup
kbd
alsa-base
kexec-tools
media-player-info
wireless-crda
pcmciautils
E: Sub-process /usr/bin/dpkg returned an error code (1)
#apt-get install udev
#cd /var/lib/dpkg/info
#vi udev.postinst
# 165 changed DB format
# if dpkg --compare-versions "$2" lt-nl "165~"; then
# udevadm info --convert-db
# fi
#apt-get remove python
#apt-get install python

最後記得在重裝一次scons套件!

5) 安裝LAMP環境並設定MySQL的連線帳密與建立ONE要使用的資料庫
#apt-get install apache2
#apt-get install php5 libapache2-mod-php5 php5-mysql php5-gd php5-cli
#apt-get install mysql-server mysql-client phpmyadmin
#/etc/init.d/apache2 restart

最後透過網頁與phpmyadmin來新增oneadmin使用者與opennebula資料庫,如下圖所示

6) 下載並安裝OpenNebula並將Sqlite轉換成MySQL後安裝在oneadmin使用者家目錄下
#su - oneadmin
$wget http://iori.tw/opennebula-3.2.1.tar.gz
$tar -zxvf ./opennebula-3.2.1.tar.gz
$cd ./opennebula-3.2.1
$scons sqlite=no mysql=yes
$./install.sh -u oneadmin -g cloud -d /srv/cloud/one

7) 編輯使用者oneadmin家目錄內的.bashrc來新增所需的環境變數
$vi ~/.bashrc
# Variable for ONE
export ONE_LOCATION=/srv/cloud/one
export ONE_AUTH=$ONE_LOCATION/.one/one_auth
export ONE_XMLRPC=http://localhost:2633/RPC2
export PATH=$ONE_LOCATION/bin:/usr/local/bin:/var/lib/gems/1.8/bin:$PATH
$source ~/.bashrc

8) 設定管理ONE的帳號與密碼
$mkdir ~/.one
$vi ~/.one/one_auth
oneadmin:設定管理用的Password
$chmod 640 ~/.one/one_auth

9) 設定OpenNebula資料庫相參數與所支援的資料庫(移掉欲支援資料庫的註解)
$vi ~/etc/oned.conf
PORT = 2633
# DB = [ backend = "sqlite" ]
# Sample configuration for MySQL
DB = [ backend = "mysql",
server = "localhost",
port = 0,
user = "oneadmin",
passwd = "資料庫密碼",
db_name = "opennebula" ]
VNC_BASE_PORT = 5900
#-------------------------------------------------------------------------------
# KVM Information Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
IM_MAD = [
name = "im_kvm",
executable = "one_im_ssh",
arguments = "-r 0 -t 15 kvm" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# XEN Information Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
IM_MAD = [
name = "im_xen",
executable = "one_im_ssh",
arguments = "xen" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# VMware Information Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
IM_MAD = [
name = "im_vmware",
executable = "one_im_sh",
arguments = "-t 15 -r 0 vmware" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# KVM Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
# -l actions executed locally, command can be
# overridden for each action.
# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll
# An example: "-l migrate,poll=poll_ganglia,save"
#-------------------------------------------------------------------------------
VM_MAD = [
name = "vmm_kvm",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 kvm",
default = "vmm_exec/vmm_exec_kvm.conf",
type = "kvm" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# XEN Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
# -l actions executed locally, command can be
# overridden for each action.
# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll
# An example: "-l migrate,poll=poll_ganglia,save"
#-------------------------------------------------------------------------------
VM_MAD = [
name = "vmm_xen",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 xen",
default = "vmm_exec/vmm_exec_xen.conf",
type = "xen" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# VMware Virtualization Driver Manager Configuration
# -r number of retries when monitoring a host
# -t number of threads, i.e. number of hosts monitored at the same time
#-------------------------------------------------------------------------------
VM_MAD = [
name = "vmm_vmware",
executable = "one_vmm_sh",
arguments = "-t 15 -r 0 vmware",
default = "vmm_exec/vmm_exec_vmware.conf",
type = "vmware" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# SHARED Transfer Manager Driver Configuration
#-------------------------------------------------------------------------------
TM_MAD = [
name = "tm_shared",
executable = "one_tm",
arguments = "tm_shared/tm_shared.conf" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# SSH Transfer Manager Driver Configuration
#-------------------------------------------------------------------------------
TM_MAD = [
name = "tm_ssh",
executable = "one_tm",
arguments = "tm_ssh/tm_ssh.conf" ]
#-------------------------------------------------------------------------------

10) 啟動ONE服務(可透過phpmyadmin檢視opennebula資料庫是否已建構完成)
$one start

11) 安裝Sunstone(ONE的網頁管理套件)
#apt-get install rails thin
#gem install json sinatra thin
#gem install sequel sinatra-sequel

若透過Ruby安裝thin出現以下錯誤時,解決方式如下(去除掉00:00:00.000000000Z)
There is a Problem you meet about the following statements ,and Solution is under the Problem
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"

s.date = %q{2011-08-25}
以上的解決方式是參考http://biboyatienza.blogspot.com/2011/11/invalid-gemspec-in-varlibgems18specific.html
之後再重新安裝thin後,繼續安裝sequel與sinatra-sequel後,再做下面的Symbolinc Link:
#ln -s /usr/bin/rackup1.8 /usr/bin/rackup

12) 修改Sunstone的設定檔(管理Server的IP與Port)
#su - oneadmin
$vi ~/etc/sunstone-server.conf
:host: 管理節點的IP
:port: 9869

13) 啟動Sunstone的服務
$cd ~/bin
$./sunstone-server start

此時可透過網頁瀏覽器做驗證,輸入http://管理節點的IP:9869,則會顯示最上面的登入首頁

II、Cluster-Node Install

14) 安裝KVM以及所需的額外套件
#apt-get install qemu-KVM libvirt-bin bridge-utils ubuntu-vm-builder ruby
#apt-get install nfs-common

15) 編輯開機時掛載的設定檔並加入NFS(只有單機可跳過此步驟)
#vi /etc/fstab
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=78f0f0dc-8a01-4305-800e-2318d0b6d404 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda3 during installation
UUID=935056b3-9324-4f99-8f79-861c9caa35ec /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=54f6f554-c2db-4463-9140-3a559034ac6b none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
Manager Server's_IP:/srv/cloud /srv/cloud nfs defaults 0 0
#mkdir -p /srv/cloud
#mount /srv/cloud
#cd /srv/cloud/one
#ls -al

16) 建立與Front-end(管理Server)相同的帳號在Cluster-Node上(只有單機可跳過此步驟)
#groupadd -g 1001 cloud
#useradd -u 1001 -g cloud -m oneadmin -d /srv/cloud/one -s /bin/bash
#passwd oneadmin
#chown -R oneadmin:cloud /srv/cloud/
#su - oneadmin

17) 將oneadmin加到libvirt群組內(用逗點隔開)
#vi /etc/group
libvirtd:x:125:cycuim,oneadmin

18) 設定允許VNC的IP清單(移掉註解並設為0.0.0.0)
#vi /etc/libvirt/qemu.conf
vnc_listen = "0.0.0.0"

19) 重新啟動libvirt服務並設定Bridge後重啟(br0)
#service libvirt-bin restart
#chown :cloud /var/run/libvirt/libvirt-sock
#vi /etc/network/interfaces
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address Server's_IP
netmask Server's_Mask
network Server's_Network
broadcast Server's_Broadcast
gateway Server's_Gateway
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwaits 0
#/etc/init.d/networking restart

20) 安裝額外方便管理KVM的套件
#apt-get install virt-manager virt-viewer

21) 建立第一個VM(因為oneadmin會使用到/root,所以要設777給/root,建立時依照自己的設定)
#wget http://ftp.isu.edu.tw/pub/Linux/Ubuntu/releases/.pool/ubuntu-11.10-desktop-i386.iso
#chmod -R 777 /root
#virt-install \
--connect qemu:///system \
--name=ub_vm \
--ram=1024 \
--os-type=linux \
--hvm --accelerate \
--cdrom=/root/ubuntu-11.10-desktop-i386.iso \
--file=/root/ub_vm.qcow2 \
--file-size=10 \
--bridge=br0 \
--vnc --noautoconsole --debug

22) 下列為幾種管理VM的工具指令
#virsh list #virsh dumpxml vmid #virsh destroy vmid #virsh start vmname
此時即可透過UltraVNC直接連到該虛擬主機,如下圖所示

 

 

 

 

 

 

 

 

 

 

 
PS) 更改APT套件下載的位置並更新下載清單(ubuntu.stu.edu.tw)
#mv /etc/apt/sources.list /etc/apt/sources.list_bk
#cd /etc/apt
#wget http://iori.tw/sources.list
#apt-get update

剩下Sunstone使用的部分請參考http://simefirmi-work.blogspot.tw/2012/03/opennebulaopennebula-32-install-guide.html的ONE安裝部分PDF第66頁以後即可!

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro