| 11 | | = 【安裝】 = |
| 12 | | == [0. 設備需求] == |
| 13 | | * x86 機器 (單台機器最多 128GB RAM、6 張網卡、32 Cores) (若要使用 windows VM,CPU必須支援 Intel-VTx 或 AMD-V) |
| 14 | | == [1. 檔案下載] == |
| 15 | | 從 Xen 官方網站下載 ISO 檔 [http://www.xen.org/files/XenCloud/Software/latest/main.iso Base Package],安裝路徑有兩種一是燒成 CD 來安裝,二是用 PXE 安裝。若之後只要開啟 Windows VM 只需安裝一片即可,若要開啟 Linux VM 則必須再安裝第2個 [http://www.xen.org/files/XenCloud/Software/latest/ddk.iso Linux Package]。 |
| 16 | | == [2. 安裝程序] == |
| 17 | | * 安裝過程中,可以切換到三個 terminal -> Alt+F1:安裝畫面,Alt+F2:事件log檔,Alt+F3:控制console |
| 18 | | * 安裝 log 可到 /install/tmp/ 查詢 |
| 19 | | * 開機選單也是使用 mboot.c32 |
| 20 | | == [3. 儲存機制] == |
| 21 | | * XCP 提供三種儲存機制: |
| 22 | | 1. local |
| 23 | | 2. NFS |
| 24 | | 3. iSCSI |
| 25 | | == [4. 操作程序] == |
| 26 | | ---- |
| 27 | | = 【DRBL 佈署 XCP】 = |
| 28 | | == [1. 前言] == |
| 29 | | * 因 XCP 提供 PXE 安裝的方式,此部份可與 DRBL 結合 (透過 DRBL 來方便設置 PXE Installation) |
| 30 | | * 官方描述建制 PXE Installation 需要: |
| 31 | | 1. TFTP Server |
| 32 | | 2. DHCP Server |
| 33 | | 3. NFS, FTP, or TFTP Server (放置安裝檔案) |
| 34 | | 4. XML answer file (自動執行 unattended installations) |
| 35 | | 5. 機器必須有支援 PXE 的網卡 |
| 36 | | == [2. 官方設定步驟] == |
| 37 | | === __2.1 設定 TFTP 能支援 PXE 開機__ === |
| 38 | | 1. 需有 SYSLINUX 3.11 以上的版本,從 /usr/lib/syslinux 複製 mboot.c32 和 pxelinux.o 到 tftp 設定的路徑下(這邊是 /tftpboot) |
| 39 | | 2. 從 Base Package 的 /boot 複製 install.img、Vmlinuz 和 xen.gz 到 /tftpboot/xenserver |
| 40 | | 3. 建立 /tftpboot/pxelinux.cfg 資料夾,並開啟一個檔案為 /tftpboot/pxelinux.cfg/default |
| 41 | | {{{ |
| 42 | | $ sudo vim /tftpboot/pxelinux.cfg/default |
| 43 | | default xenserver |
| 44 | | label xenserver |
| 45 | | kernel mboot.c32 |
| 46 | | append /tftpboot/xenserver/xen.gz dom0_mem=752M com1=115200,8n1 \ |
| 47 | | console=com1,tty --- /tftpboot/xenserver/vmlinuz \ |
| 48 | | xencons=hvc console=hvc0 console=tty0 \ |
| 49 | | --- /tftpboot/xenserver/install.img |
| 50 | | }}} |
| 51 | | 4. 上面的安裝程序必須由人來確認每一個步驟,底下可加入 answer file 來做到無人自動安裝 |
| 52 | | {{{ |
| 53 | | # sudo vim /tftpboot/pxelinux.cfg/default |
| 54 | | default xenserver-auto |
| 55 | | label xenserver-auto |
| 56 | | kernel mboot.c32 |
| 57 | | append /tftpboot/xenserver/xen.gz dom0_mem=752M com1=115200,8n1 \ |
| 58 | | console=com1,tty --- /tftpboot/xenserver/vmlinuz \ |
| 59 | | xencons=hvc console=hvc0 console=tty0 \ |
| 60 | | answerfile=http://pxehost.example.com/5.0.0-answerfile \ |
| 61 | | install --- /tftpboot/xenserver/install.img |
| 62 | | }}} |
| 63 | | === __2.2 設定 DHCP__ === |
| 64 | | 1. 安裝 DHCP Server |
| 65 | | 2. 編輯 dhcpd.conf |
| 66 | | {{{ |
| 67 | | $ sudo vim /etc/dhcp/dhcpd.conf |
| 68 | | allow booting; |
| 69 | | allow bootp; |
| 70 | | class "pxeclients" { |
| 71 | | match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; |
| 72 | | next-server ; |
| 73 | | filename "pxelinux.0"; |
| 74 | | } |
| 75 | | }}} |
| 76 | | === __2.3 設定安裝檔案位置__ === |
| 77 | | 1. 可用 http, ftp 和 nfs |
| 78 | | 2. Base package 的 packages.main 目錄複製出來, |
| 79 | | 3. 若要開啟 Linux VM,必須複製 Linux Package 的 packages.linux 目錄出來 |
| 80 | | 4. 將路徑寫於 answaer file (XML 檔) 的 source 標籤內(底下有三種寫法) |
| 81 | | {{{ |
| 82 | | #!sh |
| 83 | | # 安裝 Base 和 Linux Packages |
| 84 | | <source type="url">http://pxehost.example.com/XenServer_5.0.0</source> |
| | 11 | = 【文件】 = |
| | 12 | * [wiki:XCP_installation XCP 安裝] |
| 86 | | # 只安裝 Base Package |
| 87 | | <source type="url"> |
| 88 | | http://pxehost.example.com/XenServer_&PRODUCT_VERSION;/packages.main |
| 89 | | </source> |
| 90 | | |
| 91 | | # 可加上帳密 |
| 92 | | <source type="url"> |
| 93 | | http://<username>:<password>@pxehost.example.com/XenServer_0.1/packages.main |
| 94 | | <source> |
| 95 | | }}} |
| 96 | | === __2.4 Answer File 編輯__ === |
| 97 | | * 範例檔 (一定要有 installation tag) |
| 98 | | {{{ |
| 99 | | #!sh |
| 100 | | <?xml version="1.0"?> |
| 101 | | <installation> |
| 102 | | <primary-disk>sda</primary-disk> |
| 103 | | <guest-disk>sdb</guest-disk> |
| 104 | | <guest-disk>sdc</guest-disk> |
| 105 | | <keymap>us</keymap> |
| 106 | | <root-password>mypassword</root-password> |
| 107 | | <source type="url">http://pxehost.example.com</source> |
| 108 | | <post-install-script type="url"> |
| 109 | | http://pxehost.example.com/myscripts/post-install-script |
| 110 | | </post-install-script> |
| 111 | | <admin-interface name="eth0" proto="dhcp" /> |
| 112 | | <timezone>Europe/London</timezone> |
| 113 | | </installation> |
| 114 | | }}} |
| 115 | | * 範例檔 tag 介紹 |
| 116 | | || 標籤 || 說明 || 是否必要|| |
| 117 | | || <primary-disk> || 要安裝的 storage device,也可以給予 gueststorage 屬性值(yes/no) [[BR]] <rimary-disk gueststorage="no">sda</primary-disk> [[BR]] 此屬性質預設為 yes,之後在 guest-disk 必須給予值 || Y || |
| 118 | | || <guest-disk> || 儲存 guest VM 的印象檔 || N || |
| 119 | | || <keymap> || 安裝時使用的 keymap 一般都是使用美國鍵盤 <keymap>us</keymap> || Y || |
| 120 | | || <root-password> || 設定 root 密碼 || Y || |
| 121 | | || <source> || packages 的安裝路徑,屬性值有 url, nfs 或 local: [[BR]] <source type="url"> [[BR]] !http://server/packages [[BR]] </source> [[BR]] <source type="local" /> [[BR]] <source type="nfs"> [[BR]] server:packages [[BR]] </source> || Y || |
| 122 | | || <driver-source> || 安裝設備的 driver 套件路徑,屬性值有 url, nfs 或 local: [[BR]] <driver-source type="url"> [[BR]] !http://server/drivers [[BR]] </driver-source> [[BR]] <driver-source type="local" /> [[BR]] <driver-source type="nfs"> [[BR]] server:drivers [[BR]] </driver-source> || N || |
| 123 | | || <post-install-script> || post-install-script 的路徑,屬性值有 url, nfs 或 local: [[BR]] <post-install-script type="url"> [[BR]] !http://server/scripts [[BR]] </post-install-script> [[BR]] <post-install-script type="local" /> [[BR]] <post-install-script type="nfs"> [[BR]] server:scripts [[BR]] </post-install-script>|| Y || |
| 124 | | || <admin-interface> || 需要使用的網路設備,屬性值有 proto:dhcp或static, name:eth0,當 proto="static" 時的子屬性值有 [[BR]] <ip> <subnet-mask> <gateway> || N || |
| 125 | | || <time_zone> || TZ 變數 ex. Europe/London, or America/Los_Angeles || Y || |
| 126 | | || <name_server> || 可設定己組的 name server || N || |
| 127 | | || <hostname> || 主機名稱 || N || |
| 128 | | || <bootloader> || 可指定要安裝那種 bootloader (目前有兩個有選,預設是 extlinux 和 grub) || N || |
| 129 | | * 也可透過 answer file 來做到自動更新 (需設定 reinstall 和 existing-installation) |
| 130 | | {{{ |
| 131 | | #!sh |
| 132 | | <?xml version="1.0"?> |
| 133 | | <installation mode="reinstall"> |
| 134 | | <existing-installation>sda</existing-installation> |
| 135 | | <keymap>us</keymap> |
| 136 | | <root-password>mypassword</root-password> |
| 137 | | <source type="url">http://pxehost.example.com</source> |
| 138 | | <post-install-script type="url"> |
| 139 | | http://pxehost.example.com/myscripts/post-install-script |
| 140 | | </post-install-script> |
| 141 | | <admin-interface name="eth0" proto="dhcp" /> |
| 142 | | <timezone>Europe/London</timezone> |
| 143 | | </installation> |
| 144 | | }}} |
| 145 | | |
| 146 | | == [2. DRBL 設定步驟] == |