Menu

Home

Genealogy

Linux

Introduction

In order to host a website you ideally need a connection that is available 24/7 which ADSL or ISDN will provide. I would suggest that if you intend to do this, the minimum speed is 512K connection as the half rate, which some ISP's are now providing, is really not fast enough. If you analyse the cost, the half rate is not cost effective. In choosing an ISP you must also make sure that they allow you to host a server on Port 80. Some ISP's do not allow this and block port 80. You also need to establish that there are no limitations on your bandwidth. If you have a bandwidth cap you will need to ensure that you keep within this limit. Also try to get a contract that will give you a static IP address as they are much easier to work with.

Server details

An Internet server needs a public IP address that someone else on the Internet can point to. As a user you are used to using name resolution such as this server which has an address of http://www.oats.org.uk however all servers have a specific IP address and the IP address for this server is http://83.67.66.148 . Using either address will enable you to reach this website. In my case my ISP has issued me with this static IP address which is always mine. Some ISP's only issue dynamic addresses. A dynamic address is issued by DHCP and is "leased" to that system for a specified period of time by the ISP. You may have that address until you shut the system down and login again or it my be renewed daily.

So how does this affect you? If you have a static address it is fairly simple as you can now go out and buy a domain name and link this domain name with your IP address. The registrar I used is ideal; easily.co.uk as they have a Control panel that allows you to specify your IP address. If you have a dynamic IP address then things become quite complicated as your IP address is changing constantly. When you buy your domain name then you need to go to a secondary server like www.dyndns.org to redirect the address when it changes. This requires a server side script that runs periodically and discovers your current IP address and sends it to www.dyndns.org to update it. This is covered in most of the links I have provided. If you have not used Linux before this whole thing can be very daunting indeed and hence I recommended a static IP address.

Having got an IP address and a domain name you need a connection. It is important to get an ADSL modem/router with at least one ethernet port. There are only a very few USB type ADSL modem/routers that work with Linux and they are much slower than ethernet. Now you need a box. The specifications will depend on what you want to serve up. If you are only going to produce basic html pages then anything from a an old 486 to Pentium 2 class computer with 128MB RAM will do. If you plan on delivering movies, music etc then you are going to require some significant power and big memory.

Installing Linux

A very basic install of Linux is all that is required. Linux owes its heritage to Unix and as such is a perfect operating system for servers. The whole idea is to get a system that can be controlled via another computer. To setup Debian Linux follow the very detailed guide at The Perfect setup - Debian. or these excellent Debian Guides. These howto's will take you through the basic install and then help setup a mail server and the Apache Internet server together with mysql and php. Once the server is setup you can then get the networking established. To get the server online you need to configure your modem router to do port forwarding, specifically port 80 which is the port the apache server will be listening on. You may need to consult the manual to find out how to do this. I personally have used static addresses because I only have a few machines on the network and it is therefore quite easy to get name resolution on the internal network. All my machines run Debian Linux but if you wish to operate in a Windows environment you will have to install and configure Samba. Here are a few sites that cover a Linux installation and Windows configuration ;

How to setup a free web server and;

DSL/Cable Web server

My Home ADSL web server

If I can pass on one very important tip on networking and that is always remember that an IP address is always assigned to a network card and not to a machine. Many of the modem routers use the 10.0.0.X range of network numbers. If you install 2 network cards in the server, one connects to the router (external interface) and the other connects to your network (internal interface). So briefly if the router is working in 10.0.0.X range and you want to retain this then the first network card (eth0 in Linux) should be assigned a number in the same subnet i.e. it should also have a 10.0.0.X number. e.g. the router uses the range 10.0.0.0 to 10.0.0.15 then use a number such as 10.0.0.2. When setting up the routes remember that the gateway to the Internet will be via eth0 or 10.0.0.2 for the server. The internal network gateway to the Internet will be via eth1 or internal ethernet address which may be an address like 192.168.X.Y. It is important that the internal network is on a different subnet to the the external interface. If they are on the same subnet then you will have trouble with the routing. Believe me, it took me a day to figure this out!

Now you have a working network it is possible to remove the attached screen and keyboard and run the machine from another. If you are using a Linux system then there are 2 methods but they both work through ssh. ssh means secure shell. To login via ssh the command is ssh root@IP_number or if you have the name of the server in your /etc/hosts file, say server, ssh root@server this will request the password for root which is what you set when you installed the system. The server will issue a key to the machine logging in which will be stored on that machine. Once you have the key that machine will be granted access with the password. To get a GUI (graphic user interface) I use KBear which is a ftp program for KDE. I do not use Windows but I am sure once you have Samba configured you could use any ftp program. Note that because Windows does not have the same level of security they have no provision for ssh and therefore ssh cannot be implemented but there may be a program available for ssh implementation under Windows. A reader has kindly recommended an open source program called PuTTY which will allow ssh communucation between an MS Windows box and the server

Before allowing external access to the system via the Internet you should install a firewall. I use my server as a firewall and router . i.e. all traffic from the Internet is passed through the server. I have firewalls on all the internal machines as well. I have done a write-up on how to implement MonMotha's NAT/firewall script here. Just follow the guide and install the script and you should have no problems. If, like me, you want to use your server as a router as well then you also need to install ip masquerading.

Tips for Linux users

If you want to enable users to contact you but don't want spamers to harvest your e-mail address then setup a php mail form. You obviously need to have php, pop3 and imap installed on your server to do this. Here is a quick way to do this.
Get the php scripts form.php and process.php from here and follow the instructions.
Now you need to modify the line "mail('youremail@domain.com' to your_name@localhost where your_name is the name in /home where mail is sent. This will enable you to collect the mail via your e-mail client.

Well that's it. Have fun with your new home in cyberspace.

I hope you find the information useful and enjoy the site. If you have any suggestions or comments or would like to contact me then please e-mail me
Rob Oats
August 2005