6.54. 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.

6.54.1. 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 by running the following:


cat > /root/.vimrc << "EOF"
" Begin /root/.vimrc

set nocompatible
set bs=2

" End /root/.vimrc
EOF

6.54.2. 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 by running the following:


cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

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

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:


cd /etc &&
rm localtime &&
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

6.54.3. 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 by running the following:


cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf

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

# End /etc/ld.so.conf
EOF

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.

6.54.4. 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.


cp /etc/lilo.conf $LFS/etc
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.

6.54.5. Configuring Sysklogd

Create a new file /etc/syslog.conf by running the following:


cat > /etc/syslog.conf << "EOF"
# 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
EOF

6.54.6. 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.

The documentation mentions something about the creastion of npasswd and nshadow after you run pwconv. This is an error in the documentation. Those two files will be be created. After you run pwconv, /etc/passwd will no longer contain the passwords and /etc/shadow will. You don't need to rename the npasswd and nshadow files yourself.

6.54.7. Configuring Sysvinit

Create a new file /etc/inittab by running the following:


cat > /etc/inittab << "EOF"
# 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

ft:06:respawn:/sbin/sulogin

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

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

# End /etc/inittab
EOF

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


touch /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog &&
chmod 644 /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog

6.54.9. Creating root password

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


passwd root