installing Debian

After installing Debian there are several things I like to do before considering it a base on which to build.

  1. remove extraneous packages
  2. install my essential packages
  3. upgrade or apply security updates
  4. configure syslog
  5. configure bash
  6. configure /tmp
  7. configure vim
  8. edit /etc/motd

1. remove extraneous packages

deborphan must be installed to complete this step.

Remove this rubbish:

  • tasksel
  • aptitude
  • base-config
  • nvi
  • ed
  • nano
  • ipchains
  • dc
  • discover1
  • fdutils
  • info
  • ppp
  • pppconfig
  • pppoe
  • pppoeconf

..then remove orphaned libraries with repeated incantations of:

$ sudo dpkg -P `deborphan`

2. install my essential packages

  • sudo
  • vim
  • screen
  • less
  • deborphan
  • masqmail (and remove exim4*)
  • lsof
  • hdparm
  • pwgen
  • ngrep
  • nmap
  • rsync
  • ssh
  • bzip2
  • unzip
  • xxdiff

3. upgrade or apply security updates

If the system is to be upgraded to another release (say from "sarge" to "sid") then applying security updates to the existing "sarge" installation is a waste of time and bandwidth.

Edit /etc/apt/sources.list and invoke:

$ apt-get update
$ apt-get dist-upgrade

4. configure syslog

I don't like so many different logs in /var/log not least because all the information ends up in /var/log/syslog anyway by default and I'd rather have less written to disc.

Edit /etc/syslog.conf and comment out:

  • daemon.*
  • kern.*
  • lpr.*
  • mail.*
  • user.*
  • uucp.*
  • mail.info
  • mail.warn
  • mail.err
  • news.crit
  • news.err
  • news.notice
  • *.=debug (and following lines)
  • *.=inf (and following lines)o

..and then utter:

$ sudo /etc/init.d/sysklogd reload
$ cd /var/log
$ sudo rm -Rf daemon.log kern.log lpr.log mail.* user.log uucp.log news/ debug m
essages

5. configure bash

I like all users to be able to inherit a .bashrc and the logical place to inherit from is /root since the root user must be able to log in when most of the rest of the file system is buggered.

/root/.bashrc.global:

# global .bashrc file
#
#  - sets a default PATH
#  - overrides the default history size
#  - overrides the default umask
#  - sets some default aliases
#  - sets a default prompt for interactive shells
#

      PATH=/usr/local/sbin
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/sbin
PATH=$PATH:/usr/bin
PATH=$PATH:/sbin
PATH=$PATH:/bin
PATH=$PATH:/usr/bin/X11

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ]; then
    PATH=~/bin:"${PATH}"
fi

# do the same with MANPATH
if [ -d ~/man ]; then
    MANPATH=~/man:"${MANPATH}"
fi

# and PERL5LIB
if [ -d ~/lib/libperl5 ]; then
    PERL5LIB=~/lib/libperl5:"${PERL5LIB}"
fi

HISTSIZE=8192
HISTFILESIZE=8192

umask 027


# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize


alias ls='ls --color=auto '
alias ll='ls -l'
alias la='ls -A'
alias l='ls -lGF'
alias x=exit
alias hup='kill -HUP'
alias cp='cp -ia'
alias mv='mv -i'
alias findl='find -printf \"%p\"\ '
alias up=". up.sh"


# If running interactively, then:
if [ "$PS1" ]; then

    mesg n

    eval `dircolors`

    export HISTCONTROL=ignoredups

    # If this is an xterm set the title to user@host:dir
    case $TERM in
    xterm*|rxvt)
        PROMPT_COMMAND='if [ "root" == ${USER} ]; then TEXTCOLOR=31; else TEXTCO
LOR=0; fi; case "$SSH_CLIENT" in 141.228.156.225*) TITLE="lsunds50.ldn.bzwint.co
m";; *) TITLE="${USER}@${HOSTNAME}:${PWD}";; esac; echo -ne "\033]0;${TITLE}\007
\033[${TEXTCOLOR}m"'
        ;;
    *)
        PROMPT_COMMAND='if [ "root" == ${USER} ]; then TEXTCOLOR=31; else TEXTCO
LOR=0; fi; echo -ne "\033[${TEXTCOLOR}m"'
        ;;
    esac

    # set a fancy prompt
    PS1='\u@\h:\w\$ '
fi


# enable bash completion in interactive shells

#if [ "$PS1" -a -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#fi


export PATH HISTSIZE HISTFILESIZE PERL5LIB

/root/.bashrc.host:

# host .bashrc file

if [ -f /root/.bashrc.global ]; then
    source /root/.bashrc.global
fi

JAVA_HOME=/usr/java/jdk
ANT_HOME=/usr/java/ant

export EDITOR=vi

PATH=$JAVA_HOME/bin:$PATH:$ANT_HOME/bin:/usr/games

export PATH JAVA_HOME

/root/.bashrc:

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

if [ -f /root/.bashrc.host ]; then
    source /root/.bashrc.host
fi

/root/.profile:

# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
    if [ -f ~/.bashrc ]; then
        . ~/.bashrc
    fi
fi

Users then link to /root/.bashrc.host for their .bashrc and to .profile for their .bash_profile.

6. configure /tmp

Edit /etc/fstab to contain:

file system  mount point  type   options             dump  pass
tmpfs        /tmp         tmpfs  size=100M,mode=777  0     0

7. configure vim

/root/.vimrc:

set complete=.,w,b,u,t,i
set list
set listchars=tab:>-,trail:-
set expandtab
set ai
set shiftwidth=4
set tabstop=4
set incsearch
syntax enable
:map <F12> :buffers<CR>
:nmap <TAB> :bnext<CR>
:nmap ` :bprevious<CR>
:map <F10> :buffer10<CR>
:map <F11> :cn<CR>

8. edit /etc/motd

Edit /etc/motd to be of this form:

Linux 2.4.19-earth  1000 MHz C3-2  1024 MB RAM  38200 MB disc

..and edit /etc/init.d/bootmisc.sh so it does not crap on /etc/motd on every boot.

$Revision: 1.3 $, $Date: 2006/06/24 07:05:40 $

Valid HTML 4.01 Transitional