| 1 |
<?xml version='1.0' encoding="UTF-8"?> |
| 2 |
<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?> |
| 3 |
|
| 4 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 5 |
|
| 6 |
<guide link="/doc/en/altinstall.xml"> |
| 7 |
<title>The Gentoo Linux alternative installation method HOWTO</title> |
| 8 |
<author title="Author"><mail link="lordviram@rebelpacket.net">Travis Tilley</mail></author> |
| 9 |
<author title="Contributor"><mail link="davoid@gentoo.org">Faust A. |
| 10 |
Tanasescu</mail></author> |
| 11 |
<author title="Contributor"><mail link="aliz@gentoo.org">Daniel Ahlberg</mail></author> |
| 12 |
<abstract> |
| 13 |
This HOWTO is meant to be a repository of alternative Gentoo installation |
| 14 |
methods, for those with special installation needs such as lack of a cdrom |
| 15 |
or a computer that cant boot cds. |
| 16 |
</abstract> |
| 17 |
|
| 18 |
<version>0.3</version> |
| 19 |
<date>10 September 2002</date> |
| 20 |
|
| 21 |
<chapter> |
| 22 |
<title>About this document</title> |
| 23 |
<section> |
| 24 |
<body> |
| 25 |
|
| 26 |
<p>If the standard boot-from-CD install method doesn't work for you |
| 27 |
(or you just don't like it), |
| 28 |
help is now here. This document serves to |
| 29 |
provide a repository of alternative Gentoo Linux installation techniques |
| 30 |
to those who need them. |
| 31 |
Or, if you prefer, it serves as |
| 32 |
a place to put your wacky installation methods. If you have an |
| 33 |
installation method that you yourself find useful, or you have devised an |
| 34 |
amusing way of installing gentoo, please dont hesitate to write something |
| 35 |
up and <mail link="lordviram@rebelpacket.net">send it to me.</mail></p> |
| 36 |
|
| 37 |
|
| 38 |
</body> |
| 39 |
</section> |
| 40 |
</chapter> |
| 41 |
|
| 42 |
<chapter> |
| 43 |
<title>Netboot install</title> |
| 44 |
<section> |
| 45 |
<title>Requirements</title> |
| 46 |
<body> |
| 47 |
<p>The requirements for a netboot install are a host computer than can |
| 48 |
provide a tftp server and a computer |
| 49 |
that can netboot itself via either bios or a floppy drive used to boot GRUB |
| 50 |
or another network bootloader. A dhcp server might also be necessary. Of |
| 51 |
course, you will also need the latest build ISO, which can be found at |
| 52 |
<uri>http://www.ibiblio.org/gentoo/releases/build/</uri></p> |
| 53 |
</body> |
| 54 |
</section> |
| 55 |
|
| 56 |
<section> |
| 57 |
<title>Overview</title> |
| 58 |
<body> |
| 59 |
|
| 60 |
<p>In order to load images off the network, the first thing a netboot machine |
| 61 |
must do is obtain an IP address. There are multiple ways of obtaining |
| 62 |
an IP address, and any |
| 63 |
one of them will do. Personally, I prefer to use GRUB for everything, but if |
| 64 |
your computer supports booting from a network already then grub might not |
| 65 |
be necessary, even if it might be easier to just use GRUB's <c>ifconfig</c> command |
| 66 |
instead of setting up a bootp or dhcp server.</p> |
| 67 |
|
| 68 |
<p>Once your computer has obtained an IP address, the next logical step is to find |
| 69 |
out what you are going to be booting and where it might be held. Once again, |
| 70 |
it would be easiest to do this with GRUB commands as opposed to setting up |
| 71 |
a bootp or dhcp server. You will also need to specify how to obtain an initrd |
| 72 |
and tell the kernel that it will be using this as it's root filesystem.</p> |
| 73 |
|
| 74 |
<p>With your kernel loaded and root filesystem mounted, you may proceed |
| 75 |
with installation as normal. The build image could be loaded from a cd, or it |
| 76 |
can be downloaded from the network via tftp.</p> |
| 77 |
|
| 78 |
</body> |
| 79 |
</section> |
| 80 |
<section> |
| 81 |
<title>Using GRUB</title> |
| 82 |
<body> |
| 83 |
|
| 84 |
<p>To use GRUB for network booting purposes, you must first have GRUB |
| 85 |
compiled with support for your network card. It doesn't matter if you install |
| 86 |
to floppy, or to the hard drive of the computer you wish to install Gentoo |
| 87 |
on. If your install target already has GRUB with network support installed, |
| 88 |
then you are one step ahead. GRUB can be downloaded from |
| 89 |
<uri>ftp://alpha.gnu.org/gnu/grub/</uri></p> |
| 90 |
|
| 91 |
<p>A configure example for enabling tulip support, the network card in my |
| 92 |
box:</p> |
| 93 |
|
| 94 |
<pre caption="Manual GRUB installation"> |
| 95 |
# <i>./configure --enable-tulip --prefix=/usr</i> |
| 96 |
# <i>make && make install</i> |
| 97 |
</pre> |
| 98 |
|
| 99 |
<p>If you are currently in Gentoo and wish to install GRUB using Gentoo |
| 100 |
tools, then you need to install step by step in order to configure in support |
| 101 |
for your network card. An example for using ebuild to install GRUB with |
| 102 |
tulip support:</p> |
| 103 |
|
| 104 |
<pre caption="Installing and configuring GRUB on Gentoo Linux"> |
| 105 |
# <i>ebuild /usr/portage/sys-apps/grub/grub-0.91.ebuild clean fetch unpack</i> |
| 106 |
# <i>cd /var/tmp/portage/grub-0.91/work/grub-0.91/</i> |
| 107 |
# <i>./configure --prefix=/usr --sbindir=/sbin --mandir=/usr/share/man \ </i> |
| 108 |
> <i>--infodir=/usr/share/info --enable-tulip</i> |
| 109 |
# <i>make</i> |
| 110 |
# <i>touch /var/tmp/portage/grub-0.91/.compiled</i> |
| 111 |
# <i>cd /usr/portage/</i> |
| 112 |
# <i>ebuild sys-apps/grub/grub-0.91.ebuild install merge</i> |
| 113 |
</pre> |
| 114 |
|
| 115 |
<p>Now that we have the GRUB shell itself installed, we need to install to |
| 116 |
a boot sector. Although you could install GRUB to the boot sector of your |
| 117 |
install computer's hard drive, here we will assume that you are installing |
| 118 |
GRUB on a boot floppy. There are two ways of doing this. You can use the GRUB |
| 119 |
shell itself, or you can use a provided script called <c>grub-install</c>. It is |
| 120 |
preferable to use <c>grub-install</c> when installing GRUB to a floppy.</p> |
| 121 |
|
| 122 |
<pre caption="grub-install example"> |
| 123 |
# <i>mkfs.ext2 /dev/fd0</i> |
| 124 |
# <i>mount /dev/fd0 /mnt/floppy/</i> |
| 125 |
# <i>grub-install --root-directory=/mnt/floppy/ '(fd0)'</i> |
| 126 |
# <i>umount /mnt/floppy/</i> |
| 127 |
</pre> |
| 128 |
|
| 129 |
<p><c>grub-install</c> does not always work... and isn't always the best way to install |
| 130 |
GRUB. And since the GRUB shell works exactly like GRUB would when booted |
| 131 |
via the boot sector, it might be more desirable just to use the GRUB shell. Here |
| 132 |
is an example of how to use the GRUB shell to install GRUB to a floppy:</p> |
| 133 |
|
| 134 |
<pre caption="Using the GRUB shell instead"> |
| 135 |
# <i>mkfs.ext2 /dev/fd0</i> |
| 136 |
# <i>mount /dev/fd0 /mnt/floppy/</i> |
| 137 |
# <i>mkdir -p /mnt/floppy/boot/grub/</i> |
| 138 |
# <i>cp -v /usr/share/grub/i386-pc/* /mnt/floppy/boot/grub/</i> |
| 139 |
# <i>grub</i> |
| 140 |
grub> <i>root (fd0)</i> |
| 141 |
grub> <i>setup (fd0)</i> |
| 142 |
grub> <i>quit</i> |
| 143 |
# <i>umount /mnt/floppy/</i> |
| 144 |
</pre> |
| 145 |
|
| 146 |
<p>Now that we have a bootable GRUB floppy, we need to set up the host tftp server |
| 147 |
(I suggest netkit's tftp server) |
| 148 |
for loading our kernel and initrd. If you use inetd then you will need |
| 149 |
a line in your <path>/etc/inetd.conf</path> that looks |
| 150 |
like this:</p> |
| 151 |
|
| 152 |
<pre caption="/etc/inetd.conf"> |
| 153 |
tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd |
| 154 |
</pre> |
| 155 |
|
| 156 |
<p>To install the netkit tftp server under gentoo linux, emerge net-misc/netkit-tftp</p> |
| 157 |
|
| 158 |
<note>There is an ebuild for xinetd... if you prefer to use this than feel free to do |
| 159 |
so. However I do not use xinetd, and do not know how to set up tftp with it. If you |
| 160 |
use it and such, please send me info on how to get xinetd working and I will include |
| 161 |
them in this howto.</note> |
| 162 |
|
| 163 |
<p>Now that we have our tftp server ready, we need a kernel and a root initrd to |
| 164 |
put in it. You can compile a custom kernel yourself, but make sure it has all the |
| 165 |
things necessary for running gentoo (like devfs) and for netbooting (like initrd |
| 166 |
support). The root initrd will be the rescue.gz included in the gentoo ISO.</p> |
| 167 |
|
| 168 |
<impo>Mounting an ISO file without burning it to cd requires loopback filesystem |
| 169 |
support.</impo> |
| 170 |
|
| 171 |
<pre> |
| 172 |
# <i>mkdir /tftpboot</i> |
| 173 |
# <i>mount -o loop /path/to/gentoo-ix86-1.1a.iso /mnt/cdrom/</i> |
| 174 |
# <i>cp /mnt/cdrom/isolinux/kernel /mnt/cdrom/isolinux/rescue.gz /tftpboot</i> |
| 175 |
# <i>chmod 644 /tftpboot/*</i> |
| 176 |
# <i>umount /mnt/cdrom/</i> |
| 177 |
</pre> |
| 178 |
|
| 179 |
<p>Boot the machine you want to install to with your incredibly usefull grub floppy. |
| 180 |
Once booted you need to specify a way for the machine to get |
| 181 |
its IP address, specify where |
| 182 |
to get a kernel and it's options, and where to get it's initrd.</p> |
| 183 |
|
| 184 |
<pre> |
| 185 |
grub> <i>ifconfig --address=192.168.0.10 --server=192.168.0.2</i> |
| 186 |
grub> <i>root (nd)</i> |
| 187 |
grub> <i>kernel /tftpboot/kernel devfs=nomount vga=normal load_ramdisk=1 </i> |
| 188 |
<i>prompt_ramdisk=0 ramdisk_size=24000 root=/dev/ram0 rw</i> <comment>(all on one line)</comment> |
| 189 |
grub> <i>initrd /tftpboot/rescue.gz</i> |
| 190 |
grub> <i>boot</i> |
| 191 |
</pre> |
| 192 |
|
| 193 |
<note>You can also use bootp and dhcp to configure your ip via grub. Use the bootp |
| 194 |
and dhcp commands.</note> |
| 195 |
|
| 196 |
<p>Now that you have your machine booted, you can install as normal. Refer to the |
| 197 |
from source cd install howto.</p> |
| 198 |
|
| 199 |
</body> |
| 200 |
</section> |
| 201 |
</chapter> |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
<chapter> <title>Installing Gentoo from an existing Linux distribution </title> |
| 208 |
<section> <title> Requirements </title> |
| 209 |
<body> |
| 210 |
<p>In order to install Gentoo from your existing Linux distribution you need to |
| 211 |
have chroot command installed, and have a copy of the Gentoo installation |
| 212 |
tarball or ISO you want to install. A network connection would be preferable if |
| 213 |
you want more than what's supplied in your tarball. (by the way, a tarball is |
| 214 |
just a file ending in .tbz or .tar.gz). The author used RedHat Linux 7.3 as the |
| 215 |
"host" operating system, but it is not very important. Let's get started! </p> |
| 216 |
</body> |
| 217 |
</section> |
| 218 |
|
| 219 |
<section> <title> Overview </title> |
| 220 |
<body> |
| 221 |
<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> |
| 222 |
</body> |
| 223 |
</section> |
| 224 |
|
| 225 |
<section> <title> How should we make space for gentoo? </title> |
| 226 |
<body> |
| 227 |
|
| 228 |
<p> |
| 229 |
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> |
| 230 |
|
| 231 |
|
| 232 |
<pre caption="Filesystem information"> |
| 233 |
# <i>mount</i> |
| 234 |
/dev/hdb2 on / type ext3 (rw) |
| 235 |
none on /proc type proc (rw) |
| 236 |
none on /dev/pts type devpts (rw,gid=5,mode=620) |
| 237 |
none on /dev/shm type tmpfs (rw) |
| 238 |
# <i>df -h </i> |
| 239 |
Filesystem Size Used Avail Use% Mounted on |
| 240 |
/dev/hdb2 4.0G 1.9G 2.4G 82% / |
| 241 |
none 38M 0 38M 0% /dev/shm |
| 242 |
</pre> |
| 243 |
|
| 244 |
<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> |
| 245 |
|
| 246 |
</body> </section> |
| 247 |
|
| 248 |
<section> <title> Building parted to resize partition </title> |
| 249 |
<body> |
| 250 |
<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> |
| 251 |
http://www.gnu.org/software/parted/ </uri> |
| 252 |
</p> |
| 253 |
<note> There are other tools for doing resize of partitions as well, but author |
| 254 |
is unsure/uninterested whether PartitionMagic(tm) or other software of the kind |
| 255 |
do the job. It's the reader's job to check them out </note> |
| 256 |
|
| 257 |
<p> |
| 258 |
Look up on that page the type of filesystem you want to resize and see if parted |
| 259 |
can do it. If not, you're out of luck, you will have to destroy some partition |
| 260 |
to make space for gentoo, and reinstall back. Go ahead by downloading the |
| 261 |
software, install it. Here we have a problem. We want to resize our Linux root |
| 262 |
partition, therefore we must boot from a floppy disk a minimal linux system and |
| 263 |
use previously-compiled parted copied to a diskette in order to resize "/". |
| 264 |
However, if you can unmount the partition while still in Linux you are lucky, |
| 265 |
you don't need to do what follows. Just compile parted and run it on an |
| 266 |
unmounted partition you chose to resize. Here's how I did it for my system. |
| 267 |
</p> |
| 268 |
|
| 269 |
<impo> Make sure that the operations you want to do on your partition are |
| 270 |
supported by parted! </impo> |
| 271 |
|
| 272 |
<p> Get tomsrtbt boot/root disk (free of charge) from <uri> |
| 273 |
http://freshmeat.net/tomsrtbt" </uri>, create a floppy as suggested in the |
| 274 |
Documentation that accompanies the software package and insert a new floppy in |
| 275 |
the drive for the next step. </p> |
| 276 |
|
| 277 |
<note> Note again that Linux is synonym of "There's one more way to do it". Your |
| 278 |
objective is to run parted on an unmounted partition so it can do its work. You |
| 279 |
might use some other boot/root diskset other than tomsrtbt. You might not even |
| 280 |
need to do this step at all, that is only umount the filesystem you want to |
| 281 |
repartition in your Linux session and run parted on it. </note> |
| 282 |
|
| 283 |
<pre caption="Utility disk creation"> |
| 284 |
# <i>mkfs.minix /dev/fd0</i> |
| 285 |
480 inodes |
| 286 |
1440 blocks |
| 287 |
Firstdatazone=19 (19) |
| 288 |
Zonesize=1024 |
| 289 |
Maxsize=268966912 |
| 290 |
</pre> |
| 291 |
|
| 292 |
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. |
| 293 |
|
| 294 |
<pre caption="Building the utility floppy"> |
| 295 |
# <i> mkdir /floppy; mount -t minix /dev/fd0 /floppy && |
| 296 |
export CFLAGS="-O3 -pipe -fomit-frame-pointer -static" && ./configure |
| 297 |
&& make && cp parted/parted /floppy && umount /floppy </i> |
| 298 |
</pre> |
| 299 |
|
| 300 |
<p> |
| 301 |
Congratulations, you are ready to reboot and resize your partition. Do this only |
| 302 |
after taking a quick look at the parted documentation on the GNU website. The |
| 303 |
resize should take under 30 minutes for the largest hard-drives, be patient. |
| 304 |
Reboot your system with the tomsrtbt boot disk (just pop it inside), and once |
| 305 |
you are logged in, switch the disk in the drive with your utility disk we have |
| 306 |
created above and type mount /dev/fd0 /floppy to have parted under /floppy. |
| 307 |
There you go. Run parted and you will be able to resize your partition. Once |
| 308 |
this lenghty process done, we are ready to have the real fun, by installing |
| 309 |
gentoo. Reboot back into your old Linux system for now. Drive youwish to operate |
| 310 |
on is the drive containing the partition we want to resize. For example, if we |
| 311 |
want to resize /dev/hda3, the drive is /dev/hda </p> |
| 312 |
|
| 313 |
<pre caption="Commands to run once logged into tomsrtbt system"> |
| 314 |
# <i>mount /dev/fd0 /floppy </i> |
| 315 |
# <i>cd /floppy; ./parted [drive you wish to operate on]</i> |
| 316 |
(parted) <i> print </i> |
| 317 |
Disk geometry for /dev/hdb: 0.000-9787.148 megabytes |
| 318 |
Disk label type: msdos |
| 319 |
Minor Start End Type Filesystem Flags |
| 320 |
1 0.031 2953.125 primary ntfs |
| 321 |
3 2953.125 3133.265 primary linux-swap |
| 322 |
2 3133.266 5633.085 primary ext3 |
| 323 |
4 5633.086 9787.148 extended |
| 324 |
5 5633.117 6633.210 logical |
| 325 |
6 6633.242 9787.148 logical ext3 |
| 326 |
(parted) <i> help resize </i> |
| 327 |
resize MINOR START END resize filesystem on partition MINOR |
| 328 |
|
| 329 |
MINOR is the partition number used by Linux. On msdos disk labels, the |
| 330 |
primary partitions number from 1-4, and logical partitions are 5 |
| 331 |
onwards. |
| 332 |
START and END are in megabytes |
| 333 |
(parted) <i> resize 2 3133.266 4000.000 </i> |
| 334 |
</pre> |
| 335 |
|
| 336 |
<impo> Be patient! The computer is working! Just look at the hardware LED on |
| 337 |
your case to see that it is really working. This should take between 2 and 30 |
| 338 |
minutes. </impo> |
| 339 |
|
| 340 |
<p>Once you have resized, boot back into your old linux as described. Then go to |
| 341 |
<uri link="/doc/build.html">http://www.gentoo.org/doc/build.html</uri> and follow steps 6, 7, 9 through |
| 342 |
17. |
| 343 |
|
| 344 |
|
| 345 |
Enjoy! |
| 346 |
</p> |
| 347 |
</body> |
| 348 |
</section> |
| 349 |
</chapter> |
| 350 |
</guide> |