There is a new version of this tutorial available for Debian 12 (Bookworm).

How to install a Debian 7 (Wheezy) Minimal Server

This tutorial shows how to install a Debian 7 (Wheezy) minimal server. The purpose of this guide is to provide a minimal Debian setup that can be used as basis for our other tutorials here at howtoforgeThis tutorial is based on the Howtoforge perfect server tutorials from Falko Timme. We refer to the first chapters of the perfect server guides in many of our Debian tutorials and decided that it's time to split the perfect servers into the base installation (which is not required when you rent a server or vps from a hosting provider) and the actual perfect server setup. This tutorial here is the "standalone" guide for the base install to help you to get a clean minimal installation image to get started with your server installation.

1 Requirements

To install such a system you will need the following:

 

2 Preliminary Note

In this tutorial I will use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

 

3 The Base System

Insert your Debian Wheezy network installation CD into your system and boot from it. When you use a virtualisation software like VMware or Virtualbox, then select the Debian minimal iso file as source file for the dvd drive of the vm, you dont have to burn it to a CD or DVD for that first.

Select Install (this will start the text installer - if you prefer a graphical installer, select Graphical install):

Select your language:

Then choose your location:

If you've selected an uncommon combination of language and location (like English as the language and Germany as the location, as in my case), the installer might tell you that there is no locale defined for this combination; in this case you have to select the locale manually. I select en_US.UTF-8 here:

Choose a keyboard layout:

The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network:

Enter the hostname. In this example, my system is called server1.example.com, so I enter server1:

Enter your domain name. In this example, this is example.com:

Afterwards, give the root user a password:

Confirm that password to avoid typos:

Create a normal user account, for example the user Administrator with the user name administrator (don't use the user name admin as it is a reserved name on Debian Wheezy):

Now you have to partition your hard disk. For simplicity's sake I select Guided - use entire disk and set up LVM - this will create one volume group with two logical volumes, one for the / file system and another one for swap (of course, the partitioning is totally up to you - if you know what you're doing, you can also set up your partitions manually).

Select the disk that you want to partition:

Then select the partitioning scheme. As mentioned before, I select All files in one partition (recommended for new users) for simplicity's sake - it's up to your likings what you choose here:

When you're asked Write the changes to disks and configure LVM?, select Yes:

When you're finished, select Finish partitioning and write changes to disk:

Select Yes when you're asked Write changes to disks?:

Afterwards, your new partitions are created and formatted.

Now the base system is installed:

Next you must configure apt. Because you are using the Debian Wheezy Netinstall CD which contains only a minimal set of packages, you must use a network mirror. Select the country where the network mirror that you want to use is located (usually this is the country where your Debian Wheezy system is located):

Then select the mirror you want to use (e.g. ftp.de.debian.org):

Unless you use an HTTP proxy, leave the following field empty and hit Continue:

Apt is now updating its packages database:

You can skip the package usage survey by selecting No:

We need a web server, DNS server, mail server, and a MySQL database, but nevertheless I don't select any of them now because I like to have full control over what gets installed on my system. We will install the needed packages manually later on. Therefore we just select Standard system utilities and SSH server (so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished) and hit Continue:

The required packages are downloaded and installed on the system:

When you're asked Install the GRUB boot loader to the master boot record?, select Yes:

The base system installation is now finished. Remove the Debian Wheezy Netinstall CD from the CD drive and hit Continue to reboot the system:

On to the next step...

4 Install The SSH Server (Optional)

If you did not install the OpenSSH server during the system installation, you can do it now:

apt-get -y install ssh openssh-server

From now on you can use an SSH client such as PuTTY and connect from your workstation to your Debian Wheezy server and follow the remaining steps from this tutorial.

 

5 Install a shell editor (Optional)

I'll use vi as my favorite shell text editor, others prefer nano which is easier to use for beginners. With the following command I will install both editors:

apt-get -y install vim-nox nano

(You don't have to do this if you use a different text editor such as joe or nano.)

 

6 Configure The Network

Because the Debian Wheezy 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) (please note that I replace allow-hotplug eth0 with auto eth0; otherwise restarting the network doesn't work, and we'd have to reboot the whole system):

vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

Then restart your network:

/etc/init.d/networking restart

Then edit /etc/hosts. Make it look like this:

vi /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Now run

echo server1.example.com > /etc/hostname
/etc/init.d/hostname.sh start

Afterwards, run

hostname
hostname -f

It is important that both show server1.example.com now!

 

7 Update Your Debian Installation

First make sure that your /etc/apt/sources.list contains the wheezy-updates repository (this makes sure you always get the newest updates for the ClamAV virus scanner - this project publishes releases very often, and sometimes old versions stop working), and that the contrib and non-free repositories are enabled (some packages such as libapache2-mod-fastcgi are not in the main repository).

vi /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free

# wheezy-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ wheezy-updates main contrib non-free

Run

apt-get update

to update the apt package database and

apt-get upgrade

to install the latest updates (if there are any).

 

Share this page:

4 Comment(s)