Whamcloud - gitweb
FIX: proofed against origional
[doc/manual.git] / InstallingLustreFromSourceCode.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <chapter version="5.0" xml:lang="en-US" xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" xml:id='installinglustrefromsourcecode'>
3   <info>
4     <title xml:id='installinglustrefromsourcecode.title'>Installing Lustre from Source Code</title>
5   </info>
6   <para>If you need to build a customized Lustre server kernel or are using a Linux kernel that has not been tested with the version of Lustre you are installing, you may need to build and install Lustre from source code. This chapter describes:</para>
7
8   <itemizedlist><listitem>
9       <para><xref linkend="dbdoclet.50438210_69313"/></para>
10     </listitem>
11
12 <listitem>
13       <para><xref linkend="dbdoclet.50438210_65411"/></para>
14     </listitem>
15
16 <listitem>
17       <para><xref linkend="dbdoclet.50438210_47529"/></para>
18     </listitem>
19
20 <listitem>
21       <para><xref linkend="dbdoclet.50438210_27248"/></para>
22     </listitem>
23
24 </itemizedlist>
25
26     <section xml:id="dbdoclet.50438210_69313">
27       <title>29.1 Overview and Prerequisites</title>
28       <para>Lustre can be installed from either pre-built binary packages (RPMs) or freely-available source code. Installing from the package release is recommended unless you need to customize the Lustre server kernel or will be using an Linux kernel that has not been tested with Lustre. For a list of supported Linux distributions and architectures, see the topic <link xl:href="http://wiki.lustre.org/index.php/Lustre_2.0">Lustre_2.0</link> on the Lustre wiki. The procedure for installing Lustre from RPMs is describe in <link xl:href="InstallingLustre.html#50438261_81829">Chapter 8</link>: <link xl:href="InstallingLustre.html#50438261_62973">Installing the Lustre Software</link>.</para>
29       <para>To install Lustre from source code, the following are required:</para>
30       <itemizedlist><listitem>
31           <para> Linux kernel patched with Lustre-specific patches</para>
32         </listitem>
33
34 <listitem>
35           <para> Lustre modules compiled for the Linux kernel</para>
36         </listitem>
37
38 <listitem>
39           <para> Lustre utilities required for Lustre configuration</para>
40         </listitem>
41
42 </itemizedlist>
43       <para>The installation procedure involves several steps:</para>
44       <itemizedlist><listitem>
45           <para> Patching the core kernel</para>
46         </listitem>
47
48 <listitem>
49           <para> Configuring the kernel to work with Lustre</para>
50         </listitem>
51
52 <listitem>
53           <para> Creating Lustre and kernel RPMs from source code.</para>
54         </listitem>
55
56 </itemizedlist>
57               <note><para>When using third-party network hardware with Lustre, the third-party modules (typically, the drivers) must be linked against the Linux kernel. The LNET modules in Lustre also need these references. To meet these requirements, a specific process must be followed to install and recompile Lustre. See <link xl:href="InstallingLustrefrSourceCode.html#50438210_27248">Installing Lustre with a Third-Party Network Stack</link>, for an example showing how to install Lustre 1.6.6 using the Myricom MX 1.2.7 driver. The same process can be used for other third-party network stacks.</para></note>
58     </section>
59     <section xml:id="dbdoclet.50438210_65411">
60       <title>29.2 Patching the Kernel</title>
61       <para>If you are using non-standard hardware, plan to apply a Lustre patch, or have another reason not to use packaged Lustre binaries, you have to apply several Lustre patches to the core kernel and run the Lustre configure script against the kernel.</para>
62       <section remap="h3">
63         <title>29.2.1 Introducing the Quilt Utility</title>
64         <para>To simplify the process of applying Lustre patches to the kernel, we recommend that you use the Quilt utility.</para>
65         <para>Quilt manages a stack of patches on a single source tree. A series file lists the patch files and the order in which they are applied. Patches are applied, incrementally, on the base tree and all preceding patches. You can:</para>
66         <itemizedlist><listitem>
67             <para> Apply patches from the stack (quilt push)</para>
68           </listitem>
69
70 <listitem>
71             <para> Remove patches from the stack (quilt pop)</para>
72           </listitem>
73
74 <listitem>
75             <para> Query the contents of the series file (quilt series), the contents of the stack (quilt applied, quilt previous, quilt top), and the patches that are not applied at a particular moment (quilt next, quilt unapplied).</para>
76           </listitem>
77
78 <listitem>
79             <para> Edit and refresh (update) patches with Quilt, as well as revert inadvertent changes, and fork or clone patches and show the diffs before and after work.</para>
80           </listitem>
81
82 </itemizedlist>
83         <para>A variety of Quilt packages (RPMs, SRPMs and tarballs) are available from various sources. Use the most recent version you can find. Quilt depends on several other utilities, e.g., the coreutils RPM that is only available in RedHat 9. For other RedHat kernels, you have to get the required packages to successfully install Quilt. If you cannot locate a Quilt package or fulfill its dependencies, you can build Quilt from a tarball, available at the Quilt project website:</para>
84         <para><link xl:href="http://savannah.nongnu.org/projects/quilt">http://savannah.nongnu.org/projects/quilt</link></para>
85         <para>For additional information on using Quilt, including its commands, see <link xl:href="http://www.suse.de/~agruen/quilt.pdf">Introduction to Quilt</link> and the <link xl:href="http://linux.die.net/man/1/quilt">quilt(1) man page.</link></para>
86       </section>
87       <section remap="h3">
88         <title>29.2.2 <anchor xml:id="dbdoclet.50438210_44148" xreflabel=""/>Get the Lustre Source and Unpatched Kernel</title>
89         <para>The Lustre Engineering Team has targeted several Linux kernels for use with Lustre servers (MDS/OSS) and provides a series of patches for each one. The Lustre patches are maintained in the kernel_patch directory bundled with the Lustre source code.</para>
90
91                 <caution><para>Lustre contains kernel modifications which interact with storage devices and may introduce security issues and data loss if not installed, configured and administered correctly. Before installing Lustre, be cautious and back up ALL data.</para></caution>
92                 <note><para>Each patch series has been tailored to a specific kernel version, and may or may not apply cleanly to other versions of the kernel.</para></note>
93         <para>To obtain the Lustre source and unpatched kernel:</para>
94         <orderedlist><listitem>
95         <para>Verify that all of the Lustre installation requirements have been met.</para>
96         <para>For more information on these prerequisites, see:</para>
97         <itemizedlist><listitem>
98             <para> Hardware requirements in <link xl:href="SettingUpLustreSystem.html#50438256_38751">Chapter 5</link>: <link xl:href="SettingUpLustreSystem.html#50438256_66186">Setting Up a Lustre File System</link></para>
99           </listitem>
100
101 <listitem>
102             <para> Software and environmental requirements in <link xl:href="InstallingLustre.html#50438261_99193">Preparing to Install the Lustre Software</link></para>
103           </listitem>
104
105 </itemizedlist>
106
107         </listitem><listitem>
108         <para>Download the Lustre source code.</para>
109         <para>On the <link xl:href="http://www.oracle.com/technetwork/indexes/downloads/sun-az-index-095901.html#L">Lustre download site</link>, select a version of Lustre to download and then select 'Source' as the platform.</para>
110         </listitem><listitem>
111         <para>Download the unpatched kernel.</para>
112         <para>For convenience, Oracle maintains an archive of unpatched kernel sources at:</para>
113         <para><link xl:href="http://downloads.lustre.org/public/kernels/">http://downloads.lustre.org/public/kernels/</link><anchor xml:id="dbdoclet.50438210_28487" xreflabel=""/></para>
114 </listitem></orderedlist>
115       </section>
116       <section remap="h3">
117         <title>29.2.3 Patch the Kernel</title>
118         <para>This procedure describes how to use Quilt to apply the Lustre patches to the kernel. To illustrate the steps in this procedure, a RHEL 5 kernel is patched for Lustre 1.6.5.1.</para>
119         <orderedlist><listitem>
120         <para>Unpack the Lustre source and kernel to separate source trees.</para>
121         <orderedlist><listitem>
122         <para>Unpack the Lustre source.</para>
123         <para>For this procedure, we assume that the resulting source tree is in /tmp/lustre-1.6.5.1</para>
124         </listitem><listitem>
125         <para>Unpack the kernel.</para>
126         <para>For this procedure, we assume that the resulting source tree (also known as the destination tree) is in /tmp/kernels/linux-2.6.18</para>
127         </listitem></orderedlist>
128         </listitem><listitem>
129         <para>Select a config file for your kernel, located in the kernel_configs directory (lustre/kernel_patches/kernel_config).</para>
130         <para>The kernel_config directory contains the .config files, which are named to indicate the kernel and architecture with which they are associated. For example, the configuration file for the 2.6.18 kernel shipped with RHEL 5 (suitable for i686 SMP systems) is kernel-2.6.18-2.6-rhel5-i686-smp.config.</para>
131         </listitem><listitem>
132         <para>Select the series file for your kernel, located in the series directory (lustre/kernel_patches/series).</para>
133         <para>The series file contains the patches that need to be applied to the kernel.</para>
134         </listitem><listitem>
135         <para>Set up the necessary symlinks between the kernel patches and the Lustre source.</para>
136         <para>This example assumes that the Lustre source files are unpacked under /tmp/lustre-1.6.5.1 and you have chosen the 2.6-rhel5.series file). Run:</para>
137         <screen>$ cd /tmp/kernels/linux-2.6.18
138 $ rm -f patches series
139 $ ln -s /tmp/lustre-1.6.5.1/lustre/kernel_patches/series/2.6-\ rhel5.series\
140  ./series
141 $ ln -s /tmp/lustre-1.6.5.1/lustre/kernel_patches/patches .
142 </screen>
143         </listitem><listitem>
144         <para>Use Quilt to apply the patches in the selected series file to the unpatched kernel. Run:</para>
145         <screen>$ cd /tmp/kernels/linux-2.6.18
146 $ quilt push -av
147 </screen>
148         <para>The patched destination tree acts as a base Linux source tree for Lustre.</para>
149         </listitem></orderedlist>
150       </section>
151     </section>
152     <section xml:id="dbdoclet.50438210_47529">
153       <title>29.3 Creating and Installing the Lustre Packages</title>
154       <para>After patching the kernel, configure it to work with Lustre, create the Lustre packages (RPMs) and install them.</para>
155
156         <orderedlist><listitem>
157       <para>Configure the patched kernel to run with Lustre. Run:</para>
158       <screen>$ cd &lt;path to kernel tree&gt;
159 $ cp /boot/config-`uname -r` .config
160 $ make oldconfig || make menuconfig
161 $ make include/asm
162 $ make include/linux/version.h
163 $ make SUBDIRS=scripts
164 $ make include/linux/utsrelease.h
165 </screen>
166         </listitem><listitem>
167       <para>Run the Lustre configure script against the patched kernel and create the Lustre packages.</para>
168       <screen>$ cd &lt;path to lustre source tree&gt;
169 $ ./configure --with-linux=&lt;path to kernel tree&gt;
170 $ make rpms
171 </screen>
172       <para>This creates a set of .rpms in /usr/src/redhat/RPMS/&lt;arch&gt; with an appended date-stamp. The SuSE path is /usr/src/packages.</para>
173               <note><para>You do not need to run the Lustre configure script against an unpatched kernel.</para></note>
174       <para><emphasis role="bold">Example set of RPMs:</emphasis></para>
175       <screen>lustre-1.6.5.1-\2.6.18_53.xx.xx.el5_lustre.1.6.5.1.custom_20081021.i686.rpm
176  
177 lustre-debuginfo-1.6.5.1-\2.6.18_53.xx.xx.el5_lustre.1.6.5.1.custom_2008102\
178 1.i686.rpm
179  
180 lustre-modules-1.6.5.1-\2.6.18_53.xx.xxel5_lustre.1.6.5.1.custom_20081021.i\
181 686.rpm
182  
183 lustre-source-1.6.5.1-\2.6.18_53.xx.xx.el5_lustre.1.6.5.1.custom_20081021.i\
184 686.rpm
185 </screen>
186               <note><para>If the steps to create the RPMs fail, contact Lustre Support by reporting a bug. See <link xl:href="LustreTroubleshooting.html#50438198_30989">Reporting a Lustre Bug</link>.</para></note>
187               <note><para>Several features and packages are available that extend the core functionality of Lustre. These features/packages can be enabled at the build time by issuing appropriate arguments to the configure command. For a list of these features and packages, run ./configure -help in the Lustre source tree. The configs/ directory of the kernel source contains the config files matching each the kernel version. Copy one to .config at the root of the kernel tree.</para></note>
188         </listitem><listitem>
189       <para><anchor xml:id="dbdoclet.50438210_41207" xreflabel=""/>Create the kernel package. Navigate to the kernel source directory and run:</para>
190       <screen>$ make rpm
191 </screen>
192       <para>Example result:</para>
193       <screen>kernel-2.6.95.0.3.EL_lustre.1.6.5.1custom-1.i686.rpm
194 </screen>
195               <note><para><link xl:href="InstallingLustrefrSourceCode.html#50438210_41207">Step 3</link> is only valid for RedHat and SuSE kernels. If you are using a stock Linux kernel, you need to get a script to create the kernel RPM.</para></note>
196         </listitem><listitem>
197        <para>Install the Lustre packages.</para>
198       <para>Some Lustre packages are installed on servers (MDS and OSSs), and others are installed on Lustre clients. For guidance on where to install specific packages, see <link xl:href="InstallingLustre.html#50438261_21654">TABLE 8-1</link> in <link xl:href="InstallingLustre.html#50438261_99193">Preparing to Install the Lustre Software</link>. which lists required packages and for each package, where to install it. Depending on the selected platform, not all of the packages listed in <link xl:href="InstallingLustre.html#50438261_21654">TABLE 8-1</link> need to be installed.</para>
199               <note><para>Running the patched server kernel on the clients is optional. It is not necessary unless the clients will be used for multiple purposes, for example, to run as a client and an OST.</para></note>
200        <para>Lustre packages should be installed in this order:</para>
201         <orderedlist><listitem>
202       <para>Install the kernel, modules and ldiskfs packages.</para>
203       <para>Navigate to the directory where the RPMs are stored, and use the rpm -ivh command to install the kernel, module and ldiskfs packages.</para>
204       <screen>$ rpm -ivh kernel-lustre-smp-&lt;ver&gt; \
205 kernel-ib-&lt;ver&gt; \
206 lustre-modules-&lt;ver&gt; \
207 lustre-ldiskfs-&lt;ver&gt;
208 </screen>
209         </listitem><listitem>
210       <para>Install the utilities/userspace packages.</para>
211       <para>Use the rpm -ivh command to install the utilities packages. For example:</para>
212       <screen>$ rpm -ivh lustre-&lt;ver&gt;
213 </screen>
214         </listitem><listitem>
215       <para>Install the e2fsprogs package.</para>
216       <para>Make sure the e2fsprogs package is unpacked, and use the rpm -i command to install it. For example:</para>
217       <screen>$ rpm -i e2fsprogs-&lt;ver&gt;
218 </screen>
219         </listitem><listitem>
220       <para>(Optional) If you want to add optional packages to your Lustre system, install them now.</para>
221         </listitem></orderedlist>
222         </listitem><listitem>
223       <para>Verify that the boot loader (grub.conf or lilo.conf) has been updated to load the patched kernel.</para>
224         </listitem><listitem>
225       <para>Reboot the patched clients and the servers.</para>
226         <orderedlist><listitem>
227       <para>If you applied the patched kernel to any clients, reboot them.</para>
228       <para>Unpatched clients do not need to be rebooted.</para>
229         </listitem><listitem>
230       <para>Reboot the servers.</para>
231       <para>Once all the machines have rebooted, the next steps are to configure Lustre Networking (LNET) and the Lustre file system. See <link xl:href="ConfiguringLustre.html#50438267_88428">Chapter 10</link>: <link xl:href="ConfiguringLustre.html#50438267_66186">Configuring Lustre</link>.</para>
232         </listitem></orderedlist>
233         </listitem></orderedlist>
234     </section>
235     <section xml:id="dbdoclet.50438210_27248">
236       <title>29.4 Installing Lustre with a Third-Party Network Stack</title>
237       <para>When using third-party network hardware, you must follow a specific process to install and recompile Lustre. This section provides an installation example, describing how to install Lustre 1.6.6 while using the Myricom MX 1.2.7 driver. The same process is used for other third-party network stacks, by replacing MX-specific references in <xref linkend="dbdoclet.50438210_12366"/> (Step 2) with the stack-specific build and using the proper --with option when configuring the Lustre source code.</para>
238         <orderedlist><listitem>
239       <para>Compile and install the Lustre kernel.</para>
240         <orderedlist><listitem>
241       <para>Install the necessary build tools.</para>
242       <para>GCC and related tools must be installed. For more information, see <link xl:href="InstallingLustre.html#50438261_37079">Required Software</link>.</para>
243       <screen>$ yum install rpm-build redhat-rpm-config
244 $ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
245 $ echo &apos;%_topdir %(echo $HOME)/rpmbuild&apos; &gt; .rpmmacros
246 </screen>
247         </listitem><listitem>
248       <para>Install the patched Lustre source code.</para>
249       <para>This RPM is available at the <link xl:href="http://www.oracle.com/technetwork/indexes/downloads/sun-az-index-095901.html#L">Lustre download site</link>.</para>
250       <screen>$ rpm -ivh \
251 kernel-lustre-source-2.6.18-92.1.10.el5_lustre.1.6.6.x86_64.rpm
252 </screen>
253         </listitem><listitem>
254       <para>Build the Linux kernel RPM.</para>
255       <screen>$ cd /usr/src/linux-2.6.18-92.1.10.el5_lustre.1.6.6
256 $ make distclean
257 $ make oldconfig dep bzImage modules
258 $ cp /boot/config-`uname -r` .config
259 $ make oldconfig || make menuconfig
260 $ make include/asm
261 $ make include/linux/version.h
262 $ make SUBDIRS=scripts
263 $ make rpm
264 </screen>
265         </listitem><listitem>
266       <para>Install the Linux kernel RPM.</para>
267       <para>If you are building a set of RPMs for a cluster installation, this step is not necessary. Source RPMs are only needed on the build machine.</para>
268       <screen>$ rpm -ivh \
269 ~/rpmbuild/kernel-lustre-2.6.18-92.1.10.el5_\lustre.1.6.6.x86_64.rpm
270 $ mkinitrd /boot/2.6.18-92.1.10.el5_lustre.1.6.6
271 </screen>
272         </listitem><listitem>
273       <para>Update the boot loader (/etc/grub.conf) with the new kernel boot information.</para>
274       <screen>$ /sbin/shutdown 0 -r
275 </screen>
276         </listitem></orderedlist>
277         </listitem><listitem>
278       <para><anchor xml:id="dbdoclet.50438210_12366" xreflabel=""/>Compile and install the MX stack.</para>
279       <screen>$ cd /usr/src/
280 $ gunzip mx_1.2.7.tar.gz (can be obtained from www.myri.com/scs/)
281 $ tar -xvf mx_1.2.7.tar
282 $ cd mx-1.2.7
283 $ ln -s common include
284 $ ./configure --with-kernel-lib
285 $ make
286 $ make install
287 </screen>
288         </listitem><listitem>
289       <para>Compile and install the Lustre source code.</para>
290         <orderedlist><listitem>
291       <para>Install the Lustre source (this can be done via RPM or tarball). The source file is available at the <link xl:href="http://www.oracle.com/technetwork/indexes/downloads/sun-az-index-095901.html#L">Lustre download site</link>. This example shows installation via the tarball.</para>
292       <screen>$ cd /usr/src/
293 $ gunzip lustre-1.6.6.tar.gz
294 $ tar -xvf lustre-1.6.6.tar
295 </screen>
296         </listitem><listitem>
297       <para>Configure and build the Lustre source code.</para>
298       <para>The ./configure --help command shows a list of all of the --with options. All third-party network stacks are built in this manner.</para>
299       <screen>$ cd lustre-1.6.6
300 $ ./configure --with-linux=/usr/src/linux \
301 --with-mx=/usr/src/mx-1.2.7
302 $ make
303 $ make rpms
304 </screen>
305       <para>The make rpms command output shows the location of the generated RPMs</para>
306         </listitem></orderedlist>
307         </listitem><listitem>
308       <para>Use the rpm -ivh command to install the RPMS.</para>
309       <screen>$ rpm -ivh \
310 lustre-1.6.6-2.6.18_92.1.10.el5_lustre.1.6.6smp.x86_64.rpm
311 $ rpm -ivh \
312 lustre-modules-1.6.6-2.6.18_92.1.10.el5_lustre.1.6.6\
313 smp.x86_64.rpm
314 $ rpm -ivh \
315 lustre-ldiskfs-3.0.6-2.6.18_92.1.10.el5_lustre.1.6.6\
316 smp.x86_64.rpm
317 </screen>
318         </listitem><listitem>
319       <para>Add the following lines to the /etc/modprobe.conf file.</para>
320       <screen>options kmxlnd hosts=/etc/hosts.mxlnd
321 options lnet networks=mx0(myri0),tcp0(eth0)
322 </screen>
323         </listitem><listitem>
324       <para>Populate the myri0 configuration with the proper IP addresses.</para>
325       <screen>vim /etc/sysconfig/network-scripts/myri0
326 </screen>
327         </listitem><listitem>
328       <para>Add the following line to the /etc/hosts.mxlnd file.</para>
329       <screen>$ IP HOST BOARD EP_ID
330 </screen>
331         </listitem><listitem>
332       <para>Start Lustre.</para>
333       <para>Once all the machines have rebooted, the next steps are to configure Lustre Networking (LNET) and the Lustre file system. See <link xl:href="ConfiguringLustre.html#50438267_88428">Chapter 10</link>: <link xl:href="InstallingLustrefrSourceCode.html#50438210_67391">Installing Lustre from Source Code</link>.</para>
334         </listitem></orderedlist>
335     </section>
336 </chapter>