Debian Server HowTo

2013-12-11 19.15.13-1

Debian Server Howto Install

Network Information
Static ip :

IMAP Mailserver
Samba Fileserver

FTP Server
IMAP Mail Server + fetchmail & webmail access
Phpmyadmin (MySQL Administration)


To build a secure stable server used for the above roles.

Base System Install

I downloaded the ‘Netinst’ iso image from the debian mirror. This provides a basic small system perfect for building a nice secure, scalable server.

1. Start the install with ‘linux26’ to enable a 2.6 kernel.

2. Choose your language and keymap settings.

By default the network card will get it’s information via DHCP, if you want to assign a static ip address you can go ‘back’ at this stage and choose to configure the network manually. (or start the install with ‘linux26 disable-dhcp’)

3. Choose a hostname for the system – this is simply a name or label. Ie: server1

4. Choose a domain name

The installer will now partition the disks. I would recommend choosing the ‘Multiuser Workstation’

The system will now install the base system.

5. Install the GRUB boot loader to the master boot record

Installation of the base system is now complete, remove any boot media and reboot.

Configuring the system

1. Select your timezone
2. Choose a Root password (Keep this secure!!)
3. Create a ‘normal’ standard user account (perhaps yourself?!?)

Use your normal account for logging into the box and always ‘su’ if you need root privileges.

Apt Configuration

1. As we’re connected to the internet we can safely choose ‘http’ as our APT access method. This will fetch all software from a debian mirror.

Debian Software Selection

Do not choose any packages to install here, we require a more finely tuned application listing.

The system will now download essential software from the APT repository, sit back and wait!

Configuring Exim4

This machine is going to handle incoming outgoing email so choose the first option: ‘internet site; mail is sent and received directly using SMTP’

Choose a postmaster recipient, possibly yourself or ‘root’ or both!

The basic system is now complete!!

1. Login as yourself (standard user account)
2. ‘su’ to root
3. rm /etc/motd – delete the crappy /etc/motd file (Message of The Day)
4. run ‘apt-get update’ to make sure your apt-cache is recent.
5. run ‘apt-get install rcconf’
6. run ‘apt-get install gkrellmd’
7. run ‘apt-get install webalizer’
8. run ‘apt-get install links’

Installing and configuring the Apache2 Web server

1. run ‘apt-get install apache2’
2. add php4 support to apache2 by running: ‘apt-get install libapache2-mod-php4’
3. Also install SSL support by running ‘apt-get install apache-ssl’

Installing phpsysinfo

1. run ‘apt-get install phpsysinfo’

Installing MySQL Database Server

1. run ‘apt-get install mysql-server’
2. run ‘apt-get install phpmyadmin’

Installing IMAP Mail server (Dovecot)

1. run ‘apt-get install dovecot’
2. edit the config file: run ‘nano /etc/dovecot.conf’
3. choose protocols to use in our case just ‘imap’ & ‘imapd’, save and close
4. run ‘dovecot’

Installing Webmail

1. run ‘apt-get install ilohamaill’
2. run ‘cd /var/www’ & ‘ln /usr/share/Ilohamail webmail


Fetchmail is a program that grabs all email from a POP or IMAP server and re-distributes them to local system mailboxes. It’s a very versatile program and well worth using. Simply create a .fetchmailrc file similar to the following:

set postmaster “your-username”
set no bouncemail

# You need a set of lines like this for each account you want to download
# email from. So this is a first account
poll with proto POP3
user ‘remote-user’ there is ‘your-username’ here
pass “your-password”
# options keep # makes it not download your mail, use for testing

Place this file in your home dir and test it by running fetchmail –v

If it works ok you now can automate fetchmail so it is running all the time and also starts if the machine is restarted.

Add a crontab entry (crontab –e) with the following line:

*/3 * * * * fetchmail –s # Run Fetchmail every 3 minutes.

Samba File Server

Adding samba services can be useful if you have some windows boxes that are going to use the server.

1. Run ‘apt-get install samba smbfs’
2. Choose a workgroup name for the server to exist in.
3. Edit the /etc/samba/smb.conf to add shares. Eg;

# Sample Share
comment = Resource Area
writable = no
locking = no
path = /hd2/resource
public = yes

** Edit line 76 to be the following: security = share **

4. Restart the Samba daemon by running: ‘/etc/init.d/samba restart’

DDClient ( Updater)

Run ‘apt-get install ddclient’


Run ‘apt-get install dnsmasq’

DNSMasq uses the hosts file (/etc/hosts) simply add machines to the host file to enable dns services.

Eg. server1

FTP Server

Run ‘apt-get install proftpd’

About Louis

Louis is a Developer and all round geek from the UK with a keen interest in web technologies and mobile applications. When not playing with code, he is probably rebuilding a Linux server or watching a Netflix marathon!
This entry was posted in Debian, Linux and tagged , , . Bookmark the permalink.

Leave a Reply