Creating a Debian GNU/Linux Server – a Minimal Install

When you’re creating servers you usually don’t want the overhead of a GUI. This is particularly true when you’re creating a virtual server. You only want the stuff you need. And the basic Debian, of course, to hold it.

Grab an Install Image

Debian has several install images available. I usually prefer the network install image (netinst). It’s minimal in size, giving you what  you need to install, and then downloads only what you need.

I usually use the 64-bit one as well, even though you can save a little memory using a 32-bit one. There is a “Live” one, but I’ve not had good luck with it in unusual circumstances, which is often the case when I’m making servers or little devices.

If you won’t have a working network connection, get one of the full images instead. All Debian images are updated from time to time, as updated releases happen, so check occasionally.

Install Media

If you’re installing into a virtual machine, you’re already set with this ISO image. If you’re installing onto hardware, I find a USB thumb drive is most useful.

The Debian ISO images have long been set up to create proper bootable disks by just dumping the ISO data directly to the USB.

To create the USB stick in Linux, it’s just a matter of using dd to dump it. In Windows you’ll need a program such as Unetbootin to create the bootable USB stick from that ISO image. Unetbootin also runs in Linux, and it often packaged in Debian already.

But the quick and easy way is just use a command prompt. Find your USB drive’s device name – that’s the hardest part. In Gnome you can look at disk utility, or tail the syslog and watch while you plug it in. 😉

$ wget http://cdimage.debian.org/debian-cd/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso

$ dd if=debian-7.6.0-amd64-netinst.iso of=/dev/usbdrivename bs=4M ; sync

Please be very careful with that dd command. You can easily destroy your system or data if you put in the wrong of= parameter. But if you don’t destroy your system or data, we’re ready to go.

Make sure you set your BIOS or UEFI to boot from the USB drive, or if you’re installing into a virtual machine, don’t forget to attach it as a CDROM.

The Install

The first screen you’ll come to when booting will let you pick between a normal install and a graphical install (along with some advanced options, which we’ll hopefully cover later).

I usually pick the normal install because you don’t have to worry about moving a mouse around as much, nor do you have to worry about there being any strangeness with your graphics cards and this particular kernel (which is rare any more on a base install).

The next screen lets you pick the language, which defaults to English, your location, your keyboard layout (all English and American by default).

After just those few very basic questions, the install will start loading some kernel modules it might need, including those needed to activate your network interface.

The Network Interface

The Debian installer will now try to set up any network interfaces it finds. It will try to configure both IPv6 and IPv4 with DHCP. You can, of course, specify the configuration manually if it doesn’t detect network configurations.

If you’ve got a good hostname, it will fill that in from DNS automatically, or you can specify it yourself. Same with domain name.

If no hardware interfaces are detected, you can always go back to the main menu and try loading kernel modules manually, if there are any, or just weep. It seems that just about everything is recognized any more.

User Account Setup

Next you’ll be prompted to enter a password for the root user. Debian enabled root logins by default. If you want to disallow them, you’ll need to install “sudo” and  add a normal user to the “sudo” group, and disable the password of root (passwd –lock root). If you do that, you can still log in as root with SSH keys, if you have them.

After you set root’s password, you’ll be prompted to add a new, normal system user. I hate that they added this bit. But just enter something I suppose.

Final Little Miscellaneous Config

You’ll need to enter in your timezone. I know! So hard.

Disk Partitioning

Gods help you. There are so many ways you can do it. If you have one drive and want everything just on that drive, select “Guided – use entire disk”.

I never do that, though, unless it’s a virtual server. I like to set disks up with LVM, and RAID multiple disks together. You can do all that nice and easily in the disk partitioner if you like. It’s very well laid out. But more complex disk partitioning schemes is beyond the scope of this quickie walk-though.

You can, of course, read through an intro to various Logical Volume Manager disk stuff if you like. The Debian installer automates a lot of that.

Another nice feature is that you can set up full disk or partition encryption here, too, which is convenient for your secret purposes. You can encrypt a partition or a RAID device or LVM volumes themselves. Many people argue over which is best to do. I have my moods, and like variety.

I rarely choose anything but to place all files in one partition. This is because I would rather muck about with the underlying volumes and and devices. However, there are some very good reasons to separate your mountpoint concerns in some situations, particularly with read-only and highly space-constrained systems.

After answer the partitioner’s few questions, you’ll be presented with its final understanding of what you wanted, which you should verify. Let’s look at one I just did:

Debian Partitioner

Here you see I chose to put everything in one partition using LVM underneath it. Which, of course, the installer lies about, and really creates a boot partition for you as well.  And even a UEFI one if your system’s got that. It’s good practice to keep a separate boot partition.

The Debian installer organizes things from the most abstract up top, to the most low-level stuff below. You’ll see the LVM volume group and logical volumes it wants to create on top, and the actual disks that contain those down below.

Generally, when you want to make changes, start at the top and work your way down, if you really need to. I’m going to skip the LVM configurator and the RAID configurator, because we could really just go on forever with that.

The point is, the Debian installer gives you incredibly good access to setting up your storage in all kinds of ways. They were the first to support so many different things at boot, and although it can bring complexity, you don’t have to deal with that complexity any more if you just follow their defaults (all in one place).

So… after it looks right to you, or doesn’t and you’re just trusting, you select “Finish partitioning and write changes to disk” and you’re good to go.

Oh, you can move the cursor to any of those top mount points and change the filesystems you want to use, or what gets mounted where, all that stuff. If you like, or have the need. Even mount options that will get automatically passed along to your system’s fstab

You should know that the base Debian system is very small indeed. The 8Gb you see here will leave plenty of room for many, many things that servers do. The end user data stuff, probably not. But you can always tack on a new disk for that, or partition it in a different place.

Installing the Debian System

After your partitioning and formatting are successful, the installer will install the base Debian system, which is, well, the base system. All you need to boot up and get going, adding whatever packages you like.

After it does that, it will want to set up updates for you, and will ask where you are so that it can find a Debian archive mirror that is close to you.

Pick one! Then it will ask you if you use an HTTP proxy to get out to the net. If you do, enter the info here. And as an aside, setting up a proxy for Debian packages is really, really nice when you do a lot of virtual machines. It saves you having to download the packages to every machine, which can save a great deal of time, over time. apt-cacher-ng is my personal favorite.

It will then download archive package indexes, install and update any packages that may need doing, and then it wants to know just what type of Debian system do you want here?

Software Selection

If you’re doing a server, uncheck the Debian desktop environment. It’s too fat. Odds are you don’t want a print server, either. Why is that checked by default? Whose version of madness is allowed to permeates us all so?

Standard system utilities is all you want. And SSH server.

But, maybe you’ll want to run this as a DNS server, whether master or slave? You can check that and it will set up Bind9 for you.

File server will give you Samba 3 and some utilities. Mail server gives you Exim 4 – which I finally, after years of clinging to Sendmail, surrendered to myself. Web server gives you Apache 2

But all those others can be easily added with apt-get later. Standard system and SSH is the way to go. Check that, and away you go.

Boot Loader

After the install finishes, the installer will want to place a boot loader on the drives. The boot loader used by default is Grub. It’s pretty good at detecting other installed operating systems, which hopefully you haven’t overwritten by telling the installer to use an entire hard drive. Well, unless you want that.

The installer seems to do a very good job of working with UEFI as well. However, I have noticed that from time to time, Windows 8 will not like to boot after installing a new boot loader. Be warned if you’re trying to dual boot with Windows 8. Sometimes it works, and sometimes it doesn’t, and the only thing I can think of is different motherboard manufacturers implementing UEFI differently.

Let the boot loader install, and your new minimal Debian system should reboot up just fine, ready for you to begin work on making that new server.

The Debian developers have done a really great job of creating a very minimalist and simple installation system. And for popping out one virtual machine after another, it really can’t be beat.