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 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:



" Begin /root/.vimrc

set nocompatible
set bs=2

" End /root/.vimrc

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 the following:



# 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 Dynamic Loader

By default the dynamic loader searches a few default paths for dynamic libraries, so there normally isn't a need for the /etc/ld.so.conf file unless you have extra directories in which you want the system to search for paths. The /usr/local/lib directory isn't searched through for dynamic libraries by default, so we want to add this path so when you install software you won't be suprised by them not running for some reason.

Create a new file /etc/ld.so.conf containing the following:



# Begin /etc/ld.so.conf

/lib
/usr/lib
/usr/local/lib

# End /etc/ld.so.conf


Although it's not necessary to add the /lib and /usr/lib directories it doesn't hurt. This way you see right away what's being searched and don't have to remeber the default search paths if you don't want to.

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/<kernel images> $LFS/boot

Before you can execute the second command you need to know the names of the kernel images. You can't just copy all files from the /boot directory. The /etc/lilo.conf file contains the names of the kernel images you're using. Open the file and look for lines like this:


image=/boot/vmlinuz

Look for all image variables and their values represent the name and location of the image files. These files will usually be in /boot but they might be in other directories as well, depending on your distribution's conventions.

Configuring Sysklogd

Create a new file /etc/syslog.conf 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 within the unpacked shadow password suite's source tree. 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 shadow'ed passwords.

Shadow'ed passwords are not enabled by default. Simply installing the shadow password suite does not enable shadow'ed passwords.

Now is a very good moment to read chapter 5 of the doc/HOWTO file. You can read how you can enable shadow'ed passwords, how to test whether shadowing works and if not, how to disable it again.

Configuring Sysvinit

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



# Begin /etc/inittab

id:3:initdefault:

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

l0:0:wait:/etc/init.d/rc 0
l1:S1: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

f1:0:respawn:/sbin/sulogin
f2:6:respawn:/sbin/sulogin

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

su:S1:respawn:/sbin/sulogin
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, /var/log/wtmp and /var/log/btmp files

Programs like login, shutdown, uptime and others want to read from and write to the /var/run/utmp /var/log/btmp and /var/log/wtmp. These files contain information about who is currently logged in. It also contains information on when the computer was last booted and shutdown and a record of the bad login attemps.

Create these files with their proper permissions by running the following commands:



root:~# touch /var/run/utmp /var/log/wtmp /var/log/btmp
root:~# chmod 644 /var/run/utmp /var/log/wtmp /var/log/btmp

Creating root password

Choose a password for user root and create it by running the following command:



root:~# passwd root