- •255 Heads, 63 sectors/track, 72943 cylinders
- •Install the latest Portage snapshot. Proceed as for the stage3 archive: choose a nearby mirror from our list, download the latest snapshot and unpack it.
- •Install a kernel source (usually gentoo-sources), configure it, compile it and copy the arch/i386/boot/bzImage file to /boot.
- •Important: The following is only an example. It is in no way meant as a recommended setup.
1. Introduction
This guide contains all the commands you should use to complete a stage3 installation of Gentoo. You need a connection to the Internet to download the stage3 and Portage snapshots.
Important: New users should read the Handbook as it gives a better overview about the installation process. The Quick Install guide is designed for experienced users who just need a checklist to follow.
Timing output follows all commands that take more than a couple of seconds to finish. Commands were timed on an AMD 2000 1.66 Ghz PC with 512 MB of RAM and two SATA disks connected to a hardware controller.
Code Listing 1.1: Test box specs
(The following specs and the timing information should help you determine
a rough estimate of the time you need to complete your install)
# grep bogo /proc/cpuinfo
bogomips : 3337.81
# hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 1100 MB in 2.00 seconds = 549.97 MB/sec
Timing buffered disk reads: 224 MB in 3.01 seconds = 74.36 MB/sec
# grep MemTotal /proc/meminfo
MemTotal: 509248 kB
2. Quick Install Guide
Installation Media
Download a CD from one of our mirrors. You can find the minimal CD ISO in releases/x86/current-iso/. The minimal installation CD is only useful for Internet-based installations. This guide will use the minimal CD.
Burn the CD and boot it.
Booting the CD
Press F2 at the boot screen to find out what boot options exist. You can either start gentoo or gentoo-nofb, the latter disables the framebuffer. If you booted the LiveCD, don't forget to add the nox option to prevent the X graphical environment from starting. Several options allow to enable or disable some features. If all goes well, your hardware will be detected and all modules will be loaded. If the kernel fails to boot properly or if your computer hangs during the boot procedure, you may have to experiment with different configurations. The safest way is probably to use the nodetect option and then load required modules explicitly.
Code Listing 2.1: Boot the minimal CD
Gentoo Linux Installation LiveCD http://www.gentoo.org
Enter to Boot; F1 for kernels F2 for options.
boot: gentoo-nofb
(or in case of problems)
boot: gentoo-nofb nodetect
Optional: loading modules
If you used the nodetect option, once booted, load the required modules. You need to enable networking and have access to your disks. The lspci command can help you identify your hardware.
Code Listing 2.2: Load required modules
livecd root # lspci
(Use lspci's output to identify required modules)
(The following is an example, adapt it to your hardware)
livecd root # modprobe 3w-9xxx
livecd root # modprobe r8169
Network Configuration
If your network does not work already, you can use net-setup to configure your network. You might need to load support for your network card using modprobe prior to the configuration. If you have ADSL, use pppoe-setup and pppoe-start. For PPTP support, first edit /etc/ppp/chap-secrets and /etc/ppp/options.pptp and then use pptp <server ip>.
For wireless access, use iwconfig to set the wireless parameters and then use either net-setup again or run ifconfig, dhcpcd and/or route manually.
If you are behind a proxy, do not forget to initialize your system using export http_proxy, ftp_proxy and RSYNC_PROXY.
Code Listing 2.3: Configure networking the guided way
livecd root # net-setup eth0
Alternatively, you can start networking manually. The following example assigns the IP address 192.168.1.10 to your PC and defines 192.168.1.1 as your router and name server.
Code Listing 2.4: Configure networking the manual way
livecd root # ifconfig eth0 192.168.1.10/24
livecd root # route add default gw 192.168.1.1
livecd root # echo nameserver 192.168.1.1 > /etc/resolv.conf
The installation CD allows you to start an sshd server, add additional users, run irssi (a command-line chat client) and surf the web using links.
Optional: connect to your new box over ssh
The most interesting feature is of course sshd. You can start it and then connect from another machine and cut and paste commands from this guide.
Code Listing 2.5: Start sshd
livecd root # time /etc/init.d/sshd start
* Generating hostkey ...
(sshd generates the key and displays more output)
* starting sshd ... [ok]
real 0m13.688s
user 0m9.420s
sys 0m0.090s
Now, set the root password on the liveCD so that you can connect to it from another PC. Please note that allowing root to connect over ssh is not recommended under normal circumstances. If you can't trust your local network, use a long and complex password, you should use it only once as it will disappear after your first reboot.
Code Listing 2.6: Set the root password
livecd root # passwd
New UNIX password: type_a_password
Retype new UNIX password: type_a_password
passwd: password updated successfully
Now, you can start a terminal on another PC and connect to your new box, follow the rest of this guide in another window, and cut and paste commands.
Code Listing 2.7: Connect to your new box from another PC
(Use the IP address of your new box)
$ ssh root@192.168.1.10
The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
RSA key fingerprint is 96:e7:2d:12:ac:9c:b0:94:90:9f:40:89:b0:45:26:8f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.10' (RSA) to the list of known hosts.
Password: type_the_password
Preparing the Disks
Use fdisk or cfdisk to create your partition layout. You need at least a swap partition (type 82) and one Linux partition (type 83). The following scenario creates a /boot, a swap and a main partition as used in our handbook. Replace sda with your disk. Most systems ignore the bootable flag, but a few need it. Set this flag on your boot partition with fdisk's a command.
Code Listing 2.8: Create the partitions
livecd ~ # fdisk /dev/sda
(The rest of this guide uses the following partitioning scheme)
livecd ~ # fdisk -l /dev/sda
Disk /dev/sda: 599.9 GB, 599978409984 bytes
255 Heads, 63 sectors/track, 72943 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 12 96358+ 83 Linux
/dev/sda2 13 110 787185 82 Linux swap / Solaris
/dev/sda3 111 72943 585031072+ 83 Linux
Use mke2fs, mke2fs -j, mkreiserfs, mkfs.xfs and mkfs.jfs to create file systems on your Linux partitions. Initialize your swap partition using mkswap and swapon.
Code Listing 2.9: Create the file systems and activate swap
(ext2 is all you need on the /boot partition)
livecd ~ # mke2fs /dev/sda1
(Let's use ext3 on the main partition)
livecd ~ # mke2fs -j /dev/sda3
(Create and activate swap)
livecd ~ # mkswap /dev/sda2 && swapon /dev/sda2
Mount the freshly created file systems on /mnt/gentoo. Create directories for the other mount points (like /mnt/gentoo/boot) if you need them and mount them too.
Code Listing 2.10: Mount the file systems
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo
Setting Up The Stage
First make sure your date and time is set correctly using date MMDDhhmmYYYY. Use UTC time.
Code Listing 2.11: Set the date and UTC time
(Check the clock)
livecd gentoo # date
Mon Mar 6 00:14:13 UTC 2006
(Set the current date and time if required)
livecd gentoo # date 030600162006 (Format is MMDDhhmmYYYY)
Mon Mar 6 00:16:00 UTC 2006
Next, download a stage from one of our mirrors:
Code Listing 2.12: Download a stage3 archive
livecd gentoo # links http://www.gentoo.org/main/en/mirrors.xml
(Pick a mirror, move to the releases/x86/current-stage3/ directory,
highlight the stage3 of your choice, probably the i686 stage3, and press D to
download it)
(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # wget ftp://distfiles.gentoo.org/pub/gentoo/releases/x86/current-stage3/stage3-i686-*.tar.bz2
Go to /mnt/gentoo and unpack the stage using tar xjpf <stage3 tarball>.
Code Listing 2.13: Unpack the stage3 archive
livecd gentoo # time tar xjpf stage3*
real 1m14.157s
user 1m2.920s
sys 0m7.530s
Install the latest Portage snapshot. Proceed as for the stage3 archive: choose a nearby mirror from our list, download the latest snapshot and unpack it.
Code Listing 2.14: Download the latest Portage snapshot
livecd gentoo # cd /mnt/gentoo/usr
livecd usr # links http://www.gentoo.org/main/en/mirrors.xml
(Pick a mirror, move to the snapshots/ directory,
highlight portage-latest.tar.bz2 and press D to download it)
(Or download it directly with wget without choosing a nearby mirror)
livecd gentoo # cd /mnt/gentoo/usr
livecd usr # wget http://distfiles.gentoo.org/snapshots/portage-latest.tar.bz2
Code Listing 2.15: Unpack the Portage snapshot
livecd usr # time tar xjf portage-lat*
real 0m40.523s
user 0m28.280s
sys 0m8.240s
Chrooting
Mount the /proc & /dev file systems, copy over the /etc/resolv.conf file, then chroot into your Gentoo environment.
Code Listing 2.16: Chroot
livecd usr # cd /
livecd / # mount -t proc proc /mnt/gentoo/proc
livecd / # mount --rbind /dev /mnt/gentoo/dev
livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd / # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
Set your time zone
Set your time zone information by using the correct listing in /usr/share/zoneinfo.
Code Listing 2.17: Setting your timezone
livecd / # ls /usr/share/zoneinfo
(Using Brussels as an example)
livecd / # cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime
livecd / # date
Wed Mar 8 00:46:05 CET 2006
Set your host name and domain name
Set your host name in /etc/conf.d/hostname and /etc/hosts. In the following example, we use mybox as host name and at.myplace as domain name. You can either edit the config files with nano or use the following commands:
Code Listing 2.18: Set host and domain name
livecd / # cd /etc
livecd etc # echo "127.0.0.1 mybox.at.myplace mybox localhost" > hosts
livecd etc # sed -i -e 's/HOSTNAME.*/HOSTNAME="mybox"/' conf.d/hostname
(Use defined host name and check)
livecd etc # hostname mybox
livecd etc # hostname -f
mybox.at.myplace
Kernel Configuration