Configuring essential software

Now that all software is installed, all that we need to do to get a few programs running properly is to create their configuration files.

Configuring Glibc

We need to create the /etc/nsswitch.conf file. Although glibc should provide defaults when this file is missing or corrupt, it's defaults don't work work well with networking which will be dealt with in a later chapter. Also, our timezone needs to be setup.

Create a new file /etc/nsswitch.conf containing:



# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: db files

# End /etc/nsswitch.conf

Run the tzselect script and answer the questions regarding your timezone. When you're done, the script will give you the location of the timezone file you need.

Create the /etc/localtime symlink by running:



root:~# cd /etc
root:/etc# rm localtime
root:/etc# ln -s ../usr/share/zoneinfo/<tzselect's output> \
> localtime

tzselect's output can be something like EST5EDT or Canada/Eastern. The symlink you would create with that information would be ln -s ../usr/share/zoneinfo/EST5EDT localtime or ln -s ../usr/share/zoneinfo/Canada/Eastern localtime

Configuring Lilo

We're not going to create lilo's configuration file from scratch, but we'll use the file from your normal Linux system. This file is different on every machine and thus I can't create it here. Since you would want to have the same options regarding lilo as you have when you're using your normal Linux system you would create the file exactly as it is on the normal system.

Copy the Lilo configuration file and kernel images that Lilo uses by running the following commands from a shell on your normal Linux system. Don't execute these commands from your chroot'ed shell.



root:~# cp /etc/lilo.conf $LFS/etc
root:~# cp /boot/* $LFS/boot

If your normal Linux system does not have (all of) it's kernel images in /boot, then check your /etc/lilo.conf file for the location of those files and copy those as well to the location where /etc/lilo.conf expects them to be. Or you can copy them to /boot regardless and modify the /etc/lilo.conf file so it contains the new paths for the images as you have them on the LFS system. Either way works fine, it's up to you how you want to do it.

Configuring Sysklogd

Create the /etc/syslog.conf file containing the following:



# Begin /etc/syslog.conf

auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *

# End /etc/syslog.conf

Configuring Shadow Password Suite

This package contains the utilities to modify user's passwords, add new users/groups, delete users/groups and more. I'm not going to explain to you what 'password shadowing' means. You can read all about that in the doc/HOWTO file. There's one thing you should keep in mind, if you decide to use shadow support, that programs that need to verify passwords (examples are xdm, ftp daemons, pop3 daemons, etc) need to be 'shadow-compliant', eg. they need to be able to work with shadowed passwords.

If you decide you don't want to use shadowed passwords (after you're read the doc/HOWTO document), you still use this archive since the utilities in this archive are also used on system which have shadowed passwords disabled. You can read all about this in the HOWTO. Also note that you can switch between shadow and non-shadow at any point you want.

Now is a very good moment to read chapter 5 of the doc/HOWTO file. You can read how you can test if shadowing works and if not, how to disable it. If it doesn't work and you haven't tested it, you'll end up with an unusable system after you logout of all your consoles, since you won't be able to login anymore. You can easily fix this by passing the init=/sbin/sulogin parameter to the kernel, unpack the util-linux archive, go to the login-utils directory, build the login program and replace the /bin/login by the one in the util-linux package. Things are never hopelessly messed up (at least not under Linux), but you can avoid a hassle by testing properly and reading manuals ;)

Configuring Sysvinit

Create a new file /etc/inittab containing the following:



# Begin /etc/inittab

id:2:initdefault:

si::sysinit:/etc/init.d/rcS

su:S:wait:/sbin/sulogin

l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

ft:6:respawn:/sbin/sulogin

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

1:2345:respawn:/sbin/agetty /dev/tty1 9600
2:2345:respawn:/sbin/agetty /dev/tty2 9600
3:2345:respawn:/sbin/agetty /dev/tty3 9600
4:2345:respawn:/sbin/agetty /dev/tty4 9600
5:2345:respawn:/sbin/agetty /dev/tty5 9600
6:2345:respawn:/sbin/agetty /dev/tty6 9600

# End /etc/inittab

Creating the /var/run/utmp file

Programs like login, shutdown, uptime and others want to read from and write to the /var/run/utmp file. This file contains information about who is currently logged in. It also contains information on when the computer was last booted and shutdown.

Create the /var/run/utmp and give it the proper permissions by running the following commands:



root:~# touch /var/run/utmp
root:~# chmod 644 /var/run/utmp

Configuring Vim

By default Vim runs in vi compatible mode. Some people might like this, but I have a high preference to run vim in vim mode (else I wouldn't have included Vim in this book but the original Vi). Create the /root/.vimrc containing the following:



set nocompatible
set bs=2