8 | | || || '''CPU''' ||'''OS''' || '''KVM''' || |
9 | | || '''Version''' || Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz || Debian GNU/Linux testing (squeeze) (64bit)|| 72+dfsg-5+squeeze1 || |
10 | | * 因 Debian 官方有維護 KVM 的套件,考慮穩定性可使用 Debian 的 KVM 套件,若想使用最新版本的 KVM ,則需自行[http://www.linux-kvm.org/page/Downloads 下載編譯] |
11 | | * Debian 的 Kernel 本身已有 KVM Kernel Module,因此只需安裝 KVM 即可。 |
12 | | ---- |
13 | | = 【安裝】 = |
| 8 | * 硬體資源 |
| 9 | || || '''CPU''' ||'''Memory''' || '''Disk''' || |
| 10 | || '''Version''' || Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz || 8GB || 1TB || |
| 11 | * 軟體資源 |
| 12 | || Host/dom0 OS || Debian GNU/Linux testing (squeeze) (64bit) || |
| 13 | || KVM || 72+dfsg-5+squeeze1 || |
| 14 | || VM/Guest/dmoU OS || MS Windows XP & Debian lenny (AMD64) || |
| 15 | || !OpenNebula || 1.4.0 || |
| 16 | ---- |
| 17 | = 【Step 1: 檢查 KVM 及其所需要環境】 = |
34 | | * 載入 KVM module for AMD Chip |
35 | | {{{ |
36 | | $ sudo modprobe kvm-amd |
| 39 | ---- |
| 40 | = 【Step 2: 安裝 OpenNebula 及其所需要的套件】 = |
| 41 | * '''pcX''' 和 '''pcY''' 須安裝相關套件 |
| 42 | {{{ |
| 43 | $ sudo aptitude install g++ ruby libsqlite3-0 sqlite3 libsqlite3-dev \ |
| 44 | libsqlite3-ruby libxmlrpc-c3-dev libxmlrpc-c3 libssl-dev scons |
| 45 | }}} |
| 46 | ---- |
| 47 | = 【Step 3: 下載並安裝OpenNEbula】 = |
| 48 | * 在 pcX 上執行 (OpenNEbula 只需安裝在 pcX 上) |
| 49 | * 下載 source code |
| 50 | {{{ |
| 51 | $ cd |
| 52 | $ wget http://dev.opennebula.org/attachments/download/103/one-1.4.0.tar.gz |
| 53 | $ tar zxvf one-1.4.0.tar.gz |
| 54 | }}} |
| 55 | * 編譯和安裝 OpenNEbula |
| 56 | {{{ |
| 57 | $ cd one-1.4 |
| 58 | $ sudo scons |
| 59 | $ sudo mkdir /home/one |
| 60 | $ sudo ./install.sh -d /home/one |
| 61 | }}} |
| 62 | * 編輯 OpenNEbula 路徑 |
| 63 | {{{ |
| 64 | $ sudo su |
| 65 | |
| 66 | # echo export ONE_LOCATION=/home/one >> ~/.bashrc |
| 67 | # echo export ONE_XMLRPC="http://localhost:2633/RPC2" >> ~/.bashrc |
| 68 | # echo export PATH='$ONE_LOCATION/bin:$PATH' >> ~/.bashrc |
| 69 | # echo export ONE_AUTH=/home/one/.one/one_auth >> ~/.bashrc |
| 70 | |
| 71 | # mkdir /home/one/.one |
| 72 | # echo "root:cloud123" >> /home/one/.one/one_auth |
| 73 | |
| 74 | # source ~/.bashrc |
| 75 | # echo $ONE_AUTH |
| 76 | (測試 $ONE_AUTH 路徑是否存在) |
| 77 | |
| 78 | # echo $ONE_LOCATION |
| 79 | (測試 $ONE_LOCATION 路徑是否存在) |
| 80 | }}} |
| 81 | ---- |
| 82 | = 【Step 4: 編輯 ONE 設定檔】 = |
| 83 | * 在 pcX 上編輯,將 151~154 行註解掉,打開 159~162 行 |
| 84 | {{{ |
| 85 | # cd /home/one |
| 86 | # gedit etc/oned.conf |
| 87 | }}} |
| 88 | {{{ |
| 89 | #!sh |
| 90 | 21 HOST_MONITORING_INTERVAL = 5 |
| 91 | 23 VM_POLLING_INTERVAL = 10 |
| 92 | |
| 93 | 62 IM_MAD = [ |
| 94 | 63 name = "im_xen", |
| 95 | 64 executable = "one_im_ssh", |
| 96 | 65 arguments = "im_xen/im_xen.conf" ] |
| 97 | |
| 98 | 70 #IM_MAD = [ |
| 99 | 71 # name = "im_kvm", |
| 100 | 72 # executable = "one_im_ssh", |
| 101 | 73 # arguments = "im_kvm/im_kvm.conf" ] |
| 102 | |
| 103 | 106 VM_MAD = [ |
| 104 | 107 name = "vmm_xen", |
| 105 | 108 executable = "one_vmm_xen", |
| 106 | 109 default = "vmm_xen/vmm_xen.conf", |
| 107 | 110 type = "xen" ] |
| 108 | |
| 109 | 115 #VM_MAD = [ |
| 110 | 116 # name = "vmm_kvm", |
| 111 | 117 # executable = "one_vmm_kvm", |
| 112 | 118 # default = "vmm_kvm/vmm_kvm.conf", |
| 113 | 119 # type = "kvm" ] |
| 114 | |
| 115 | 151 # TM_MAD = [ |
| 116 | 152 # name = "tm_ssh", |
| 117 | 153 # executable = "one_tm", |
| 118 | 154 # arguments = "tm_ssh/tm_ssh.conf" ] |
| 119 | |
| 120 | 159 TM_MAD = [ |
| 121 | 160 name = "tm_nfs", |
| 122 | 161 executable = "one_tm", |
| 123 | 162 arguments = "tm_nfs/tm_nfs.conf" ] |
| 127 | ---- |
| 128 | = 【Step 5: 啟動 ONE】 = |
| 129 | * 啟動 ONE 前的小叮嚀: |
| 130 | 1. 確認 pcXXX 和 pcYYY 已執行 '''xend start''' |
| 131 | 2. 兩台都可讓 '''root 免密碼 ssh 登入''' |
| 132 | {{{ |
| 133 | // pcX (Server) 上執行 |
| 134 | # ssh-keygen |
| 135 | # cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys |
| 136 | # scp -r ~/.ssh pcY:~ |
| 137 | |
| 138 | //測試 ssh免密碼登入 |
| 139 | ssh pcYYY |
| 140 | [CTRL+D] |
| 141 | }}} |
| 142 | 3. 只需在 '''pcX''' 啟動 ONE 即可 |
| 143 | * 在 pcX 上執行 |
| 144 | {{{ |
| 145 | # one start |
| 146 | }}} |
| 147 | ---- |
| 148 | = 【Step 6: 新增 pcX 和 pcY 到 ONE Pool】 = |
| 149 | * 在 pcX 上執行 (__X 和 Y 請自行修改成自己的電腦名稱__) |
| 150 | {{{ |
| 151 | # onehost add pcXXX im_xen vmm_xen tm_nfs |
| 152 | # onehost add pcYYY im_xen vmm_xen tm_nfs |
| 153 | |
| 154 | # onehost list |
| 155 | HID NAME RVM TCPU FCPU ACPU TMEM FMEM STAT |
| 156 | 1 pcXXX 0 400 399 400 1313856 0 on |
| 157 | 2 pcYYY 0 400 399 400 1313856 0 on |
| 158 | |
| 159 | # onehost show pcXXX |
| 160 | }}} |
| 161 | * '''''onehost list'''''參數說明 |
| 162 | * RVM - Number of running VMs |
| 163 | * TCPU - Total CPU |
| 164 | * FCPU - Free CPU |
| 165 | * ACPU - Available CPU (not allocated by VMs) |
| 166 | * TMEM - Total Memory |
| 167 | * FMEM - Free Memory |
| 168 | ---- |
| 169 | = 【Step 7: 使用 ONE 來開啟 VM】 = |
| 170 | * 在 pcXXX 上執行 |
| 171 | * 編輯 vm01 的設定檔 (__X 和 Y 請自行修改成自己的電腦名稱__) |
| 172 | {{{ |
| 173 | # cd /home/domains |
| 174 | # gedit vm01.one |
| 175 | }}} |
| 176 | {{{ |
| 177 | #!sh |
| 178 | NAME = vm01 |
| 179 | CPU = 1 |
| 180 | MEMORY = 128 |
| 181 | OS = [ kernel = /boot/vmlinuz-2.6.26-2-xen-amd64, |
| 182 | initrd = /boot/initrd.img-2.6.26-2-xen-amd64, |
| 183 | root = sda2] |
| 184 | DISK = [ source = /home/domains/vm01/disk.img, |
| 185 | clone = no, |
| 186 | target = sda2, |
| 187 | readonly = no] |
| 188 | DISK = [ type = swap, |
| 189 | size = 128, |
| 190 | target = "sda1", |
| 191 | readonly = "no" ] |
| 192 | NIC=[IP="192.168.1.X", MAC="00:16:00:00:00:XX"] |
| 193 | }}} |
| 194 | * 使用 ONE 來開啟 vm01 |
| 195 | {{{ |
| 196 | # onevm create vm01.one ; onevm deploy vm01 pcXXX |
| 197 | |
| 198 | # onevm list |
| 199 | ID NAME STAT CPU MEM HOSTNAME TIME |
| 200 | 1 vm01 runn 0 131072 pcXXX 00 00:04:21 |
| 201 | |
| 202 | # onevm show vm01 |
| 203 | }}} |
| 204 | * onevm list 的資訊 |
| 205 | * ID ONE VM identifier |
| 206 | * NAME Name of the ONE |
| 207 | * STAT Status of the VM |
| 208 | * CPU CPU percentage used by the VM |
| 209 | * MEM Memory used by the VM |
| 210 | * HOSTNAME Host where the VM is being or was run |
| 211 | * TIME Time since the submission of the VM (days hours:minutes:seconds |
| 212 | |