| | 1 | = Integrate Xen and Lustre on CentOS 5.1 = |
| | 2 | == 1. 簡介 == |
| | 3 | * 目標 : [[BR]] |
| | 4 | 編譯具有 lustre 與 Xen 功能的 CentOS 5.1 核心。 |
| | 5 | * 方法 : [[BR]] |
| | 6 | 無論是 lustre 或是 Xen,之前我們安裝的作法大都是使用 rpm 或是 yum 的存藏庫中所提供編譯好的套件安裝,目前並沒有同時編譯好兩者的 rpm 檔可供直接安裝,因此我們的作法是採用 lustre 跟 Xen 的 tar ball source code,再互相 patch,進而編譯成同時具有 lustre 與 Xen 功能的核心。 |
| | 7 | == 2. 編譯步驟 == |
| | 8 | === 2.1 使用 yum 安裝所需要的套件 : === |
| | 9 | * 2.1.1 '''gcc''' |
| | 10 | * 2.1.2 '''openssl-devel''' |
| | 11 | * 2.1.3 '''zlib-devel''' |
| | 12 | * 2.1.4 '''python-devel''' |
| | 13 | * 2.1.5 '''libX11-devel''' |
| | 14 | * 2.1.6 '''ncurses-devel''' |
| | 15 | * 2.1.7 '''diffstat''' |
| | 16 | * 2.1.8 '''rpm-build''' |
| | 17 | {{{ |
| | 18 | [root@lustre_xen ~]# yum install gcc openssl-devel zlib-devel python-devel libX11-devel ncurses-devel diffstat rpm-build |
| | 19 | }}} |
| | 20 | === 2.2 下載所需要的檔案 : === |
| | 21 | * 2.2.1 '''lustre-1.6.5'''[[BR]] |
| | 22 | Lustre 自從被 Sun 公司所併購之後,目前最新的套件必須先至 Sun 的網站免費註冊之後才可下載,[http://www.sun.com/software/products/lustre/get.jsp 前往下載]。以 lustre-1.6.5 為例,檔案名稱為 lustre-1.6.5.tar.gz。 |
| | 23 | {{{ |
| | 24 | [root@lustre_xen ~] tar -zxvf lustre-1.6.5.tar.gz |
| | 25 | }}} |
| | 26 | * 2.2.2 '''xen-3.2.1''' |
| | 27 | {{{ |
| | 28 | [root@lustre_xen ~] wget http://bits.xensource.com/oss-xen/release/3.2.1/xen-3.2.1.tar.gz |
| | 29 | [root@lustre_xen ~] tar -zxvf xen-3.2.1.tar.gz -C /usr/src/ |
| | 30 | }}} |
| | 31 | * 2.2.3 '''mercurial''' |
| | 32 | {{{ |
| | 33 | [root@lustre_xen ~] wget ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/mercurial-1.0-2.el5.kb.i386.rpm |
| | 34 | [root@lustre_xen ~] rpm -ivh mercurial-1.0-2.el5.kb.i386.rpm |
| | 35 | }}} |
| | 36 | * 2.2.4 '''quilt''' |
| | 37 | {{{ |
| | 38 | [root@lustre_xen ~] wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/5/i386/quilt-0.46-1.el5.i386.rpm |
| | 39 | [root@lustre_xen ~] rpm -ivh quilt-0.46-1.el5.i386.rpm |
| | 40 | }}} |
| | 41 | === 2.3 使用 lustre 提供的 patch 檔來 patch Xen 的原始碼並且編譯 Xen 的模組 === |
| | 42 | * 2.3.1 下載最新的 Xen kernel 原始檔 |
| | 43 | {{{ |
| | 44 | [root@lustre-xen ~]# cd /usr/src/ |
| | 45 | [root@lustre-xen src] hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg |
| | 46 | }}} |
| | 47 | * 2.3.2 使用 lustre patch Xen 的 kernel files |
| | 48 | {{{ |
| | 49 | [root@lustre-xen src]# cd linux-2.6.18-xen.hg/ |
| | 50 | [root@lustre-xen linux-2.6.18-xen.hg]# ln -s ~/lustre-1.6.5/lustre/kernel_patches/patches/ . |
| | 51 | [root@lustre-xen linux-2.6.18-xen.hg]# ln -s ~/lustre-1.6.5/lustre/kernel_patches/series/2.6.18-vanilla.series series |
| | 52 | [root@lustre-xen linux-2.6.18-xen.hg]# quilt push -va |
| | 53 | }}} |
| | 54 | * 2.3.3 編譯 Xen 的 kernel |
| | 55 | {{{ |
| | 56 | [root@lustre-xen linux-2.6.18-xen.hg]# cd ../xen-3.2.1/ |
| | 57 | [root@lustre-xen xen-3.2.1]# make world |
| | 58 | [root@lustre-xen xen-3.2.1]# make install |
| | 59 | [root@lustre-xen xen-3.2.1]# mkinitrd /boot/initrd-2.6.18.8-xen.img 2.6.18.8-xen |
| | 60 | }}} |
| | 61 | * 2.3.4 修改開機 grub 檔案如下 |
| | 62 | {{{ |
| | 63 | # grub.conf generated by anaconda |
| | 64 | # |
| | 65 | # Note that you do not have to rerun grub after making changes to this file |
| | 66 | # NOTICE: You have a /boot partition. This means that |
| | 67 | # all kernel and initrd paths are relative to /boot/, eg. |
| | 68 | # root (hd0,0) |
| | 69 | # kernel /vmlinuz-version ro root=/dev/sda2 |
| | 70 | # initrd /initrd-version.img |
| | 71 | #boot=/dev/sda |
| | 72 | default=0 |
| | 73 | timeout=5 |
| | 74 | splashimage=(hd0,0)/grub/splash.xpm.gz |
| | 75 | hiddenmenu |
| | 76 | title CentOS (2.6.18.8-xen) |
| | 77 | root (hd0,0) |
| | 78 | kernel /xen-3.2.1.gz |
| | 79 | module /vmlinuz-2.6.18.8-xen ro root=LABEL=/1 rhgb quiet |
| | 80 | module /initrd-2.6.18.8-xen.img |
| | 81 | title CentOS (2.6.18-53.el5) |
| | 82 | root (hd0,0) |
| | 83 | kernel /vmlinuz-2.6.18-53.el5 ro root=LABEL=/1 rhgb quiet |
| | 84 | initrd /initrd-2.6.18-53.el5.img |
| | 85 | }}} |
| | 86 | * 2.3.5 重新開機,並且預設使用新的 xen kernel 開機 |
| | 87 | {{{ |
| | 88 | [root@lustre-xen xen-3.2.1]# reboot |
| | 89 | }}} |
| | 90 | * 2.3.6 編譯新的 module 供 lustre 使用 |
| | 91 | {{{ |
| | 92 | [root@lustre-xen ~]# cd /usr/src/linux-2.6.18-xen.hg/ |
| | 93 | [root@lustre-xen linux-2.6.18-xen.hg]# make |
| | 94 | [root@lustre-xen linux-2.6.18-xen.hg]# make install |
| | 95 | [root@lustre-xen linux-2.6.18-xen.hg]# make modules_install |
| | 96 | [root@lustre-xen linux-2.6.18-xen.hg]# cp -rf /lib/modules/2.6.18.8-xen /lib/modules/2.6.18.8 |
| | 97 | [root@lustre-xen linux-2.6.18-xen.hg]# mkinitrd /boot/initrd-2.6.18.8.img 2.6.18.8 |
| | 98 | }}} |
| | 99 | * 2.3.7 再次修改開機 grub 檔案如下 |
| | 100 | {{{ |
| | 101 | [root@lustre-xen linux-2.6.18-xen.hg]# cat /boot/grub/menu.lst |
| | 102 | # grub.conf generated by anaconda |
| | 103 | # |
| | 104 | # Note that you do not have to rerun grub after making changes to this file |
| | 105 | # NOTICE: You have a /boot partition. This means that |
| | 106 | # all kernel and initrd paths are relative to /boot/, eg. |
| | 107 | # root (hd0,0) |
| | 108 | # kernel /vmlinuz-version ro root=/dev/sda2 |
| | 109 | # initrd /initrd-version.img |
| | 110 | #boot=/dev/sda |
| | 111 | default=0 |
| | 112 | timeout=5 |
| | 113 | splashimage=(hd0,0)/grub/splash.xpm.gz |
| | 114 | hiddenmenu |
| | 115 | title CentOS (2.6.18.8) |
| | 116 | root (hd0,0) |
| | 117 | kernel /xen-3.2.1.gz |
| | 118 | module /vmlinuz-2.6.18.8 ro root=LABEL=/1 rhgb quiet |
| | 119 | module /initrd-2.6.18.8.img |
| | 120 | title CentOS (2.6.18.8-xen) |
| | 121 | root (hd0,0) |
| | 122 | kernel /xen-3.2.1.gz |
| | 123 | module /vmlinuz-2.6.18.8-xen ro root=LABEL=/1 rhgb quiet |
| | 124 | module /initrd-2.6.18.8-xen.img |
| | 125 | title CentOS (2.6.18-53.el5) |
| | 126 | root (hd0,0) |
| | 127 | kernel /vmlinuz-2.6.18-53.el5 ro root=LABEL=/1 rhgb quiet |
| | 128 | initrd /initrd-2.6.18-53.el5.img |
| | 129 | }}} |
| | 130 | * 2.3.8 再次重新開機,並且預設使用新的 xen kernel 開機 |
| | 131 | {{{ |
| | 132 | [root@lustre-xen linux-2.6.18-xen.hg]# reboot |
| | 133 | }}} |
| | 134 | === 2.4 編譯並安裝 lustre === |
| | 135 | {{{ |
| | 136 | [root@lustre-xen ~]# cd lustre-1.6.5 |
| | 137 | [root@lustre-xen lustre-1.6.5]# ./configure --with-linux=/usr/src/linux-2.6.18-xen.hg/ |
| | 138 | [root@lustre-xen lustre-1.6.5]# make |
| | 139 | [root@lustre-xen lustre-1.6.5]# make isntall |
| | 140 | [root@lustre-xen lustre-1.6.5]# depmod -a |
| | 141 | }}} |
| | 142 | == 3. 完成 == |
| | 143 | === 3.1 簡單測試 === |
| | 144 | 檢查有無 mkfs.lustre 這個命令,並且執行 modprobe ldiskfs 以確認模組 ldiskfs 已經正確安裝完成。 |