[[PageOutline]]
{{{
#!html
XCP 安裝
}}}
----
= 【前言】 =
== [0. 設備需求] ==
* x86 機器 (單台機器最多 128GB RAM、6 張網卡、32 Cores) (若要使用 windows VM,CPU必須支援 Intel-VTx 或 AMD-V)
== [1. 檔案下載] ==
從 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]。
== [2. 安裝程序] ==
* 安裝過程中,可以切換到三個 terminal -> Alt+F1:安裝畫面,Alt+F2:事件log檔,Alt+F3:控制console
* 安裝 log 可到 /install/tmp/ 查詢
* 開機選單也是使用 mboot.c32
== [3. 儲存機制] ==
* XCP 提供三種儲存機制:
1. local
2. NFS
3. iSCSI
== [4. 操作程序] ==
----
= 【利用 PXE 佈署 XCP】 =
== [1. 前言] ==
* 因 XCP 提供 PXE 安裝的方式,此部份可與 DRBL 結合 (透過 DRBL 來方便設置 PXE Installation)
* 官方描述建制 PXE Installation 需要:
1. TFTP Server
2. DHCP Server
3. NFS, FTP, or TFTP Server (放置安裝檔案)
4. XML answer file (自動執行 unattended installations)
5. 機器必須有支援 PXE 的網卡
== [2. 官方設定步驟] ==
=== __2.1 設定 TFTP 能支援 PXE 開機__ ===
1. 需有 SYSLINUX 3.11 以上的版本,從 /usr/lib/syslinux 複製 mboot.c32 和 pxelinux.o 到 tftp 設定的路徑下(這邊是 /tftpboot)
2. 從 Base Package 的 /boot 複製 install.img、Vmlinuz 和 xen.gz 到 /tftpboot/xenserver
3. 建立 /tftpboot/pxelinux.cfg 資料夾,並開啟一個檔案為 /tftpboot/pxelinux.cfg/default
{{{
$ sudo vim /tftpboot/pxelinux.cfg/default
default xenserver
label xenserver
kernel mboot.c32
append /tftpboot/xenserver/xen.gz dom0_mem=752M com1=115200,8n1 \
console=com1,tty --- /tftpboot/xenserver/vmlinuz \
xencons=hvc console=hvc0 console=tty0 \
--- /tftpboot/xenserver/install.img
}}}
4. 上面的安裝程序必須由人來確認每一個步驟,底下可加入 answer file 來做到無人自動安裝
{{{
# sudo vim /tftpboot/pxelinux.cfg/default
default xenserver-auto
label xenserver-auto
kernel mboot.c32
append /tftpboot/xenserver/xen.gz dom0_mem=752M com1=115200,8n1 \
console=com1,tty --- /tftpboot/xenserver/vmlinuz \
xencons=hvc console=hvc0 console=tty0 \
answerfile=http://pxehost.example.com/5.0.0-answerfile \
install --- /tftpboot/xenserver/install.img
}}}
=== __2.2 設定 DHCP__ ===
1. 安裝 DHCP Server
2. 編輯 dhcpd.conf
{{{
$ sudo vim /etc/dhcp/dhcpd.conf
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server ;
filename "pxelinux.0";
}
}}}
=== __2.3 設定安裝檔案位置__ ===
1. 可用 http, ftp 和 nfs
2. Base package 的 packages.main 目錄複製出來,
3. 若要開啟 Linux VM,必須複製 Linux Package 的 packages.linux 目錄出來
4. 將路徑寫於 answaer file (XML 檔) 的 source 標籤內(底下有三種寫法)
{{{
#!sh
# 安裝 Base 和 Linux Packages
http://pxehost.example.com/XenServer_5.0.0
# 只安裝 Base Package
http://pxehost.example.com/XenServer_&PRODUCT_VERSION;/packages.main
# 可加上帳密
http://:@pxehost.example.com/XenServer_0.1/packages.main
}}}
=== __2.4 Answer File 編輯__ ===
* 範例檔 (一定要有 installation tag)
{{{
#!sh
sda
sdb
sdc
us
mypassword
http://pxehost.example.com
http://pxehost.example.com/myscripts/post-install-script
Europe/London
}}}
* 範例檔 tag 介紹
|| 標籤 || 說明 || 是否必要||
|| || 要安裝的 storage device,也可以給予 gueststorage 屬性值(yes/no) [[BR]] sda [[BR]] 此屬性質預設為 yes,之後在 guest-disk 必須給予值 || Y ||
|| || 儲存 guest VM 的印象檔 || N ||
|| || 安裝時使用的 keymap 一般都是使用美國鍵盤 us || Y ||
|| || 設定 root 密碼 || Y ||
|| || packages 的安裝路徑,屬性值有 url, nfs 或 local: [[BR]] [[BR]] !http://server/packages [[BR]] [[BR]] [[BR]] [[BR]] server:packages [[BR]] || Y ||
|| || 安裝設備的 driver 套件路徑,屬性值有 url, nfs 或 local: [[BR]] [[BR]] !http://server/drivers [[BR]] [[BR]] [[BR]] [[BR]] server:drivers [[BR]] || N ||
|| || post-install-script 的路徑,屬性值有 url, nfs 或 local: [[BR]] [[BR]] !http://server/scripts [[BR]] [[BR]] [[BR]] [[BR]] server:scripts [[BR]] || Y ||
|| || 需要使用的網路設備,屬性值有 proto:dhcp或static, name:eth0,當 proto="static" 時的子屬性值有 [[BR]] || N ||
|| || TZ 變數 ex. Europe/London, or America/Los_Angeles || Y ||
|| || 可設定己組的 name server || N ||
|| || 主機名稱 || N ||
|| || 可指定要安裝那種 bootloader (目前有兩個有選,預設是 extlinux 和 grub) || N ||
* 也可透過 answer file 來做到自動更新 (需設定 reinstall 和 existing-installation)
{{{
#!sh
sda
us
mypassword
http://pxehost.example.com
http://pxehost.example.com/myscripts/post-install-script
Europe/London
}}}
----
= 【利用 DRBL 佈署 XCP】 =