Gentoo - base installation guide
By: John McFarlane
<john.mcfarlane@rockfloat.com>
I'm finished with this step
I'm finished with this step
I'm finished with this step
I'm finished with this step
I'm finished with this step
I'm finished with this step
Populate the computer's hostname to reflect your setup
Tell gentoo to load any necessary kernel modules at startup:
I'm finished with this step
I'm finished with this step
I'm finished with this step
This document was originally created on 01/17/2004
Last updated:
04/08/2007 @ 18:53
Abstract:
This document is a simplified version of the official gentoo
installation guide, with my personal choices.
Table of Contents:
- Download installation media
- Create a bootable cd from the installation media
- Boot from the universal cd
- Start sshd if you want to work from another computer
- Use fdisk to setup your partitions
- Create the file systems on the new partitions
- Get the disk drive ready for use
- Setup the raw gentoo system on the new disk
- Tweak /etc/make.conf to set compiler and packages settings
- Set GENTOO_MIRRORS variable, SYNC server, and DNS server(s)
- Mount the new gentoo system
- Set the time and install stuff you will want
- Compile a new kernel
- Configure networking
- Setup machine specific settings, set startup options
- Set the root password and add normal users
- Finish up
- TIP: Instructions to get into a broken system
- TIP: Extra stuff that might be handy
- Changelog
- Conventions used
1. Download installation media
Download the appropriate installation media: livecd-i686-installer-2006.1.iso
Here are a few solid links for the Cincinnati, Ohio area:
I'm finished with this step
Here are a few solid links for the Cincinnati, Ohio area:
2. Create a bootable cd from the installation media
root# cdrecord dev=/dev/hdc livecd-i686-installer-2006.1.iso
I'm finished with this step
3. Boot from the universal cd
Booting from the universal cd is really straightforward. Stick the cd
in, and turn restart your computer. Sometimes you need to update the
bios to specify the cdom to boot prior to the disk drive, this prevents
the bios from simply skipping the cdrom.
I'm finished with this step
4. Start sshd if you want to work from another computer
Sometimes it's nice to perform the installation from another computer that
has a graphical desktop for reading the documentation. To do this start
up sshd:
I'm finished with this step
# passwd
New password: (Enter your new password)
Re-enter password: (Re-enter your password)
# /etc/init.d/sshd start
# ifconfig | grep inet
Now you can connect from another computer using (xterm, rxvt, putty, etc):
user# ssh root@IP-ADDRESS
using the IP address you saw in the previous step, something like
1.2.3.4
5. Use fdisk to setup your partitions
This is the step where data will be destroyed from
your disk. Please stop if you are unsure that you want to continue.
At the console prompt startup fdisk
I'm finished with this step
At the console prompt startup fdisk
livecd# fdisk /dev/sda
If for some reason fdisk doesn't work (happend to me with the 2005.1 Livecd
you might want to try cfdisk. It's a menu driven alternative, it's actually
quite nice!
livecd# cfdisk /dev/sda
- Type p to view the current partitions.
- Use d to delete each of the existing partitions
- Do each of the following (each has # explanation of command):
n # Create a new partition p # This is a primary partition 1 # It's to be the first partition # Just hit enter to start at the first cylinder +64m # This partition is to be 64 megs large a # Set the bootable flag 1 # On the first partition n # Create a new partition p # This is a primary partition 2 # It's to be the second partition # Just hit enter to start at the first cylinder +512m # This partition is to be 512 megs large t # Alter the type of this partition 2 # Select the swap partition 82 # Set the type to "Linux Swap" n # Create a new partition p # This is a primary partition 3 # It's to be the second partition # Just hit enter to start at the first cylinder # Just hit enter to take all available space w # Write to disk q # Quit to exit fdisk
6. Create the file systems on the new partitions
livecd# mkfs /dev/sda1 # Make boot ext2
livecd# mkreiserfs /dev/sda3 # Make root reiserfs
livecd# mkswap /dev/sda2 # Create the swap signature
7. Get the disk drive ready for use
livecd# swapon /dev/sda2
livecd# mount /dev/sda3 /mnt/gentoo
livecd# mkdir /mnt/gentoo/boot
livecd# mount /dev/sda1 /mnt/gentoo/boot
livecd# date mmddhhmmyyyy #Month Day Hour Minute Year
8. Setup the raw gentoo system on the new disk
livecd# cd /mnt/gentoo
-
For an AMD Athlon, P3, P4, or Xeon processor:
livecd# wget ftp://ftp.ussg.iu.edu/pub/linux/gentoo/releases/x86/current/stages/stage3-i686-2006.1.tar.bz2 livecd# tar -xvjpf stage3-i686-2006.1.tar.bz2 - For other arches, you'll need to get the appropriate stage3
livecd# wget http://gentoo.mirrors.pair.com/snapshots/portage-latest.tar.bz2
livecd# tar -xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr
9. Tweak /etc/make.conf to set compiler and packages settings
Verify the following settings in nano -w /mnt/gentoo/etc/make.conf
I'm finished with this step
-
For an AMD Athlon processor:
CHOST="i686-pc-linux-gnu" CFLAGS="-march=athlon-tbird -O2 -pipe -fomit-frame-pointer" -
For an Intel Xeon or P4 processor:
CHOST="i686-pc-linux-gnu" CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
USE="-X -gtk -kde -qt python postgres gd png jpeg xml truetype unicode"
See here
for a list of available USE flags.
10. Set GENTOO_MIRRORS variable, SYNC server, and DNS server(s)
livecd# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
livecd# mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
livecd# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
11. Mount the new gentoo system
livecd# mount -t proc none /mnt/gentoo/proc
livecd# mount -o bind /dev /mnt/gentoo/dev
livecd# chroot /mnt/gentoo /bin/bash
root# env-update
root# source /etc/profile
root# export PS1="(chroot) $PS1"
12. Set the time and install stuff you will want
root# cp /usr/share/zoneinfo/EST5EDT /etc/localtime
root# emerge --sync
root# emerge -a gentoo-sources \
grub \
dhcp \
hotplug \
vixie-cron \
syslog-ng \
reiserfsprogs \
gentoolkit \
ntp \
screen \
vim
For anyone who's interested, I also keep a list of
recommended ebuilds
.
13. Compile a new kernel
See the dedicated Kernel howto here
I'm finished with this step
14. Configure networking
Edit /etc/conf.d/net and add one of these:
I'm finished with this step
# For DHCP
config_eth0=( "dhcp" )
# For static IP using CIDR notation
config_eth0=( "192.168.0.7/24" )
routes_eth0=( "default via 192.168.0.1" )
# For static IP using netmask notation
config_eth0=( "192.168.0.7 netmask 255.255.255.0" )
routes_eth0=( "default gw 192.168.0.1" )
15. Setup machine specific settings, set startup options
root# rc-update add hostname default
root# rc-update add net.eth0 default
root# rc-update add hotplug default
root# rc-update add vixie-cron default
root# rc-update add sshd default
root# rc-update add syslog-ng default
root# rc-update add ntpd default
root# rc-update add ntp-client default
Populate the computer's hostname to reflect your setup
root# nano -w /etc/conf.d/hostname
# Set to the hostname of this machine
HOSTNAME="monkey"
root# nano -w /etc/conf.d/domainname
# When setting up resolv.conf, what should take precedence?
# If you wish to always override DHCP/whatever, set this to 1.
OVERRIDE=1
# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf
# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).
#
DNSDOMAIN="rockfloat.com"
Tell gentoo to load any necessary kernel modules at startup:
root# nano -w /etc/modules.autoload.d/kernel-2.6
# Make the bottom look like this
# For example:
# 3c59x
e100
root# modules-update # This is similar to env-update, or rc-update kinda
16. Set the root password and add normal users
root# passwd root
root# useradd -m -G users,audio -s /bin/bash foouser
root# passwd foouser
root# useradd -m -G users,audio,wheel,portage -s /bin/bash barsuperuser
root# passwd barsuperuser
If you want any users to be able to admin the computer, you
might wanna use sudo:
root# emerge app-admin/sudo
root# visudo
# Uncomment this line:
%wheel ALL=(ALL) ALL
This will let anyone in the wheel group execute any command
as root without being prompted for the root password.
17. Finish up
root# exit
livecd# cd
livecd# umount -l /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
livecd# reboot
18. TIP: Instructions to get into a broken system
If you happen to wind up with a broken system:
I'm finished with this step
- You forgot something critical in the kernel, and thus it won't boot
- You forgot the root password
livecd# swapon /dev/sda2
livecd# mount /dev/sda3 /mnt/gentoo
livecd# mount /dev/sda1 /mnt/gentoo/boot
livecd# mount -t proc none /mnt/gentoo/proc
livecd# mount -o bind /dev /mnt/gentoo/dev
livecd# chroot /mnt/gentoo /bin/bash
root# env-update
root# source /etc/profile
root# export PS1="(chroot) $PS1"
*** Do whatever you need, such as fix your kernel or reset root's password ***
root# exit
livecd# cd
livecd# umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
livecd# reboot
19. TIP: Extra stuff that might be handy
Here are some common things you might look for:
I'm finished with this step
/etc/conf.d/net # Network settings, like DHCP
/etc/modules.autoload.d/kernel-2.6 # Specify nic driver to load
/etc/conf.d/local.start # Arbitrary commands to execute at startup
/etc/init.d/net.eth0 restart # Restart networking
/etc/make.conf # USE variables
/etc/conf.d/hostname # Computer hostname
/etc/conf.d/domainname # Computer domainname
/etc/exports # NFS shares
/etc/make.profile # Profiles: /usr/portage/profiles/default-linux/...
/etc/portage/package.keywords # Set one ebuild to always install ~x86 or something
/etc/portage/package.mask # Prevent emerge -u world from upgrading something
/etc/apache2/* # Apache configuration settings
/var/log/emerge.log # Log file used by portage (what was last emerged)
~/.bashrc # Bash settings per user
emerge -s wget # Search for wget
emerge -a wget # Install something, like wget
emerge -C wget # Uninstall something like wget
eix -s wget # Search for wget (superior to emerge -s)
update-eix # Update the eix index
equery files wget | grep bin # Find binary for something installed, like wget
vipw # Edit /etc/passwd
vigr # Edit /etc/group
useradd # Add new users
userdel # Delete users and related files
usermod # Modify a users account
rc-update # Add/delete something like apache to startup
etc-update # Update config files after a package upgrade
modules-update # Update modules after changing modules.autoload.d
visudo # Edit the sudo config, who can do what basically
| Changelog: Date | Description |
|---|---|
| 07/04/2005 @ 15:00 | Overall rework for updates with 2005.0 |
| 07/06/2005 @ 20:49 | Fixed nasty typo, in grub.conf I had root=/dev/sda1 (should be sda3) |
| 07/06/2005 @ 21:00 | Added steps for modules.autoload.d, installing dhcpcd, and sudo |
| 11/02/2005 @ 22:00 | Updated formatting a bit, added cfdisk as an fdisk alternative |
| 11/02/2005 @ 22:15 | Made use flags more realistic, removed quicktime - no clue how that got there |
| 11/23/2005 @ 13:07 | Changed fstab to noauto for /boot |
| 12/11/2005 @ 14:00 | Moved the kernel stuff to a dedicated howto |
| 12/12/2005 @ 23:30 | Separated Athlon/Xeon, networking, formatting tweaks |
| 01/03/2006 @ 12:09 | Added ntp-client to the default runlevel |
| 06/24/2006 @ 01:21 | Updates for 2006.0 |
| 09/03/2006 @ 00:40 | Added lspci, dhclient, recommended ebuilds, updated for 2006.1 |
| 04/08/2007 @ 18:53 | Added dev mount per change in the Gentoo handbook |
This document was originally created on 01/17/2004
Conventions and tips for this howto document:
- This howto assumes you are installing on an IDE disk drive
- This howto assumes you will be using the grub boot manager
- This howto assumes that reiserfs is your preferred file system
- This howto assumes you are very patient
- This howto assumes you realize that knowing how to install gentoo drives chics wild!
Disclaimer:
This page is not endorsed by gentoo.org or any other cool
cats. Any information provided in this document is to be used
at your own risk.