Debian web server

How to build a Debian web server for home use

Introduction

The purpose of this wiki contribution is to describe how to build and configure a web server, to operate from your home. Later on, I hope to expand it into a file server and possibly a mail server.

It will provide detailed building instructions as well as some insights as to why I chose to complete it in the way I did.

In order to make the document readable, I will split it into three pages: the physical building of the server, the RAID configuration and loading the appropriate software.

Wherever possible, I will offer any tips I think are relevant to help smooth your path should you choose to follow suite.

Planning considerations

You need to ask yourself some serious questions before embarking down this road. Most of all:

  • Why am I doing this?
  • What do I hope to gain?
  • Is it economically viable?

Why? Because I wanted the knowledge and hands on experience.

What? A greater flexibility to use the sever as I wish.

Economics? Not viable against a hosted web server service, when used for that purpose alone.

How much availability do I require is another important consideration, as it will determine the kind of configuration the server will need. As mine was to host a small business site, 24/7 availability was desirable, therefore, RAID 5 was the obvious choice.

Chosen Hardware

  • Generic midi case
  • Asrock K10N78-1394 motherboard
  • Adaptec 2410SA RAID card
  • AMD X2 4850e CPU
  • 2GB Crucial memory
  • Liteon CD/DVD drive.
  • 4 x 250GB Seagate SATA hard drives
  • 2 x Realtek RTL-8169 network cards
  • 350w quiet power supply

Building the server

Note: if you are familiar with building computers or servers, feel free to skip this part and move on to the page dealing with the RAID configuration.

Where do you start? Right here!

Dscf0466

Let's start with the case, as everything else has to fit inside.

Dscf0467  Dscf0468  Dscf0486

Open up the case and extract the bag of screws and bits and pieces. The contents will vary between manufacturers, so there's no hard and fast rule as to what you'll get. But at the very least, there should be "stand-offs" to enable the motherboard to fit correctly in the case, without "shorting out" the base. You'll likely get various other screws to fit the drives and so on.

The heaviest component (and therefore most likely to do most damage) is the power supply, so offer that up into the opening and fit the appropriate screws.

Dscf0482  Dscf0492

Next, we can take a look at the motherboard.

Dscf0469

Tip: When handling sensitive electronics, use a wrist strap to eliminate any possibility of static electricity damaging the component. Alternatively, "earth" yourself regularly by touching a metal object that is connected to the ground - a radiator maybe. Damage can (and does) occur and sometimes does not become apparent until sometime into the future. It can be a devil of a job, finding faults that emanate from what is after all, an avoidable source.

The motherboard was chosen because Asrock have a reputation for stability (essential in a server) and amazingly, it has become extremely difficult to source a motherboard with three PCI slots; two of which are required for network cards and one for the Adaptec RAID card.

Taking the necessary precautions, take the motherboard from its anti-static bag and lay it down on a suitable surface.

Dscf0470

Now is the time to fit the CPU (Central Processor Unit) to the motherboard. The CPU I chose, is an AMD Athlon X2 (dual core) 4850e. The "e" indicates it is energy efficient and in fact, draws only 45w at full load. This was a consideration on pure economics. If you're going to run a computer 24/7, try and make it as energy efficient as possible. The CPU came as a "Retail Pack", meaning it included the recommended AMD cooler. The cooler has a thermal compound already applied, so you can fit the cooler straight to the CPU if you wish. In this case, you should skip the next part about applying the compound. However, I'm a great believer in "Arctic Silver" and chose to clean off the supplied compound and use my own preferred solution.

Dscf0499

Tip: Nail varnish remover is great for removing thermal compound. But it should ONLY be removed if you are providing your own alternative compound.

All you need is a small amount of compound (as shown in the picture).

Dscf0494

The real key to a good thermal bond, is to get as even and as thin layer as it is possible to achieve. I put the small "blob" of compound on the CPU and then used an old credit card to work the compound all over the CPU, until I had a nice even cover. Once that is done, take a very careful look at the socket in the motherboard, taking note of the orientation of holes at the corners of the socket. One corner has a sort of square cut out (top right in the screen-shot). The other three are triangle shaped. The screen-shot of the underside of the CPU, shows the square at the bottom right. Clearly, they need to match up.

Dscf0474  Dscf0477

Having lifted the lever on the side of the socket 90 degrees, you need to check the pins again on the underside of the CPU, to make sure they align with the holes in the socket. It will only fit one way and ZERO FORCE is a good name for the socket. If the CPU doesn't simply fall into place, you've got it wrong. DON'T UNDER ANY CIRCUMSTANCES, FORCE IT!

Dscf0493  Dscf0497

Once it has fallen into place, gently steady it and bring the socket lever back down to its original position. It will click into place.

Dscf0498

Now is the time to attach the cooler (heat sink and fan) to the CPU. Of course, if you did not use your own thermal compound, on the base of the cooler will be a square of manufacturers compound and all you have to do is position the cooler on the CPU, making sure the clips line up with the retaining bracket lugs. Also make sure, the side you position the lever, will have sufficient room to operate the lever to secure the cooler in place. Once you're happy with the orientation of the cooler, place the clips over the lugs, have a final check that all is well and move the lever about 180 degrees to secure the cooler in place. The lever will clamp the cooler to the CPU tightly, but it has been designed to apply exactly the correct amount of force. So make sure, the lever travels to its full extent.

Dscf0500  Dscf0501

Now attach the fan cable to its cpu fan header on the motherboard (consult your manual for its location).

Dscf0502

You now have a very convenient "handle" in the shape of the cooler you have just attached to the CPU and motherboard. It can be used to manipulate the motherboard into position (always with care).

It is at this point, you should secure the power supply cables out of the way and any internal case cables, as you need to offer up the motherboard to the case, to establish where the fixing holes line up and which cut outs on the back panel need to be removed for your expansion cards.

Dscf0503

As I needed all three pci slots, I noted which cut outs needed to be remove to facilitate that option. I also noted, five out of the six fixing holes, had a raised "bump" pressed into the case and would need no stand-offs. Only one stand-off was required, fitted like so.

Dscf0491  Dscf0503_0

Place your I/O panel (input/output) into the rectangular hole from the inside of the case, making sure you have the correct orientation. Position the motherboard inside the case, aligning both through the I/O panel and making sure at least one motherboard fixing hole aligns. Start a screw into that, but don't yet screw fully down. The I/O panel will tend to have a small amount of leverage and you need to gently push against that to align the remaining holes. If you need a lot of force: STOP! Something's wrong. Find the cause and start again. Once you get the second screw loosely in, the rest will become progressively easier. Once they are all loosely in position, tighten each one in turn. Don't over tighten.

I prefer to next connect all the front panel connections. They're fiddly and tiny to see, so take advantage while you've got a little extra room.

Dscf0504

Tip: A word of warning. Be VERY careful about consulting your motherboard manual as to the exact position of each header. Some go across, others along and you really don't want to short anything out (as I did). Pay particular attention to the positive (+) and negative (-) polarities. Even though I'm known to be pedantic with this, on this occasion, I came unstuck. I pulled a little too hard on a speaker wire, which I suspect shorted onto a sharp edge on the case and when I switched on, was dismayed to find plums of smoke emerging. Fortunately, I got away with some embarrassment and a knackered speaker (actually a piezoelectric sounder). So even experienced folk can come unstuck!

Now start connecting the various power supply cables as required to the motherboard.

Dscf0505  Dscf0506

The order in which you now complete your build, will depend very much upon the physical structure of your case and motherboard.

I chose to fit the DVD/CD drive. In retrospect, that maybe wasn't the best option. The reason I did it, was because it's the next most bulky component that could cause damage to other parts. Slide it into its recess and screw it into place. Attach the power and SATA data cables.

Dscf0478  Dscf0479  Dscf0507

It would actually, have been easier to fit the memory next.

Tip: Memory is the single most vulnerable component to static electricity. handle with extreme caution.

Dscf0485

Take it out of its anti-static bag (preferably with an anti-static strap attached to you) and check the orientation to fit into a slot. It will only fit ONE WAY. Often it needs a very firm push, but when it's correctly seated, its clips will automatically retract into their closed position. I've lost count of the people I've met that could not boot new machines. Often, it is a memory card not correctly seated, so take great care.

Dscf0508

Now fit the hard drives in the same manner as you fitted the DVD/CD drive. In my case, the major difference is, they will be connected to the Adaptec RAID card.

Dscf0481

Next fit the Adaptec RAID card into its PCI slot, retaining it with a screw. Connect your SATA drive data cables to the RAID card after you have completed fitting any other expansion cards you need.

Dscf0480

Finally, fit the network cards into their PCI slots, using retaining screws to hold them in position.

Dscf0483  Dscf0510

A word of explanation is now necessary, as the eagle eyed amongst you will note the screen-shots show three hard drives, that will eventually become four. An explanation will appear on the wiki page dedicated to explaining how to set-up RAID 5. It is also worth mentioning, that very few power supplies offer sufficient SATA power connectors. Therefore, if you are using OEM drives (bare drives) you should obtain sufficient molex to SATA adapters to convert your molex connectors to SATA. A selection of connectors are shown here.

Dscf0484

My advice now, is to check and double check you have everything connected as it should be. Pay particular attention to the CPU fan, as nothing is guaranteed to spoil your day quite like frying a brand new CPU. Most motherboards will however, shut down if they don't sense a CPU fan running within a few seconds of start up.

Leave the cover off and connect to a set of peripherals, keyboard, mouse, monitor etc. Now hit the start button and pray hard!

If all is well, you'll see a boot screen and will be able to continue with the next section.

If you don't get anything, don't panic. Simply make sure the machine's turned off and recheck everything you've done. 99% of the time, it's simply a bad connection somewhere and in particular, remember my tip about memory being seated properly.

Good luck!

Dscf0511  Dscf0512  Dscf0513  Dscf0514

Next -raid_5