Web Hosting – At Home – Webmin

Yippee, I can host my websites at home

If you’re like me you don’t like paying someone else for hosting your web site. The good news is you can do it yourself. Oh Bravo I here you say.

It’s easy to do and you don’t need the technical prowess of Hercules the IT Tech. With a reasonable background in general IT you can successfully keep your hosting dollars and buy an extra six pack of beer from time to time.

I’ve always been a Microsoft Windows kind of guy but when I decided I’d start self hosting I made the choice to dive into the sick & twisted world of Linux. I say it’s a sick & twisted world because if you’re planning on building a web server you really should get used to command lines rather than a fancy GUI Desktop. You can have one, but it would be pointless and a waste of resources, resources better utilised for serving web pages, email, databases and other web hosting stuff. No mouse, no windows, scrollbars and no easy way to do anything. Therefore Sick & Twisted!

WTF – No Desktop

Having a desktop is for sissies! The upside of a desktop environment is the ease of use, the downside is resources consumed by your system in order to display pretty icons for your visual pleasure. CPU, Memory, Disk Space and Network should be dedicated to serving web pages efficiently & quickly. The fastest method for gaining extra CPU & Memory is to throw out your desktop, in fact, don’t install a desktop in the first place.

What you will need

The requirements for self hosting are surprisingly simple, readily available & free. In fact, you can do it with a crappy old laptop you picked up at a garage sale for 40 bucks. Laptops are a good choice because having a battery ‘almost‘ negates the need for a UPS. But if your web site is popular you’ll want to get the right gear up front.

You can buy a reasonable PC with dual Hard Disks, RAID and redundant power supplies for a handful of dollars. That’s perfect and will get you up and running. Get yourself a UPS (uninterruptible power supply) too. I’ve been caught recently without a UPS during a power failure and recovery took nearly 48 hours. They are cheap and worth every cent.

A static IP address a necessity. You cannot do this properly with a dynamic address. Find out from your internet service provider if you have one, if not then get one.

It is important your PC or laptop is connected to your router via an Ethernet cable not wireless. Also, the faster the better. If you have a Gigabit router you’re off to a flying start, but, make certain your server has a Gigabit network card in it if you want to utilise the faster connection.

Check List

  • PC or Laptop
  • Static IP Address
  • Ethernet Cable
  • Linux (see below)
  • HTTP Server Software
  • Database
  • Email (not really covered here)

Choosing your Linux

Use any Linux distribution you like but my recommendation is Centos 7 Minimal or above because it’s stable, updated, secure and used by most of the worlds web servers. Being popular means there are sqillions of tutorials around the internet, enough to melt your brain.

Choose minimal because that allows you to only install what you need rather than bloating your system.

The most useful command you’ll need is ‘yum’ (yellow dog updater). It’s a stupid name but Linux folk like stupid names.

Download an ISO Image and burn it to a DVD or USB Thumb drive, boot from it and follow the instructions. Once your installation is complete you can login (do not use root) then type the following command to update everything;

# sudo yum update -y

If you enjoy being punished by hours of manually installing software you can use google to find tutorials for installing HTTPD, MariaDB, Postfix, Dovecot, Bind, etc. I’m not into punishment so I’ll choose the easy path.

Webmin

Using Webmin makes life easier for you. It is a Control Panel allowing you to manage your service. There are of course other Control Panels out there and I’ve tried a few but Webmin was the only one I found easy to follow and use. Google ‘Control Panels’ if you want more info on other choices.

Download Webmin / VirtualMin install script.

Using the above script is a great way to go because it installs all the software you need to run a full web hosting service. It will also modify your firewall and open appropriate ports.

To install you must first make the script executable before you can run it. Use the following commands;

# sudo chmod +x install.sh
# ./install.sh

Choose the Apache install option. In another blog I’ll talk about using Nginx to cache Apache thereby giving you much better performance.