/[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.45 - (hide annotations) (download) (as text)
Wed Dec 22 21:14:06 2004 UTC (9 years, 11 months ago) by swift
Branch: MAIN
Changes since 1.44: +19 -3 lines
File MIME type: application/xml
#71901 - Add bind-mounting for Knoppix users

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

  ViewVC Help
Powered by ViewVC 1.1.20