I love using open source software, and I recently had the opportunity to setup a hefty server using Debian. Debian can be used for so much and useful guides are few and far between for Debian setups (key word, useful). I will take you down a complete Debian server setup that can be used in most situations. If you can’t use all of the different pieces of the setup, I know you will be able to use part of it. For instance, if you don’t need a web server, but you do need a file server – just use the file server portion of the guide. This guide can be used for physical servers and virtual servers.

I used the latest Debian release, “Lenny.” We will be building a server from the ground up to reduce the number of packages installed. This increases the security of the system, lowers the number of possible exploits, cuts down on hard drive space, and increases server utilization by freeing up resources. I have screen shots for easy step identification that I got from a Virtual Box installation.

What you will need:

  • Server hardware, mouse and keyboard
  • Debian disk downloaded and burned
  • Monitor that displays least 800×600
  • Internet and network connectivity

Guide Sections

Part 1 – Installation

Part 2 – Web Server Setup and Virtual Hosts

Part 3 – MySQL and PhpMyAdmin

Part 4 – Samba (File) Server

Part 5 – Desktop Installation

Installation

This page will get Debian installed on your system and get SSH going for remote access. Pop in the install disk, boot to your disk drive. At the boot menu, select Graphical Install.

Select your language, Country, and keyboard layout.

Set your host name, a.k.a. server name. Set your domain name, i.e. joshuamcdonald.net.

Set your time zone.

If you are not familiar with Linux partitions, this part might get tricky. No worries, I’ve got it all written down here.

  • Guided – use entire disk: This will use the entire hard drive, split up the hard drive space the best way Debian sees fit. This is a good option for all users, new or experienced, because there is no need to dive deep into partition setup since the setup splits it up beautifully.
  • Guided – use entire disk and setup LVM: You will use this option if you need to configure a software RAID. It is better to use a hardware RAID, so consider this if you are planning on a software RAID. You will also use this option if you are planning to use different hard drives for different uses such as placing the swap or /home on a separate hard drive.
  • Guided – use entire disk and setup encrypted LVM: If you are really looking to lock down the hard drives, use this option since it will encrypt your entire hard drive. I would only use this option if you cannot secure the physical location of your server, or if you are using a non-production laptop server setup.
  • Manual: This option is the most tedious, but for experienced administrators, it is often the first choice. It is a combination of all three prior options.

I would recommend using the entire disk and letting it format Debian format the drive the way it wants to.

You can select any of the three partitioning setups, but I like the “Separate /home partition” option. This way I can still get to my /home folder even in the unlikely case my OS (Operating System) craps out. You can install right over / (the OS files) and the /home will be preserved (if you do it right!).

If everything you set up looks good, select “Finish partitioning and write changes to disk.”

It’s going to let you review the partition setup one more time to make sure they are correct. Select “Yes” and click “Continue.”

It’s going to write many things to disk and continue with the setup. Setup then asks to set the root password. Here type in a super strong password for the root user, but do NOT forget it. The super user password is super important. You can’t do much of anything without this password. Key: Strong and rememberable.

Here, setup an account for yourself. Type in your full name. Then type in your desired user name. Finally, set a strong password for yourself.

Select “No” and “Continue” to scan for additional media. If we need more software packages, we will configure them later once we get the system up and running.

Select “Yes” to set your network mirror. This allows you to download software packages and updates. Select your appropriate country and pick a mirror that is closest to you. A little bit a googling and map searching will help you with this part.

If your network has a proxy, enter that information here.

You can choose to participate in the package usage survey or package popularity. This will help Debian choose the best packages for future releases.

There are two ways to set up your server at this point.

  1. You can go ahead and select the packages you need and bypass a few easy commands later as shown in the first picture. This is acceptable, but I prefer the geekier way as seen in number 2.
  2. You can take my suggestion and deselect all software collections as shown in the second picture. This way is more secure as there will be fewer packages install, lowing the percentage of exploits that can be executed against your server.

Don’t worry, I will have all the commands you will need to install software later.

Assuming you are building a standalone server, select “Yes” to install GRUB, a boot loader. If you have another OS on your system, you may consider using GRUB anyway and configuring it after system installation to allow you to boot to the other OS. If you select “No,” we are assuming that you have another way to boot into Debian, such as a different boot loader.

Yeah! Finally done! Didn’t take too long, did it? Well it shouldn’t have if it did. This takes 30 minutes or less if you have done it a time or two.

The system will reboot and you will see this pretty little black, blue,  and white screen – GRUB. It selects which OS you will boot into. It will boot into Debian automatically so you don’t have to select anything unless you have another boot loader or anther OS installed.

Login screen is up, now we are ready to get down and dirty. Well, at least you can copy and paste.

SSH

Right now, there are 474 commands available as a regular user and 665 commands available as root since no packages were selected at install. First let’s get remote access working, so let’s install SSH. Login as root.

su

Put in your root password and then type in…

apt-get install ssh

It may ask you to put in your Debian install disk for the installation of this package, so have it handy. After installation, you can use Putty or another computer to connect remotely to your server using SSH. If you need help using SSH, see my How to SSH article.

See Part 2 – Web Server Setup and Virtual Hosts