How to Build a Home/Small Business Web Server in no Time

This article goes through a quick and easy process for building a home or small business web server. The finished server will have Web server software, PHP, Perl, Ruby, MySQL, PostgreSQL, quotas, e-mail server software, anti-spam and anti-virus software, and a lot more good stuff. To top it off it will have a Web based GUI to control it all. Read on to learn how.

Download and Burn a Debian CD

Debian GNU/Linux is the basis of the server. It can be downloaded for free, from the Debian Web site. Select a download from the ‘Small CDs’ section, the list of architectures — [alpha][amd64] and what not — can be confusing. If in doubt click the [i386] link to get a CD image that will work on most machines, shown in the screenshot below:

Once the download is complete, the file needs to be burned onto a CD. This is easy in Ubuntu (or any other GNU/Linux desktop) and a little more tricky using Windows. In Ubuntu, right-click on the downloaded file and select Write to Disc...

Booting from the CD

Next ensure the server computer is set to boot from CD (generally this means changing a BIOS setting, and varies by computer. Check the computer’s documentation, or do a search for more help with this). Put the CD into the CD-ROM drive and restart the computer. When the screen below appears press Enter.

Beginning the Installation and Configuring Networking

The installer will then ask some simple questions on location and language, answer these and wait for the next prompt.

The Host Name prompt is for entering the name of the server, this can be anything. Some IT departments have naming conventions (Greek gods for example), but something as simple as webserver will do.

Domain Name is next, the server being setup in this article is for internal use only, so the domain name has been set to apaddedcell.local to avoid interference or confusion with an Internet-facing server. If the server were built to be Internet-facing, i.e. serving an actual site, it would have a recognised domain name such as apaddedcell.com. In summary: if the server is for an actual domain on the Internet, use that domain name for this step, otherwise any domain name can be used.

Host Name

Domain Name

Partitioning

Then the installer needs to know how to partition the hard drive. In most cases the default settings are correct, so press Enter at each of the next four steps.

Start Partitioning

Select Disk

Partitioning Scheme

Finish Partitioning

Just to be sure, a final confirmation is shown. Answer Yes to continue. There is then a short wait while the partitions are created.

Usernames and Passwords

The installer will ask for a Root User Password. The ‘root user’ is an account setup for the server administrator, and should only be used for tasks that need the access.

Another short wait is required, while the base system is installed. Online updates will be enabled in the next step.

Online Updates

Answer Yes to the Network Mirror prompt — note: this article assumes an Internet connection for the server is available.

A list of countries will then appear (Mirror Location), select the nearest one (if it isn’t already selected) and press Enter. Press Enter again to continue through the next prompt, to Select a Mirror.

At the HTTP Proxy prompt it’s unlikely that anything needs to be filled in. In the unlikely case that an HTTP Proxy is needed to access the Internet, enter its address and press Enter. Otherwise leave the text box blank and press Enter.

Network Mirror

Mirror Location

Select a Mirror

HTTP Proxy

Completing the Installation

Press Enter to get past the Popularity Contest prompt. Under Software Selection, use the space bar to uncheck the Desktop environment option, leaving only the Standard system selected. Press Enter to start downloading and installing packages.

Answer Yes to the install GRUB Bootloader prompt — note: this article assumes the only OS on the server is the one being installed now, this might not be the correct choice for all setups.

When Installation Completes a prompt will offer to restart the newly installed system, remove the CD from the drive and press Enter to restart.

Save and exit by pressing: Ctrl-x, followed by y then Enter. Now type the following command:

apt-get update

Remote Access (using SSH)

Instead of working at the server, it is much easier to access it from a laptop or desktop remotely (although this can be taken too far: server admins taking their laptops into the lavatory, for example). Type:

apt-get install ssh openssh-server

When asked Do you want to continue [Y/n]? press Enter. Wait for the installation to finish, then type:

nano /etc/network/interfaces

Find the section that looks like:

# The primary network interfaceallow-hotplug eth0iface eth0 inet dhcp

Then change it to the following, these settings may have to be changed according to the network setup (particularly the address and gateway, type route -n at the command line to find out the latter):

The advantage of remote access is twofold: firstly, it means the work does not have to be done physically at the server, and secondly, commands can be copied from this article and pasted onto the command line (much less typing). If possible, follow the rest of the article using SSH to remotely access the server.

Install VirtualMin

VirtualMin is a free control panel for GNU/Linux servers. It includes everything needed to run a Web server: PHP, Perl, Ruby, MySQL, PostgreSQL, quotas, e-mail server software, anti-spam and anti-virus software, and much more. Install it by copying and pasting the following commands:

Press y, then Enter to start the installation (this will take a few minutes). The only thing needed are some add-ons for php that allow it to access mysql and a few other things. Copy and paste this to the command line:

apt-get install php5-mysql php5-pgsql php5-gd

When asked Do you want to continue [Y/n]? press Enter.

Now view the newly installed VirtualMin. Open a Web browser and enter the URL: https://192.168.0.200:10000 (change the IP address according to the address in /etc/network/interfaces). Then enter root in the Username, and the corresponding root user password.

Setting up a domain

With all software installed, the next step is to create a domain. See the Virtualmin video introduction — although the automatic software installation shown in the video is only available in the commercial version.

A Note on Domain Names

If this server is being used for internal development, then the Domain name entered when creating a Virtual server (in Virtualmin) will need to be pointed to the server. This is done by editing the hosts file on each client computer. For a server with an IP address of 192.168.0.200, and a domain name of site.webserver.local the following should be added to the hosts file on the client computer:

192.168.0.200 site.webserver.local

See these instructions on editing the hosts file. Then try it by opening a Web browser and entering the URL: http://site.webserver.local. If that doesn't work, make sure there is an index.html uploaded to the server. Hint: this can be done with FTP, using the user name and password entered when the Virtual server was created. Virtualmin stores Web site files in /home/*Virtual server name*/public_html/.

VirtualMin Support

For those who need enterprise grade support, this package is also available under a commercial license (keep the PHB happy), with support. Products are shown at the online shop.