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.
By default vim runs in vi compatible mode. Some people might like this, but we have a high preference to run vim in vim mode (else we 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 |
We need to create the /etc/nsswitch.conf file. Although glibc should provide defaults when this file is missing or corrupt, its defaults don't work well with networking which will be dealt with in a later chapter. Also, our timezone needs to be set up.
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 |
The tzselect script has to be run and the questions regarding your timezone have to be answered. When you're done, the script will give the location of the needed timezone file.
Create the /etc/localtime symlink by running:
ln -sf ../usr/share/zoneinfo/<tzselect's output> /etc/localtime |
tzselect's output can be something like EST5EDT or Canada/Eastern.
The symlink you'd create with that information would be:
ln -sf ../usr/share/zoneinfo/EST5EDT /etc/localtime |
Or:
ln -sf ../usr/share/zoneinfo/Canada/Eastern /etc/localtime |
By default, the dynamic loader (/lib/ld-linux.so.2) searches through /lib and /usr/lib for dynamic libraries that are needed by programs when you run them. However, if there are libraries in directories other than /lib and /usr/lib, you need to add them to the /etc/ld.so.conf file in order for the dynamic loader to find them. Two directories that are commonly known to contain additional libraries are /usr/local/lib and /opt/lib, so we add those directories to the dynamic loader's search path.
Create a new file /etc/ld.so.conf by running the following:
cat > /etc/ld.so.conf << "EOF" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib # End /etc/ld.so.conf EOF |
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 |
This package contains utilities to modify users's passwords, add or delete users and groups, and the like. We're not going to explain what 'password shadowing' means. A full explanation can be found in the doc/HOWTO file within the unpacked shadow password suite's source tree. There's one thing to keep in mind if you decide to use shadow support: that programs that need to verify passwords (for example xdm, ftp daemons, pop3 daemons) need to be 'shadow-compliant', that is they need to be able to work with shadow'ed passwords.
To enable shadow'ed passwords, run the following command:
/usr/sbin/pwconv |
Create a new file /etc/inittab by running the following:
cat > /etc/inittab << "EOF" # Begin /etc/inittab id:3:initdefault: si::sysinit:/etc/rc.d/init.d/rc sysinit l0:0:wait:/etc/rc.d/init.d/rc 0 l1:S1:wait:/etc/rc.d/init.d/rc 1 l2:2:wait:/etc/rc.d/init.d/rc 2 l3:3:wait:/etc/rc.d/init.d/rc 3 l4:4:wait:/etc/rc.d/init.d/rc 4 l5:5:wait:/etc/rc.d/init.d/rc 5 l6:6:wait:/etc/rc.d/init.d/rc 6 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S016:once:/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 |
Nothing is more annoying than using Linux with a wrong keymap loaded for your keyboard. If you have a default US keyboard, you can skip this section. The US keymap file is the default if you don't change it.
To set the default keymap file, create the /usr/share/kbd/keymaps/defkeymap.map.gz symlink by running the following commands:
ln -s <path/to/keymap> /usr/share/kbd/keymaps/defkeymap.map.gz |
Replace <path/to/keymap> with the your keyboard's map file. For example, if you have a Dutch keyboard, you would run:
ln -s i386/qwerty/nl.map.gz /usr/share/kbd/keymaps/defkeymap.map.gz |
A second option to configure your keyboard's layout is to compile the keymap directly into the kernel. This will make sure that your keyboard always works as expected, even when you have booted into maintenance mode (by passing `init=/bin/sh' to the kernel) in which case the bootscript that normally sets up your keymap isn't run.
Run the following command to patch the correct keymap into the kernel source. You will have to repeat this command whenever you unpack a new kernel:
loadkeys -m /usr/share/kbd/keymaps/defkeymap.map.gz > \ /usr/src/linux/drivers/char/defkeymap.c |
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 attempts.
Create these files with their proper permissions by running the following commands:
touch /var/run/utmp /var/log/{btmp,lastlog,wtmp} && chmod 644 /var/run/utmp /var/log/{btmp,lastlog,wtmp} |
Choose a password for user root and create it by running the following command:
passwd root |