Basic Debian Server

Posted by Tom Willett Tue, 19 Sep 2006 15:09:00 GMT

I have recently began the process of repurposing all my servers. I have been using Fedora but decided to go with Debian this time. This is the first of several posts documenting how I set up my servers (mainly for my benefit).

Go to Debian.org to get the netinstall image. Below are the details of using the Debian NetInstall disk to get a basic server up and running.

New Debian Server 3.1 Sarge

Boot the Netinstall Disk choosing a mail server and not configuring it.

Now login through ssh

Install some software, note you can cut and paste the following command lines. Command lines are in bold.

apt-get install wget bzip2 rdate fetchmail libdb3++-dev unzip zip ncftp xlispstat libarchive-zip-perl zlib1g-dev libpopt-dev nmap openssl lynx fileutils

apt-get install fetchmailconf ca-certificates ntp-doc ntp ntpdate joe

Note I added the joe editor as its my favorite (love those wordstar bindings) but you can substitute your favorite.

Remove some software

apt-get remove lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig

Now edit .bashrc to set things up like I expect.

Change it from:

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

to

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;31m\]\w\[\033[1;36m\]\$ \[\033[0m\]'
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

Exit and relogin to see the changes

Since I use the Joe Editor and let it make backups, there can be a lot of backups around. To deal with them I have created a little batch file to remove them in any directory tree. So now we will create this little batch file

touch /usr/sbin/rmbak

Now edit that file and insert the following contents:

#!/bin/bash
echo "Deleting backup files . . ."
find . -name '*~' -print -exec rm {} \;

Verify than /etc/network/interfaces and /etc/resolv.conf are correct, if not fix them.

Set the hostname

echo someserver.somehost.net > /etc/hostname
hostname -F /etc/hostname

Update some services

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;/etc/init.d/inetd reload

Install the Bastille hardening script

apt-get install bastille

Now run bastille

bastille

Ok now we have a base system to work from.

Specific installation instructions for different packages are here also.

Comments

Leave a comment

Comments