Installation Guide for a full-featured Debian server

Featured

Here is a collection of articles I wrote during the past year. Together they form a guide that will let you setup a full-featured Debian server. All of these tutorials are based on the recent work I did to setup my personal server on Debian Squeeze.

These articles are independent with each other, meaning you can pick the one your interested in to customize your server and ignore the others.

  1. Setup SMART monitoring tool for HDDs.
  2. Setup Nut to manage the UPS.
  3. Setup Duplicity and Amazon S3 for cloud-based backups.
  4. Setup Exim to relay mails via Gmail.
  5. Setup cron-apt to keep our distribution up to date.
  6. Add a fail2ban deamon.
  7. Setup Munin to monitor our machine.
  8. Basic setup of Nginx + PHP-FPM + MySQL web stack.
  9. Optimizing Nginx + PHP-FPM + MySQL for performances.
  10. Setup PHP APC op-code cache.
  11. Install haveged to get lots of entropy.
  12. Setup a WebDAVs server with Lighttpd.
  13. Setup Mailman + Nginx + Exim for mailing-lists.
  14. Mailman mailing-list migration and merging.

Keep a Debian fresh thanks to cron-apt

As I mentioned in an old comment, I use cron-apt to keep my Debian servers fresh.

This post is just a quick reminder to my future self, about how I setup cron-apt on my machines.

First we install the package:

aptitude install cron-apt

Then we configure it:

sed -i 's/# MAILON="error"/MAILON="always"/g' /etc/cron-apt/config
sed -i 's/# MAILTO="root"/MAILTO="kevin@deldycke.com"/g' /etc/cron-apt/config

That’s it !

dpkg, APT & Aptitude commands

  • List all installed packages:
    dpkg -l
    
  • List all recently installed packages:
    zcat -f /var/log/dpkg.log* | grep "\ install\ " | sort
    
  • Install a package from a lower-priority repository, like the backport repository:
    apt-get -t squeeze-backports install my-package
    
  • Force reinstallation of a package:
    apt-get -d --reinstall install my-package
    dpkg --install --force-confmiss /var/cache/apt/archives/my-package.deb
    
  • Clean aptitude local cache:
    apt-get clean
    
  • Uninstall a package throughly (both program files and configuration):
    apt-get remove --purge my_package
    
  • Force removal of a package while ignoring all dependencies:
    dpkg --remove --force-depends libsomething
    
  • Remove orphaned pakages:
    deborphan | xargs apt-get -y remove --purge
    
  • Show the changelog of a package (here, the linux kernel of Ubuntu):
    aptitude changelog linux-generic
    
  • Which package contain a given file:
    apt-file search file_to_search
    
  • Get the list of files of a package:
    apt-file list package_name
    
  • Remove dpkg lock file:
    rm /var/lib/dpkg/lock
    
  • Hold a package with either dpkg or aptitude:
    echo "kdenlive hold" | dpkg --set-selections
    
    aptitude hold kdenlive
    
  • Unhold a package:
    echo "kdenlive install" | dpkg --set-selections
    
    aptitude unhold kdenlive
    
  • List holded packages:
    dpkg --get-selections | grep hold