<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>

108

109

<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>

110

111

<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>

112

113

<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>

114

115

<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. </p>

<p>Follow all instructions of Gentoo Install Doc up to "chroot /mnt/gentoo" 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>

302

303

<p>Run "passwd" and get a new password for root. Open a new virtual console (Alt-F2) and login as root with your new password.</p>

304

305

<p>On the new console (F2) continue with Install Doc up to running bootstrap.sh script.</p>

306

307

<p>Go back to the first console (Alt-F1, without chroot) and mount a second CD on <c>/mnt/gentoo/mnt/cdrom2</c>. Copy portage tarball from cdrom2 and unpack it to <c>/mnt/gentoo/usr/portage</c>. Further, grab the dl-list.sh script and place it in <c>/usr/sbin</c> and make it executable.</p>

<p>Switch back to 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>

<p>Take the floppy to the machine that has fast access and feed this list to wget:</p>

336

337

<pre caption="Use wget to grab your source packages">

338

# <i>wget -N -i stage1.list</i>

339

</pre>

340

341

342

<p>Once you have obtained all the files, take them to the computer and copy them to <c>/mnt/gentoo/usr/portage/distfiles</c>. You will then be able to run <c>bootstrap.sh</c>. Repeate this same wget fetch and place procedure for stage2 and 3.</p>

343

344

drobbins

1.1

345

346

</body>

347

</section>

348

</chapter>

349

350

<chapter>

351

<title>Netboot install</title>

352

<section>

353

<title>Requirements</title>

354

<body>

355

<p>The requirements for a netboot install are a host computer than can

356

provide a tftp server and a computer

357

that can netboot itself via either bios or a floppy drive used to boot GRUB

358

or another network bootloader. A dhcp server might also be necessary. Of

359

course, you will also need the latest build ISO, which can be found at

<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>

517

</body></section>

518

519

<section><title>Server base setup</title>

520

<body>

521

<p>Create directories: The first thing to do is to create the directories where your diskless system will be stored. Create a directory called <c>/diskless</c> which houses a directory for each diskless client. For the rest of this howto we'll be working on the client 'eta'.</p>

522

523

<pre caption="directory setup">

524

# <i>mkdir /diskless</i>

525

# <i>mkdir /diskless/eta</i>

526

# <i>mkdir /diskless/eta/boot</i>

527

</pre>

528

529

<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 <c>/etc/dhcp/dhcpd.conf</c>.</p>

530

531

<note>This provide a static IP adress 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>

532

533

<pre caption="dhcp.conf">

534

option option-150 code 150 = text ;

535

host eta {

536

hardware ethernet 00:00:00:00:00:00;

537

fixed-address <c>ip.add.re.ss</c>;

538

option option-150 "/eta/boot/grub.lst";

539

filename "/eta/boot/pxegrub";

540

}

541

</pre>

542

543

<p>For TFTP, emerge <c>app-admin/tftp-hpa</c>. In <c>/etc/conf.d/in.tftpd</c>, put the following :</p>

544

545

<pre caption="in.tftpd">

546

INTFTPD_PATH="/diskless"

547

INTFTPD_USER="nobody"

548

INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"

549

</pre>

550

551

<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 <c>/usr/portage/distfiles</c>). Copy the tarball to <c>/diskless</c> 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>

552

553

<pre caption="grub setup">

554

# <i>tar zxvf grub-0.92.tar.gz</i>

555

# <i>cd grub-0.92</i>

556

# <i>./configure --help</i>

557

<codenote>In the options you will see a list of supported network interface drivers. </codenote>

<codenote>For the nfsroot option, the IP address is the one of the server and </codenote>

575

<codenote>the directory is the one where your diskless client files are located (on the server).</codenote>

576

</pre>

577

578

<p>Setup NFS: NFS is quite easy to configure. The only thing you have to do is to add a line on the <c>/etc/exports</c> config file :</p>

579

580

<pre caption="/etc/exports">

581

# <i>nano -w /etc/exports</i>

582

NFS file systems being exported. See exports(5).

583

/diskless/eta eta(rw,sync,no_root_squash)

584

</pre>

585

586

<p>Update your hosts: One important thing to do now is to modify your <c>/etc/hosts</c> file to fit your needs. </p>

587

588

<pre caption="/etc/hosts">

589

127.0.0.1 localhost

590

591

192.168.1.10 eta.example.com eta

592

192.168.1.20 sigma.example.com sigma

593

</pre>

594

</body>

595

</section>

596

597

<section><title>Creating the system on the server</title>

598

599

<body>

600

601

<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 <c>/diskless/eta</c> directory.</p>

602

603

<pre caption="mounting the filesystem">

604

#<i> mount /dev/hda3 /mnt/gentoo</i>

605

</pre>

606

607

<p>Stage tarballs and chroot: This example uses a stage3 tarball. Mount <c>/proc</c> to your diskless directory and chroot into it to continue with the install. Then follow the installation manual until kernel configuration.</p>

608

609

<warn>Be very careful where you extract your stage tarball. You don't want to end up extracting over your existing installation.</warn>

610

611

<pre caption="extracting the stage tarball">

612

# <i>cd /mnt/gentoo/diskless/eta/</i>

613

# <i>tar -xvjpf /mnt/cdrom/gentoo/stage3-*.tar.bz2</i>

614

# <i>mount -t proc /proc /mnt/gentoo/diskless/eta/proc</i>

615

# <i>cp /etc/resolv.conf /mnt/gentoo/diskless/eta/etc/resolv.conf</i>

616

# <i>chroot /mnt/gentoo/diskless/eta/ /bin/bash</i>

617

# <i>env-update</i>

618

# <i>source /etc/profile</i>

619

</pre>

620

621

<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>

622

623

<pre caption="menuconfig options">

624

- Your network card device support

625

626

- Under "Networking options" :

627

628

[*] TCP/IP networking

629

[*] IP: kernel level autoconfiguration

630

[*] IP: DHCP support

631

[*] IP: BOOTP support

632

633

634

- Under "File systems --> Network File Systems" :

635

636

&lt;*&gt; NFS file system support

637

[*] Provide NFSv3 client support

638

[*] Root file system on NFS

639

</pre>

640

641

<p>Next configure your diskless client's <c>/etc/fstab</c>.</p>

642

643

<pre caption="/etc/fstab">

644

# <i>nano -w /etc/fstab</i>

645

/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0

646

proc /proc proc defaults 0 0

647

tmpfs /dev/shm tmpfs defaults 0 0

648

</pre>

649

650

<p>Bootloader. Dont 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>

651

652

<pre caption="Starting services">

653

# <i>/etc/init.d/dhcp start</i>

654

# <i>/etc/init.d/tftpd start</i>

655

# <i>/etc/init.d/nfs start</i>

656

</pre>

657

658

</body></section>

659

660

<section><title>Booting the new client</title>

661

<body>

662

<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 maufacturers 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>

<p>In order to install Gentoo from your existing Linux distribution you need to

673

have chroot command installed, and have a copy of the Gentoo installation

674

tarball or ISO you want to install. A network connection would be preferable if

675

you want more than what's supplied in your tarball. (by the way, a tarball is

676

just a file ending in .tbz or .tar.gz). The author used RedHat Linux 7.3 as the

677

"host" operating system, but it is not very important. Let's get started! </p>

678

</body>

679

</section>

680

681

<section> <title> Overview </title>

682

<body>

683

<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 proto-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>

684

</body>

685

</section>

686

687

<section> <title> How should we make space for gentoo? </title>

688

<body>

689

690

<p>

691

The root partition is the filesystem mounted under "/". 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>

692

693

694

<pre caption="Filesystem information">

695

# <i>mount</i>

696

/dev/hdb2 on / type ext3 (rw)

697

none on /proc type proc (rw)

698

none on /dev/pts type devpts (rw,gid=5,mode=620)

699

none on /dev/shm type tmpfs (rw)

700

# <i>df -h </i>

701

Filesystem Size Used Avail Use% Mounted on

702

/dev/hdb2 4.0G 1.9G 2.4G 82% /

703

none 38M 0 38M 0% /dev/shm

704

</pre>

705

706

<p>As we can see, the partition mounted as "/" named /dev/hdb2 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>

707

708

</body> </section>

709

710

<section> <title> Building parted to resize partition </title>

711

<body>

712

<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>

Documentation that accompanies the software package and insert a new floppy in

737

the drive for the next step. </p>

738

739

<note> Note again that Linux is synonym of "There's one more way to do it". Your

740

objective is to run parted on an unmounted partition so it can do its work. You

741

might use some other boot/root diskset other than tomsrtbt. You might not even

742

need to do this step at all, that is only umount the filesystem you want to

743

repartition in your Linux session and run parted on it. </note>

744

745

<pre caption="Utility disk creation">

746

# <i>mkfs.minix /dev/fd0</i>

747

480 inodes

748

1440 blocks

749

Firstdatazone=19 (19)

750

Zonesize=1024

751

Maxsize=268966912

752

</pre>

753

754

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.

<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.