/[gentoo]/xml/htdocs/doc/en/altinstall.xml
Gentoo

Contents of /xml/htdocs/doc/en/altinstall.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations) (download) (as text)
Thu Sep 25 10:12:27 2003 UTC (10 years, 11 months ago) by blubber
Branch: MAIN
Changes since 1.17: +6 -4 lines
File MIME type: application/xml
fixed #29572

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3
4
5 <guide link="/doc/en/altinstall.xml">
6 <title>The Gentoo Linux alternative installation method HOWTO</title>
7 <author title="Contributor"><mail link="gerrynjr@gentoo.org">Gerald Normandin Jr.</mail></author>
8 <author title="Contributor"><mail link="lordviram@rebelpacket.net">Travis Tilley</mail></author>
9 <author title="Contributor"><mail link="volontir@yahoo.com">Oleg Raisky</mail></author>
10 <author title="Contributor"><mail link="luminousit@hotmail.com">Alex Garbutt</mail></author>
11 <author title="Contributor"><mail link="alex@openvs.com">Alexandre Georges</mail></author>
12 <author title="Contributor"><mail link="vargen@b0d.org">Magnus Backanda</mail></author>
13 <author title="Contributor"><mail link="davoid@gentoo.org">Faust A. Tanasescu</mail></author>
14 <author title="Contributor"><mail link="aliz@gentoo.org">Daniel Ahlberg</mail></author>
15 <author title="Editor"><mail link="swift@gentoo.org">Sven Vermeulen</mail></author>
16 <author title="Reviewer"><mail link="antifa@gentoo.org">Ken Nowack</mail></author>
17 <author title="Editor"><mail link="blubber@gentoo.org">Tiemo Kieft</mail></author>
18 <abstract>
19 This HOWTO is meant to be a repository of alternative Gentoo installation
20 methods, for those with special installation needs such as lack of a cdrom
21 or a computer that can't boot cds.
22 </abstract>
23
24 <version>0.34</version>
25 <date>September 25, 2003</date>
26
27 <license/>
28
29 <chapter>
30 <title>About this document</title>
31 <section>
32 <body>
33
34 <p>If the standard boot-from-CD install method doesn't work for you
35 (or you just don't like it),
36 help is now here. This document serves to
37 provide a repository of alternative Gentoo Linux installation techniques
38 to those who need them.
39 Or, if you prefer, it serves as
40 a place to put your wacky installation methods. If you have an
41 installation method that you yourself find useful, or you have devised an
42 amusing way of installing Gentoo, please don't hesitate to write something
43 up and <mail link="antifa@gentoo.org">send it to me.</mail></p>
44
45
46 </body>
47 </section>
48 </chapter>
49
50 <chapter>
51 <title>Booting the LiveCD with Smart BootManager</title>
52 <section>
53
54 <body>
55 <p>Download Smart BootManager <uri link="http://btmgr.sourceforge.net/index.php3?body=download.html">http://btmgr.sourceforge.net/index.php3?body=download.html</uri>. Linux source or binary format and windows .exe versions are available as well as many language packs. However, at this time, the preferred method would be to use the binary format, as the source will not compile with newer versions of NASM.</p>
56
57 <p>Either compile the package from source or just grab the binary. There are several options that can be utilized while creating your boot floppy, as seen below.</p>
58
59 <pre caption="Smart BootManager Options">
60 <i>sbminst [-t theme] [-d drv] [-b backup_file] [-u backup_file]
61
62 -t theme select the theme to be used, in which the theme could be:
63 us = English theme de = German theme
64 hu = Hungarian theme zh = Chinese theme
65 ru = Russian theme cz = Czech theme
66 es = Spanish theme fr = French theme
67 pt = Portuguese theme
68
69
70 -d drv set the drive that you want to install Smart BootManager on;
71 for Linux:
72 /dev/fd0 is the first floppy driver,
73 /dev/hda is the first IDE harddisk driver.
74 /dev/sda is the first SCSI harddisk driver.
75 for DOS:
76 0 is the first floppy drive
77 128 is the first hard drive;
78
79 -c disable CD-ROM booting feature;
80
81 -b backup_file backup the data that will be overwritten for
82 future uninstallation;
83
84 -u backup_file uninstall Smart BootManager, should be used alone;
85
86 -y do not ask any question or warning.</i>
87 </pre>
88
89 <pre caption="Using sbminst to build the boot floppy">
90 # <i>sbminst -t us -d /dev/fd0</i>
91 </pre>
92 <note> Replace fd0 with your repective floppy device name if yours is different. </note>
93 <p>Now simply place the floppy in the floppy drive of the computer you'd like to boot the LiveCD on, as well as placing the LiveCD in the CD-ROM and boot the computer.</p>
94
95 <p>You'll be greeted with the Smart BootManager dialog. Select your CD-ROM and press ENTER to boot the LiveCD. Once booted proceed with the standard installation instructions.</p>
96
97 <p>Further information on Smart BootManager may be found at <uri>http://btmgr.sourceforge.net/</uri></p>
98 </body>
99 </section>
100 </chapter>
101
102
103 <chapter>
104 <title>Knoppix Installation</title>
105 <section>
106
107 <body>
108 <p>Booting from the <uri link="http://www.knoppix.org/">Knoppix</uri> LiveCD is a way to have a fully functional linux system while you're compiling Gentoo. Tux Racer will help you pass the time while you wait for bootstrap.</p>
109
110 <p>Boot from the Knoppix CD. It generally does a really good job of hardware detection. Although, you may have to add some boot options. </p>
111
112 <p>By default Knoppix boots into a KDE 3.0 desktop. The first thing I did was open a konsole and typed <c>sudo passwd root</c>. This lets you set the root password for Knoppix.</p>
113
114 <p> Next, I su to root and typed <c>usermod -d /root -m root</c>. This sets user roots home directory to /root (the Gentoo way) from /home/root (the Knoppix way). If you do not do this, then you will receive errors when emerging about "/home/root: not found" or something to that effect.</p>
115
116 <p>I then typed <c>exit</c> and then <c>su</c> back into root. This loads the change that was made with the usermod command. At this point, you can pick up with the standard install documentation at step 6. However, when you're asked to mount the proc system, issue the following commands instead: </p>
117
118 <pre caption = "Bind-mounting two important filesystems">
119 # <i>mount -o bind /proc /mnt/gentoo/proc</i>
120 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
121 </pre>
122
123 </body>
124 </section>
125 </chapter>
126
127 <chapter>
128 <title>Installing from Stage 1 without network access</title>
129 <section>
130 <body>
131
132
133 <p>Burn a LiveCD iso.</p>
134
135 <p>Get the latest portage snapshot from <uri>http://distro.ibiblio.org/pub/linux/distributions/gentoo/snapshots/</uri> (or your favorite <uri link="http://www.gentoo.org/main/en/mirrors.xml">mirror</uri>). Either place this tarball on an existing partition on the computer your are installing to, or burn it to a CD.</p>
136
137 <p>You'll also need a package list for the stage packages. Place the following dl-list.sh script on the same medium as the portage snapshot, you'll need it later.</p>
138
139 <pre caption="dl-list.sh">
140 #!/bin/bash
141
142 # set your defaults here:
143 user_defs() {
144
145 # portage directory (without a trailing "/"):
146 portage_dir="/usr/portage"
147
148 # default download mirror (without a trailing "/"):
149 gentoo_mirror="http://www.ibiblio.org/pub/Linux/distributions/gentoo"
150
151 # default sourceforge mirror (unc, telia, belnet):
152 sourceforge_mirror="unc"
153
154 # fix gnu mirror entries
155 gnu_url="ftp:\/\/ftp.gnu.org\/pub\/gnu"
156
157 }
158
159
160 #------------------------------------------------------------
161
162 # function to remove temporary files
163 cleanup() {
164
165 rm -f $temp_file_1 $temp_file_2
166 exit $1
167
168 }
169
170 # set user defaults
171 user_defs
172
173 # set the complete url for the sourceforge mirror
174 # (the \'s are needed because this goes in a sed command)
175 sourceforge_mirror_complete="http:\/\/$sourceforge_mirror.dl.sourceforge.net\/sourceforge"
176
177 # initialize counters
178 num_files=0
179 num_alt_urls=0
180 total_size=0
181
182 # initialize lists (arrays)
183 declare -a def_urls_arr
184 declare -a alt_urls_arr
185
186 # create 2 temporary files
187 temp_file_1=`mktemp -t dl-list.XXXXXX` || cleanup 1
188 temp_file_2=`mktemp -t dl-list.XXXXXX` || cleanup 1
189
190 # run "emerge -p &lt;args&gt;" (too easy to forget the "-p" in the command line...)
191 emerge -p $@ &gt; $temp_file_1 || cleanup 1
192
193 # remove the lines that do not contain the word "ebuild"
194 sed -n -e '/ebuild/p' $temp_file_1 &gt; $temp_file_2
195
196 # count how many lines were left
197 num_ebuilds=`wc -l $temp_file_2 | sed -e 's/\(.*\) \(.*\)/\1/'`
198
199 # extract the useful information from those lines: category, package and version
200 #sed -e 's:\(.*\) \(.*\)/\(.*\)-\([0-9].*\) \(.*\) \(.*\):\2 \3 \4:' $temp_file_2 &gt; $temp_file_1
201 sed -e 's:\(.*\) \(.*\)/\(.*\)-\([0-9].*\):\2 \3 \4:' $temp_file_2 &gt; $temp_file_1
202
203 # display starting message :)
204 echo -n "Generating list " &gt;&amp;2
205
206 # process each package in turn
207 while read category package version rest
208 do
209
210 # form the name of the digest file
211
212 digest_file="$portage_dir/$category/$package/files/digest-$package-$version"
213
214 # process the contents of the digest file
215 while read md5_flag md5_sum file_name file_size
216 do
217
218 # form the default url to download the file
219 def_urls_arr[$num_files]="$gentoo_mirror/distfiles/$file_name"
220
221 # increment the file counter
222 num_files=$(($num_files + 1))
223
224 # update the size accumulator (in kilobytes)
225 total_size=$(($total_size + $file_size / 1024))
226
227 done &lt; $digest_file
228
229 # form the "ebuild depend" command line
230 ebuild_depend_cmd="ebuild $portage_dir/$category/$package/$package-${version}.ebuild depend"
231
232 # execute the "ebuild depend" command
233 $ebuild_depend_cmd || cleanup 1
234
235 # form the name of the dependency file
236 dependency_file="/var/cache/edb/dep/$category/$package-$version"
237
238 # read in the 4th line from the dependency file,
239 # which contains the official download urls
240 alt_urls=`head -n 4 $dependency_file | tail -n 1`
241
242 # ignore empty url list
243 if [ -n "$alt_urls" ]
244 then
245
246 # split the urls list into $1..$N
247 set $alt_urls
248
249 # process each url in turn
250 for i in $@
251 do
252
253 # remove the (use)? strings from the url list
254 alt_url_tmp=`echo "$i" | sed -e '/\?$/d'`
255
256 # remove the "mirror://gnome" urls
257 alt_url_tmp=`echo "$alt_url_tmp" | sed -e '/^mirror:\/\/gnome/d'`
258
259 # remove the "mirror://kde" urls
260 alt_url_tmp=`echo "$alt_url_tmp" | sed -e '/^mirror:\/\/kde/d'`
261
262 # remove the "mirror://gentoo" urls (already included)
263 alt_url_tmp=`echo "$alt_url_tmp" | sed -e '/^mirror:\/\/gentoo/d'`
264
265 # translate the "mirror://sourceforge" urls into valid urls
266 alt_url_tmp=`echo "$alt_url_tmp" | sed -e "s/mirror:\/\/sourceforge/$sourceforge_mirror_complete/"`
267
268 # translate the "mirror://gnu" urls into valid urls
269 alt_url_tmp=`echo "$alt_url_tmp" | sed -e "s/mirror:\/\/gnu/$gnu_url/"`
270 # ignore empty urls
271 if [ -n "$alt_url_tmp" ]
272 then
273
274 # add the url to the list
275 alt_urls_arr[$num_alt_urls]=$alt_url_tmp
276
277 # increment the alternate url counter
278 num_alt_urls=$(($num_alt_urls + 1))
279
280 fi
281
282 done
283
284 fi
285
286 # a progress bar :)
287 echo -n "." &gt;&amp;2
288
289 done &lt; $temp_file_1
290
291 # display ending message :)
292 echo " done." &gt;&amp;2
293
294 # display default urls list
295 for i in ${def_urls_arr[@]}; do echo $i; done | sort
296
297 # display alternate urls list
298 for i in ${alt_urls_arr[@]}; do echo $i; done | sort
299
300 # display totals
301 echo "Totals:" $num_ebuilds "ebuilds," $num_files "files," $num_files "default urls," \n
302 $num_alt_urls "alternate urls," "${total_size}Kb." &lt;&amp;2
303
304 # remove temporary files and exit
305 cleanup 0
306 </pre>
307
308 <p>Follow all instructions of Gentoo Install Doc up to <c>chroot /mnt/gentoo</c> in Step 8. If you only have one CD-ROM remember to use the <c>cdcache</c> option while booting so you can unmount the LiveCD and mount your portage snapshot CD.</p>
309
310 <p>Open a new console (Alt-F2), we will continue with the Install Doc up to running the bootstrap.sh script.</p>
311
312 <warn>Older realeases of the livecd required you to change the password using the <c>passwd</c> command, before logging in manually.</warn>
313
314
315 <p>Go back to the first console (Alt-F1, without chroot) and mount a second CD on <path>/mnt/gentoo/mnt/cdrom2</path>. Copy the portage tarball from cdrom2 and unpack it to <path>/mnt/gentoo/usr/portage</path>. Further, grab the dl-list.sh script and place it in <path>/usr/sbin</path> and make it executable.</p>
316
317 <pre caption="Mount the snapshot cd">
318 # <i>umount /mnt/cdrom</i>
319 # <i>mkdir /mnt/gentoo/mnt/cdrom2</i>
320 # <i>mount /dev/cdroms/cdrom0 /mnt/gentoo/mnt/cdrom2</i>
321 # <i>cp /mnt/gentoo/mnt/cdrom2/portage-$date.tar.bz2 /mnt/gentoo/usr/portage</i>
322 # <i>cp /mnt/gentoo/mnt/cdrom2/dl-list.sh /mnt/gentoo/usr/sbin</i>
323 # <i>cd /mnt/gentoo/usr/portage</i>
324 # <i>tar xvjpf portage-$date.tar.bz2</i>
325 # <i>chmod +x /mnt/gentoo/usr/sbin/dl-list.sh</i>
326 </pre>
327
328 <p>Switch back to the F2 console. Now if you try to run bootstrap.sh it will fail because it won't be able to download any files. We will fetch these files somewhere else and put them in /usr/portage/distfiles (on F2 console). </p>
329
330 <p>You need a list of Stage1 packages: glibc, baselayout, texinfo, gettext, zlib, binutils, gcc, ncurses plus their dependencies. </p>
331
332 <note>Note that you need the versions of each package synced with your portage tree.</note>
333
334 <p>Now use the dl-list.sh script to generate the package list that you need. Then copy the subsequent list to a floppy.</p>
335
336 <pre caption="Using dl-list.sh">
337 # <i>dl-list.sh glibc baselayout texinfo gettext zlib binutils gcc ncurses > stage1.list</i>
338 # <i>mount -t vfat /dev/fd0 /mnt/floppy</i>
339 # <i>cp /mnt/gentoo/stage1.list /mnt/floppy</i>
340 # <i>umount /mnt/floppy</i>
341 </pre>
342
343 <p>Take the floppy to the computer that has fast access and feed this list to wget:</p>
344
345 <pre caption="Use wget to grab your source packages">
346 # <i>wget -N -i stage1.list</i>
347 </pre>
348
349
350 <p>Once you have obtained all the files, take them to the computer and copy them to <path>/mnt/gentoo/usr/portage/distfiles</path>. You will then be able to run <c>bootstrap.sh</c>. Repeat this same wget fetch and place procedure for stage2 and 3.</p>
351
352
353
354 </body>
355 </section>
356 </chapter>
357
358 <chapter>
359 <title>Netboot install</title>
360 <section>
361 <title>Requirements</title>
362 <body>
363 <p>The requirements for a netboot install are a host computer than can
364 provide a tftp server and a computer
365 that can netboot itself via either bios or a floppy drive used to boot GRUB
366 or another network bootloader. A dhcp server might also be necessary. Of
367 course, you will also need the latest build ISO, which can be found at
368 <uri>http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/</uri></p>
369 <note>Due to changes in the LiveCD, this procedure will only work for the 1.2 LiveCD. </note>
370 </body>
371 </section>
372
373 <section>
374 <title>Overview</title>
375 <body>
376
377 <p>In order to load images off the network, the first thing a netboot machine
378 must do is obtain an IP address. There are multiple ways of obtaining
379 an IP address, and any
380 one of them will do. Personally, I prefer to use GRUB for everything, but if
381 your computer supports booting from a network already then grub might not
382 be necessary, even if it might be easier to just use GRUB's <c>ifconfig</c> command
383 instead of setting up a bootp or dhcp server.</p>
384
385 <p>Once your computer has obtained an IP address, the next logical step is to find
386 out what you are going to be booting and where it might be held. Once again,
387 it would be easiest to do this with GRUB commands as opposed to setting up
388 a bootp or dhcp server. You will also need to specify how to obtain an initrd
389 and tell the kernel that it will be using this as it's root filesystem.</p>
390
391 <p>With your kernel loaded and root filesystem mounted, you may proceed
392 with installation as normal. The build image could be loaded from a cd, or it
393 can be downloaded from the network via tftp.</p>
394
395 </body>
396 </section>
397 <section>
398 <title>Using GRUB</title>
399 <body>
400
401 <p>To use GRUB for network booting purposes, you must first have GRUB
402 compiled with support for your network card. It doesn't matter if you install
403 to floppy, or to the hard drive of the computer you wish to install Gentoo
404 on. If your install target already has GRUB with network support installed,
405 then you are one step ahead. GRUB can be downloaded from
406 <uri>ftp://alpha.gnu.org/gnu/grub/</uri></p>
407
408 <p>A configure example for enabling tulip support, the network card in my
409 box:</p>
410
411 <pre caption="Manual GRUB installation">
412 # <i>./configure --enable-tulip --prefix=/usr</i>
413 # <i>make &amp;&amp; make install</i>
414 </pre>
415
416 <p>If you are currently in Gentoo and wish to install GRUB using Gentoo
417 tools, then you need to install step by step in order to configure in support
418 for your network card. An example for using ebuild to install GRUB with
419 tulip support:</p>
420
421 <pre caption="Installing and configuring GRUB on Gentoo Linux">
422 # <i>ebuild /usr/portage/sys-apps/grub/grub-0.91.ebuild clean fetch unpack</i>
423 # <i>cd /var/tmp/portage/grub-0.91/work/grub-0.91/</i>
424 # <i>./configure --prefix=/usr --sbindir=/sbin --mandir=/usr/share/man \ </i>
425 > <i>--infodir=/usr/share/info --enable-tulip</i>
426 # <i>make</i>
427 # <i>touch /var/tmp/portage/grub-0.91/.compiled</i>
428 # <i>cd /usr/portage/</i>
429 # <i>ebuild sys-apps/grub/grub-0.91.ebuild install merge</i>
430 </pre>
431
432 <p>Now that we have the GRUB shell itself installed, we need to install to
433 a boot sector. Although you could install GRUB to the boot sector of your
434 install computer's hard drive, here we will assume that you are installing
435 GRUB on a boot floppy. There are two ways of doing this. You can use the GRUB
436 shell itself, or you can use a provided script called <c>grub-install</c>. It is
437 preferable to use <c>grub-install</c> when installing GRUB to a floppy.</p>
438
439 <pre caption="grub-install example">
440 # <i>mkfs.ext2 /dev/fd0</i>
441 # <i>mount /dev/fd0 /mnt/floppy/</i>
442 # <i>grub-install --root-directory=/mnt/floppy/ '(fd0)'</i>
443 # <i>umount /mnt/floppy/</i>
444 </pre>
445
446 <p><c>grub-install</c> does not always work... and isn't always the best way to install
447 GRUB. And since the GRUB shell works exactly like GRUB would when booted
448 via the boot sector, it might be more desirable just to use the GRUB shell. Here
449 is an example of how to use the GRUB shell to install GRUB to a floppy:</p>
450
451 <pre caption="Using the GRUB shell instead">
452 # <i>mkfs.ext2 /dev/fd0</i>
453 # <i>mount /dev/fd0 /mnt/floppy/</i>
454 # <i>mkdir -p /mnt/floppy/boot/grub/</i>
455 # <i>cp -v /usr/share/grub/i386-pc/* /mnt/floppy/boot/grub/</i>
456 # <i>grub</i>
457 grub> <i>root (fd0)</i>
458 grub> <i>setup (fd0)</i>
459 grub> <i>quit</i>
460 # <i>umount /mnt/floppy/</i>
461 </pre>
462
463 <p>Now that we have a bootable GRUB floppy, we need to set up the host tftp server
464 (I suggest netkit's tftp server)
465 for loading our kernel and initrd. If you use inetd then you will need
466 a line in your <path>/etc/inetd.conf</path> that looks
467 like this:</p>
468
469 <pre caption="/etc/inetd.conf">
470 tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd
471 </pre>
472
473 <p>To install the netkit tftp server under Gentoo Linux, emerge net-misc/netkit-tftp</p>
474
475 <note>There is an ebuild for xinetd... if you prefer to use this than feel free to do
476 so. However I do not use xinetd, and do not know how to set up tftp with it. If you
477 use it and such, please send me info on how to get xinetd working and I will include
478 them in this howto.</note>
479
480 <p>Now that we have our tftp server ready, we need a kernel and a root initrd to
481 put in it. You can compile a custom kernel yourself, but make sure it has all the
482 things necessary for running Gentoo (like devfs) and for netbooting (like initrd
483 support). The root initrd will be the rescue.gz included in the Gentoo ISO.</p>
484
485 <impo>Mounting an ISO file without burning it to cd requires loopback filesystem
486 support.</impo>
487
488 <pre>
489 # <i>mkdir /tftpboot</i>
490 # <i>mount -o loop /path/to/gentoo-ix86-1.1a.iso /mnt/cdrom/</i>
491 # <i>cp /mnt/cdrom/isolinux/kernel /mnt/cdrom/isolinux/rescue.gz /tftpboot</i>
492 # <i>chmod 644 /tftpboot/*</i>
493 # <i>umount /mnt/cdrom/</i>
494 </pre>
495
496 <p>Boot the machine you want to install to with your incredibly useful grub floppy.
497 Once booted you need to specify a way for the machine to get
498 its IP address, specify where
499 to get a kernel and it's options, and where to get it's initrd.</p>
500
501 <pre>
502 grub> <i>ifconfig --address=<c>ip.add.re.ss</c> --server=<c>ip.add.re.ss</c></i>
503 grub> <i>root (nd)</i>
504 grub> <i>kernel /tftpboot/kernel devfs=nomount vga=normal load_ramdisk=1 </i>
505 <i>prompt_ramdisk=0 ramdisk_size=24000 root=/dev/ram0 rw</i> <comment>(all on one line)</comment>
506 grub> <i>initrd /tftpboot/rescue.gz</i>
507 grub> <i>boot</i>
508 </pre>
509
510 <note>You can also use bootp and dhcp to configure your ip via grub. Use the bootp
511 and dhcp commands.</note>
512
513 <p>Now that you have your machine booted, you can install as normal. Refer to the
514 from source cd install howto.</p>
515
516 </body>
517 </section>
518 </chapter>
519
520 <chapter><title>Diskless install using PXE boot</title>
521
522 <section><title>Requirements</title>
523 <body>
524 <p>You will need a network card on the diskless client that uses the PXE protocol to boot, like many 3com cards. You will also need a BIOS that supports booting from PXE.</p>
525 </body></section>
526
527 <section><title>Server base setup</title>
528 <body>
529 <p>Create directories: The first thing to do is to create the directories where your diskless system will be stored. Create a directory called <path>/diskless</path> which houses a directory for each diskless client. For the rest of this howto we'll be working on the client 'eta'.</p>
530
531 <pre caption="directory setup">
532 # <i>mkdir /diskless</i>
533 # <i>mkdir /diskless/eta</i>
534 # <i>mkdir /diskless/eta/boot</i>
535 </pre>
536
537 <p>DHCP and TFTP setup: The client will get boot informations using DHCP and download all the required files using TFTP. Just emerge DHCP and configure it for your basic needs. Then, add the following on <path>/etc/dhcp/dhcpd.conf</path>.</p>
538
539 <note>This provide a static IP address for the client and the path of a PXE boot image, here pxegrub. You have to replace the MAC address of the Ethernet card of the client and the directory where you will put the client files with the one you use.</note>
540
541 <pre caption="dhcp.conf">
542 option option-150 code 150 = text ;
543 host eta {
544 hardware ethernet 00:00:00:00:00:00;
545 fixed-address <c>ip.add.re.ss</c>;
546 option option-150 "/eta/boot/grub.lst";
547 filename "/eta/boot/pxegrub";
548 }
549 </pre>
550
551 <p>For TFTP, emerge <c>app-admin/tftp-hpa</c>. In <path>/etc/conf.d/in.tftpd</path>, put the following :</p>
552
553 <pre caption="in.tftpd">
554 INTFTPD_PATH="/diskless"
555 INTFTPD_USER="nobody"
556 INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"
557 </pre>
558
559 <p>Setup GRUB: To provide PXE booting I use GRUB. You have to compile it by yourself to enable the PXE image compilation ... but that's quite easy. First, get the latest version of the GRUB source code (<c>emerge -f grub</c> will place the tarball in <path>/usr/portage/distfiles</path>). Copy the tarball to <path>/diskless</path> and then build it to make the pxe capable binary. Once the binary is built, copy it to the diskless client's boot directory. Then edit it's grub.lst config file.</p>
560
561 <pre caption="grub setup">
562 # <i>tar zxvf grub-0.92.tar.gz</i>
563 # <i>cd grub-0.92</i>
564 # <i>./configure --help</i>
565 <codenote>In the options you will see a list of supported network interface drivers. </codenote>
566 <codenote>Select the driver compatible with your card. Herein referenced a $nic</codenote>
567 # <i>./configure --enable-diskless --enable-$nic</i>
568 # <i>make</i>
569 # <i>cd stage2</i>
570 # <i>cp pxegrub /diskless/eta/boot/pxegrub</i>
571 # <i>nano -w /diskless/eta/boot/grub.lst</i>
572 </pre>
573
574 <pre caption="grub.lst">
575 default 0
576 timeout 30
577
578 title=Diskless Gentoo
579 root (nd)
580 kernel /eta/bzImage ip=dhcp root=/dev/nfs nfsroot=<c>ip.add.re.ss</c>:/diskless/eta
581
582 <codenote>For the nfsroot option, the IP address is the one of the server and </codenote>
583 <codenote>the directory is the one where your diskless client files are located (on the server).</codenote>
584 </pre>
585
586 <p>Setup NFS: NFS is quite easy to configure. The only thing you have to do is to add a line on the <path>/etc/exports</path> config file :</p>
587
588 <pre caption="/etc/exports">
589 # <i>nano -w /etc/exports</i>
590 NFS file systems being exported. See exports(5).
591 /diskless/eta eta(rw,sync,no_root_squash)
592 </pre>
593
594 <p>Update your hosts: One important thing to do now is to modify your <path>/etc/hosts</path> file to fit your needs. </p>
595
596 <pre caption="/etc/hosts">
597 127.0.0.1 localhost
598
599 192.168.1.10 eta.example.com eta
600 192.168.1.20 sigma.example.com sigma
601 </pre>
602 </body>
603 </section>
604
605 <section><title>Creating the system on the server</title>
606
607 <body>
608
609 <p>Reboot the server on a Gentoo LiveCD. Follow the standard install procedure as explained in the Gentoo Install Howto BUT with the following differences. When you mount the file system, do the following (where hdaX is the partition where you created the /diskless directory). You do not need to mount any other partitions as all of the files will reside in the <path>/diskless/eta</path> directory.</p>
610
611 <pre caption="mounting the filesystem">
612 #<i> mount /dev/hda3 /mnt/gentoo</i>
613 </pre>
614
615 <p>Stage tarballs and chroot: This example uses a stage3 tarball. Mount <path>/proc</path> to your diskless directory and chroot into it to continue with the install. Then follow the installation manual until kernel configuration.</p>
616
617 <warn>Be very careful where you extract your stage tarball. You don't want to end up extracting over your existing installation.</warn>
618
619 <pre caption="extracting the stage tarball">
620 # <i>cd /mnt/gentoo/diskless/eta/</i>
621 # <i>tar -xvjpf /mnt/cdrom/gentoo/stage3-*.tar.bz2</i>
622 # <i>mount -t proc /proc /mnt/gentoo/diskless/eta/proc</i>
623 # <i>cp /etc/resolv.conf /mnt/gentoo/diskless/eta/etc/resolv.conf</i>
624 # <i>chroot /mnt/gentoo/diskless/eta/ /bin/bash</i>
625 # <i>env-update</i>
626 # <i>source /etc/profile</i>
627 </pre>
628
629 <p>Kernel configuration: When you do the <c>make menuconfig</c> of your kernel configuration, don't forget to enable the following options with the others recommended into the install howto.</p>
630
631 <pre caption="menuconfig options">
632 - Your network card device support
633
634 - Under "Networking options" :
635
636 [*] TCP/IP networking
637 [*] IP: kernel level autoconfiguration
638 [*] IP: DHCP support
639 [*] IP: BOOTP support
640
641
642 - Under "File systems --> Network File Systems" :
643
644 &lt;*&gt; NFS file system support
645 [*] Provide NFSv3 client support
646 [*] Root file system on NFS
647 </pre>
648
649 <p>Next configure your diskless client's <path>/etc/fstab</path>.</p>
650
651 <pre caption="/etc/fstab">
652 # <i>nano -w /etc/fstab</i>
653 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
654 proc /proc proc defaults 0 0
655 tmpfs /dev/shm tmpfs defaults 0 0
656 </pre>
657
658 <p>Bootloader. Don't install another bootloader because we already have one - pxegrub. Simply finish the install and restart the server. Start the services you'll need to boot the new client: DHCP, TFTPD, and NFS.</p>
659
660 <pre caption="Starting services">
661 # <i>/etc/init.d/dhcp start</i>
662 # <i>/etc/init.d/tftpd start</i>
663 # <i>/etc/init.d/nfs start</i>
664 </pre>
665
666 </body></section>
667
668 <section><title>Booting the new client</title>
669 <body>
670 <p>For the new client to boot properly, you'll need to configure the bios and the network card to use PXE as the first boot method - before CD-ROM or floppy. For help with this consult your hardware manuals or manufacturers website. The network card should get an IP address using DHCP and download the GRUB PXE image using TFTP. Then, you should see a nice black and white GRUB bootmenu where you will select the kernel to boot and press Enter. If everything is ok the kernel should boot, mount the root filesystem using NFS and provide you with a login prompt. Enjoy.</p>
671 </body></section>
672
673 </chapter>
674
675
676
677 <chapter> <title>Installing Gentoo from an existing Linux distribution </title>
678 <section> <title> Requirements </title>
679 <body>
680 <p>In order to install Gentoo from your existing Linux distribution you need to
681 have chroot command installed, and have a copy of the Gentoo installation
682 tarball or ISO you want to install. A network connection would be preferable if
683 you want more than what's supplied in your tarball. (by the way, a tarball is
684 just a file ending in .tbz or .tar.gz). The author used RedHat Linux 7.3 as the
685 "host" operating system, but it is not very important. Let's get started! </p>
686 </body>
687 </section>
688
689 <section> <title> Overview </title>
690 <body>
691 <p>We will first allocate a partition to Gentoo by resizing our existing Linux partition, mount the partition, untar the tarball that is mounted, chroot inside the psuedo-system and start building. Once the bootstrap process is done, we will do some final configuration on the system so as to make sure it boots, then we are ready to reboot and use Gentoo. </p>
692 </body>
693 </section>
694
695 <section> <title> How should we make space for Gentoo? </title>
696 <body>
697
698 <p>
699 The root partition is the filesystem mounted under <path>/</path>. A quick run of mount on my system shows what I am talking about. We well also use df (disk free) to see how much space I have left and how I will be resizing. Note that it is not mandatory to resize your root partition! You could be resizing anything else supported by our resizer, but let's talk about that later.</p>
700
701
702 <pre caption="Filesystem information">
703 # <i>mount</i>
704 /dev/hdb2 on / type ext3 (rw)
705 none on /proc type proc (rw)
706 none on /dev/pts type devpts (rw,gid=5,mode=620)
707 none on /dev/shm type tmpfs (rw)
708 # <i>df -h </i>
709 Filesystem Size Used Avail Use% Mounted on
710 /dev/hdb2 4.0G 1.9G 2.4G 82% /
711 none 38M 0 38M 0% /dev/shm
712 </pre>
713
714 <p>As we can see, the partition mounted as <path>/</path> named <path>/dev/hdb2</path> has 2.4 gigabytes free. In my case, I think I will resize it as to leave 400Megs free of space, therefore allocating 2 gigabytes for Gentoo. Not bad, I could have quite some stuff installed. However, think that even one gigabyte is enough for most users. So let's partition this thing! </p>
715
716 </body> </section>
717
718 <section> <title> Building parted to resize partition </title>
719 <body>
720 <p>Parted is an utility supplied by the GNU foundation, an old and respectable huge project whose software you are using in this very moment. There is one tool, however, that is extremely useful for us at the moment. It's called parted, partition editor and we can get it from <uri>
721 http://www.gnu.org/software/parted/</uri>
722 </p>
723 <note> There are other tools for doing resize of partitions as well, but author
724 is unsure/uninterested whether PartitionMagic(tm) or other software of the kind
725 do the job. It's the reader's job to check them out </note>
726
727 <p>
728 Look up on that page the type of filesystem you want to resize and see if parted
729 can do it. If not, you're out of luck, you will have to destroy some partition
730 to make space for Gentoo, and reinstall back. Go ahead by downloading the
731 software, install it. Here we have a problem. We want to resize our Linux root
732 partition, therefore we must boot from a floppy disk a minimal linux system and
733 use previously-compiled parted copied to a diskette in order to resize <path>/</path>.
734 However, if you can unmount the partition while still in Linux you are lucky,
735 you don't need to do what follows. Just compile parted and run it on an
736 unmounted partition you chose to resize. Here's how I did it for my system.
737 </p>
738
739 <impo> Make sure that the operations you want to do on your partition are
740 supported by parted! </impo>
741
742 <p> Get tomsrtbt boot/root disk (free of charge) from <uri>
743 http://freshmeat.net/tomsrtbt </uri>, create a floppy as suggested in the
744 Documentation that accompanies the software package and insert a new floppy in
745 the drive for the next step. </p>
746
747 <note> Note again that Linux is synonym of "There's one more way to do it". Your
748 objective is to run parted on an unmounted partition so it can do its work. You
749 might use some other boot/root diskset other than tomsrtbt. You might not even
750 need to do this step at all, that is only umount the filesystem you want to
751 repartition in your Linux session and run parted on it. </note>
752
753 <pre caption="Utility disk creation">
754 # <i>mkfs.minix /dev/fd0</i>
755 480 inodes
756 1440 blocks
757 Firstdatazone=19 (19)
758 Zonesize=1024
759 Maxsize=268966912
760 </pre>
761
762 We will now proceed with the build of parted. If it's not already downloaded and untarred, do so now and cd into the corresponding directory. Now run the following set of commands to build the utility and copy it to your floppy disk.
763
764 <pre caption="Building the utility floppy">
765 # <i> mkdir /floppy; mount -t minix /dev/fd0 /floppy &amp;&amp;
766 export CFLAGS="-O3 -pipe -fomit-frame-pointer -static" &amp;&amp; ./configure
767 &amp;&amp; make &amp;&amp; cp parted/parted /floppy &amp;&amp; umount /floppy </i>
768 </pre>
769
770 <p>
771 Congratulations, you are ready to reboot and resize your partition. Do this only
772 after taking a quick look at the parted documentation on the GNU website. The
773 resize should take under 30 minutes for the largest hard-drives, be patient.
774 Reboot your system with the tomsrtbt boot disk (just pop it inside), and once
775 you are logged in, switch the disk in the drive with your utility disk we have
776 created above and type mount /dev/fd0 /floppy to have parted under /floppy.
777 There you go. Run parted and you will be able to resize your partition. Once
778 this lenghty process done, we are ready to have the real fun, by installing
779 Gentoo. Reboot back into your old Linux system for now. Drive you wish to
780 operate on is the drive containing the partition we want to resize. For
781 example, if we want to resize /dev/hda3, the drive is /dev/hda
782 </p>
783
784 <pre caption="Commands to run once logged into tomsrtbt system">
785 # <i>mount /dev/fd0 /floppy </i>
786 # <i>cd /floppy; ./parted [drive you wish to operate on]</i>
787 (parted) <i> print </i>
788 Disk geometry for /dev/hdb: 0.000-9787.148 megabytes
789 Disk label type: msdos
790 Minor Start End Type Filesystem Flags
791 1 0.031 2953.125 primary ntfs
792 3 2953.125 3133.265 primary linux-swap
793 2 3133.266 5633.085 primary ext3
794 4 5633.086 9787.148 extended
795 5 5633.117 6633.210 logical
796 6 6633.242 9787.148 logical ext3
797 (parted) <i> help resize </i>
798 resize MINOR START END resize filesystem on partition MINOR
799
800 MINOR is the partition number used by Linux. On msdos disk labels, the
801 primary partitions number from 1-4, and logical partitions are 5
802 onwards.
803 START and END are in megabytes
804 (parted) <i> resize 2 3133.266 4000.000 </i>
805 </pre>
806
807 <impo> Be patient! The computer is working! Just look at the hardware LED on
808 your case to see that it is really working. This should take between 2 and 30
809 minutes. </impo>
810
811 <p>Once you have resized, boot back into your old linux as described. Then go to
812 <uri link="/doc/en/gentoo-x86-install.xml">http://www.gentoo.org/doc/en/gentoo-x86-install.xml</uri> and follow steps 6 through 17. Don't forget to create the <path>/mnt/gentoo</path> directory before proceeding with step 7. In step 8 you have to download the requested stage-tarball as we're not working from a LiveCD. When chrooting, use the following command to flush your environment:
813 </p>
814
815 <pre caption = "Flushing the environment during chroot">
816 # <i>env -i chroot /mnt/gentoo /bin/bash</i>
817 </pre>
818
819 <p>
820 Enjoy!
821 </p>
822 </body>
823 </section>
824 </chapter>
825 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20