2 Installing And Configuring The Rest Of The System
Configure The Network
Because the Debian Sarge installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.100):
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) |
If you want to add the IP address 192.168.0.101 to the interface eth0 you should change the file to look like this:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) |
Then restart your network:
/etc/init.d/networking restart
Edit /etc/resolv.conf and add some nameservers:
search server |
Edit /etc/hosts and add your new IP addresses:
127.0.0.1 localhost.localdomain localhost server1 |
Setting The Hostname
echo server1.example.com
> /etc/hostname
/bin/hostname -F /etc/hostname
Install/Remove Some Software
Now let's install some software we need later on and remove some packages that we do not need:
apt-get install wget bzip2
rdate fetchmail libdb3++-dev unzip zip ncftp xlispstat libarchive-zip-perl zlib1g-dev
libpopt-dev nmap openssl lynx fileutils g++
apt-get remove lpr nfs-common
portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
update-rc.d -f exim remove
update-inetd --remove
daytime
update-inetd --remove telnet
update-inetd --remove time
update-inetd --remove finger
update-inetd --remove talk
update-inetd --remove ntalk
update-inetd --remove ftp
update-inetd --remove discard
<- Yes
/etc/init.d/openbsd-inetd reload
Quota
apt-get install quota quotatool
<- No
Edit /etc/fstab to look like this (I added ,usrquota,grpquota to the partition with the mount point /):
# /etc/fstab: static file system information. |
Then run:
touch /quota.user /quota.group
chmod 600 /quota.*
mount -o remount /
quotacheck -avugm
quotaon -avug
DNS-Server
apt-get install bind9
For security reasons we want to run BIND chrooted so we have to do the following steps:
/etc/init.d/bind9 stop
Edit the file /etc/default/bind9 so that the daemon will run as the unprivileged user 'bind', chrooted to /var/lib/named. Modify the line: OPTS="-u bind" so that it reads OPTS="-u bind -t /var/lib/named":
OPTIONS="-u bind -t /var/lib/named" |
Create the necessary directories under /var/lib:
mkdir -p /var/lib/named/etc
mkdir /var/lib/named/dev
mkdir -p /var/lib/named/var/cache/bind
mkdir -p /var/lib/named/var/run/bind/run
Then move the config directory from /etc to /var/lib/named/etc:
mv /etc/bind /var/lib/named/etc
Create a symlink
to the new config directory from the old location (to avoid problems when bind
is upgraded in the future):
ln -s /var/lib/named/etc/bind /etc/bind
Make null and random
devices, and fix permissions of the directories:
mknod /var/lib/named/dev/null
c 1 3
mknod /var/lib/named/dev/random c 1 8
chmod 666 /var/lib/named/dev/null /var/lib/named/dev/random
chown -R bind:bind /var/lib/named/var/*
chown -R bind:bind /var/lib/named/etc/bind
We need to modify the startup script /etc/init.d/sysklogd of sysklogd so that we can still get important messages logged to the system logs. Modify the line: SYSLOGD="" so that it reads: SYSLOGD="-a /var/lib/named/dev/log":
#! /bin/sh |
Restart the logging
daemon:
/etc/init.d/sysklogd restart
Start up BIND,
and check /var/log/syslog
for any errors:
/etc/init.d/bind9 start