Gentoo Logo

Disclaimer : This handbook has been replaced by a newer version and is not maintained anymore.

[ << ] [ < ] [ Home ] [ > ] [ >> ]

8. Configuring your System


8.a. Filesystem Information

What is fstab?

Under Linux, all partitions used by the system must be listed in /etc/fstab. This file contains the mountpoints of those partitions (where they are seen in the file system structure), how they should be mounted and with what special options (automatically or not, whether users can mount them or not, etc.)

Creating /etc/fstab

/etc/fstab uses a special syntax. Every line consists of six fields, separated by whitespace (space(s), tabs or a mixture). Each field has its own meaning:

  • The first field shows the partition described (the path to the device file)
  • The second field shows the mountpoint at which the partition should be mounted
  • The third field shows the filesystem used by the partition
  • The fourth field shows the mountoptions used by mount when it wants to mount the partition. As every filesystem has its own mountoptions, you are encouraged to read the mount man page (man mount) for a full listing. Multiple mountoptions are comma-separated.
  • The fifth field is used by dump to determine if the partition needs to be dumped or not. You can generally leave this as 0 (zero).
  • The sixth field is used by fsck to determine the order in which filesystems should be checked if the system wasn't shut down properly. The root filesystem should have 1 while the rest should have 2 (or 0 if a filesystem check isn't necessary).

Important: The default /etc/fstab file provided by Gentoo is not a valid fstab file. You have to create your own /etc/fstab.

Code Listing 1.1: Opening /etc/fstab

# nano -w /etc/fstab

Add the rules that match your partitioning schema and append rules for /proc/openprom, for your CD-ROM drive(s), and of course, if you have other partitions or drives, for those too.

Now use the example below to create your /etc/fstab:

Code Listing 1.2: A full /etc/fstab example

/dev/sda1   /               ext3        noatime              0 1
/dev/sda2   none            swap        sw                   0 0
/dev/sda4   /usr            ext3        noatime              0 2
/dev/sda5   /var            ext3        noatime              0 2
/dev/sda6   /home           ext3        noatime              0 2

openprom    /proc/openprom  openpromfs  defaults             0 0

/dev/cdrom  /mnt/cdrom      auto        noauto,user          0 0

auto makes mount guess for the filesystem (recommended for removable media as they can be created with one of many filesystems) and user makes it possible for non-root users to mount the CD.

To improve performance, most users would want to add the noatime mount option, which results in a faster system since access times aren't registered (you don't need those generally anyway).

Double-check your /etc/fstab, save and quit to continue.

8.b. Networking Information

Hostname, Domainname etc.

One of the choices the user has to make is name his/her PC. This seems to be quite easy, but lots of users are having difficulties finding the appropriate name for their Linux-pc. To speed things up, know that any name you choose can be changed afterwards. For all we care, you can just call your system tux and domain homenetwork.

We use these values in the next examples. First we set the hostname:

Code Listing 2.1: Setting the hostname

# nano -w /etc/conf.d/hostname

(Set the HOSTNAME variable to your hostname)

Second, if you need a domainname, set it in /etc/conf.d/net. You only need a domain if your ISP or network administrator says so, or if you have a DNS server but not a DHCP server. You don't need to worry about DNS or domainnames if your networking is setup for DHCP.

Code Listing 2.2: Setting the domainname

# nano -w /etc/conf.d/net

(Set the dns_domain variable to your domain name)

Note: If you choose not to set a domainname, you can get rid of the "This is hostname.(none)" messages at your login screen by editing /etc/issue. Just delete the string .\O from that file.

If you have a NIS domain (if you don't know what that is, then you don't have one), you need to define that one too:

Code Listing 2.3: Setting the NIS domainname

# nano -w /etc/conf.d/net

(Set the nis_domain variable to your NIS domain name)

Note: For more information on configuring DNS and NIS, please read the examples provided in /etc/conf.d/net.example. Also, you may want to emerge resolvconf-gentoo to help manage your DNS/NIS setup.

Configuring your Network

Before you get that "Hey, we've had that already"-feeling, you should remember that the networking you set up in the beginning of the Gentoo installation was just for the installation. Right now you are going to configure networking for your Gentoo system permanently.

Note: More detailed information about networking, including advanced topics like bonding, bridging, 802.1Q VLANs or wireless networking is covered in the Gentoo Network Configuration section.

All networking information is gathered in /etc/conf.d/net. It uses a straightforward yet not intuitive syntax if you don't know how to set up networking manually. But don't fear, we'll explain everything. A fully commented example that covers many different configurations is available in /etc/conf.d/net.example.

DHCP is used by default and does not require any further configuration.

If you need to configure your network connection either because you need specific DHCP options or because you do not use DHCP at all, open /etc/conf.d/net with your favorite editor (nano is used in this example):

Code Listing 2.4: Opening /etc/conf.d/net for editing

# nano -w /etc/conf.d/net

You will see the following file:

Code Listing 2.5: Default /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).

To enter your own IP address, netmask and gateway, you need to set both config_eth0 and routes_eth0:

Code Listing 2.6: Manually setting IP information for eth0

config_eth0=( " netmask brd" )
routes_eth0=( "default via" )

To use DHCP and add specific DHCP options, define config_eth0 and dhcp_eth0:

Code Listing 2.7: Automatically obtaining an IP address for eth0

config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"

Please read /etc/conf.d/net.example for a list of all available options.

If you have several network interfaces repeat the above steps for config_eth1, config_eth2, etc.

Now save the configuration and exit to continue.

Automatically Start Networking at Boot

To have your network interfaces activated at boot, you need to add them to the default runlevel.

Code Listing 2.8: Adding net.eth0 to the default runlevel

# rc-update add net.eth0 default

If you have several network interfaces, you need to create the appropriate net.eth1, net.eth2 etc. initscripts for those. You can use ln to do this:

Code Listing 2.9: Creating extra initscripts

# cd /etc/init.d
# ln -s net.lo net.eth1
# rc-update add net.eth1 default

Writing Down Network Information

You now need to inform Linux about your network. This is defined in /etc/hosts and helps in resolving hostnames to IP addresses for hosts that aren't resolved by your nameserver. You need to define your system. You may also want to define other systems on your network if you don't want to set up your own internal DNS system.

Code Listing 2.10: Opening /etc/hosts

# nano -w /etc/hosts

Code Listing 2.11: Filling in the networking information

(This defines the current system)     tux.homenetwork tux localhost

(Define extra systems on your network,
they need to have a static IP to be defined this way.)   jenny.homenetwork jenny   benny.homenetwork benny

Save and exit the editor to continue.

8.c. System Information

Root Password

First we set the root password by typing:

Code Listing 3.1: Setting the root password

# passwd

If you want root to be able to log on through the serial console, add tts/0 to /etc/securetty:

Code Listing 3.2: Adding tts/0 to /etc/securetty

# echo "tts/0" >> /etc/securetty

System Information

Gentoo uses /etc/rc.conf for general, system-wide configuration. Open up /etc/rc.conf and enjoy all the comments in that file :)

Code Listing 3.3: Opening /etc/rc.conf

# nano -w /etc/rc.conf

When you're finished configuring /etc/rc.conf, save and exit.

As you can see, this file is well commented to help you set up the necessary configuration variables. You can configure your system to use unicode and define your default editor and your display manager (like gdm or kdm).

Gentoo uses /etc/conf.d/keymaps to handle keyboard configuration. Edit it to configure your keyboard.

Code Listing 3.4: Opening /etc/conf.d/keymaps

# nano -w /etc/conf.d/keymaps

Take special care with the KEYMAP variable. If you select the wrong KEYMAP, you will get weird results when typing on your keyboard.

When you're finished configuring /etc/conf.d/keymaps, save and exit.

Gentoo uses /etc/conf.d/clock to set clock options. Edit it according to your needs.

Code Listing 3.5: Opening /etc/conf.d/clock

# nano -w /etc/conf.d/clock

If your hardware clock is not using UTC, you need to add CLOCK="local" to the file. Otherwise you will notice some clock skew.

You should define the timezone that you previously copied to /etc/localtime so that further upgrades of the sys-libs/timezone-data package can update /etc/localtime automatically. For instance, if you used the GMT timezone, you would add TIMEZONE="GMT"

When you're finished configuring /etc/conf.d/clock, save and exit.

Please continue with Installing Necessary System Tools.

[ << ] [ < ] [ Home ] [ > ] [ >> ]


View all

Page updated August 13, 2007

Summary: You need to edit some important configuration files. In this chapter you receive an overview of these files and an explanation on how to proceed.

Sven Vermeulen

Grant Goodyear

Roy Marples

Daniel Robbins

Chris Houser

Jerry Alexandratos

Seemant Kulleen
Gentoo x86 Developer

Tavis Ormandy
Gentoo Alpha Developer

Jason Huebel
Gentoo AMD64 Developer

Guy Martin
Gentoo HPPA developer

Pieter Van den Abeele
Gentoo PPC developer

Joe Kallar
Gentoo SPARC developer

John P. Davis

Pierre-Henri Jondot

Eric Stockbridge

Rajiv Manglani

Jungmin Seo

Stoyan Zhekov

Jared Hudson

Colin Morey

Jorge Paulo

Carl Anderson

Jon Portnoy

Zack Gilburd

Jack Morgan

Benny Chuang


Joshua Kinard

Tobias Scherbaum

Xavier Neys

Joshua Saddler

Gerald J. Normandin Jr.

Donnie Berkholz

Ken Nowack

Lars Weiler

Donate to support our development efforts.

Copyright 2001-2014 Gentoo Foundation, Inc. Questions, Comments? Contact us.