Home      Portfolio      Technologies      Contact Us  
Date: Fri Jan 23, 2004 1:21 am
Topic: Article 7- Basics of running your own server
It's been quite some time since I posted an article.. I found this one 3/4 done
so I decided to update it and finish it up...
Ok.. I've had a request to whip up an article about the basics of running your own server.
Nowdays there are many solutions to running your own website (hopefully
running with PHP scripts). People can use a cheap and simple virtual hosting
type setup, if you have a larger site you may want to look at your own server.
Either paying for a dedicated one, or running one at home, perhaps on your cable
or DSL connection.
Firstly why would you move from a virtual hosting environment to a dedicated one?
Most likely you have grown your site larger than most virtual hosting environments
were meant to handle. Perhaps you:
- require extensive amounts of disk space
- transfer extensive amounts of data
- use extensive databases to generate your pages
- need a very custom configuration of php/apache that cannot be handled by vhosting
Now if you think you are ready to move your things out to a dedicated server, you need
to be ready to do some setup and administration. I'm only going to focus on setting up
a generic linux/apache/php/mysql webserver in this article.. If you wanted alot of
this article could probably be used to aid you in setting this up on a win32 platform.
Firstly decide if you want to pay a service provider for a dedicated server or run one
at home (hopefully your ip is quite static). If you want to look at a few providers
that offer dedicated servers, here are a list of 2 that I have heard are not bad:
(99$US/month for dedicated machine)
(99$US/month for dedicated machine)
Now if you decide to run something at home, you'll need to scrape together the parts to
get a running machine.. Now keep in mind a server doesn't have to mean dual cpu, gigs of
ram, etc.. For most websites you could get away with a Pentium 2 machine with 128MB 
of ram and a 5+GB harddrive and a 10mb nic.
We'd all love to have a kick butt fast machine, but for most smaller websites (not using
super dynamic content) can get away with a rather modest machine.
Get the machine together and install a linux distribution on it.. I'm not going to go thru
this.. There is plenty of support out there and most distributions are very automated in
the install. Now I do reccommend using a 3rd party machine for this.. Don't use your main
PC as you'll most likely wipe out all the data on the harddrive, and if the setup doesn't
work you won't have a working machine to search the web for support. Go out and grab 
a 150$ clunker machine, it may take a very long time to compile/install alot of stuff 
but you'll have a working machine to use.
This is a step that SHOULD be done before you physically connect your linux machine 
to the internet. The internet can be a rough place and people will always try to break into 
other peoples systems. Take the time to secure your machine. This basically means 
setting a good password, and turning off all the services that the system has that you 
don't need. Search the web for a how-to to do this.
Once you've got linux running on this machine, make sure your network card is working, 
otherwise you won't be able to talk to the outside world. Next step is to establish 
connectivity thru your cablemodem or DSL.. Now this is where things get a little more 
complicated and I want to spend as little time as possible. Your machine needs an IP 
address. There are a few options here, connect your linux box directly to the cablemodem 
via a hub/switch, so that both your PC and linux machine can get an external IP address. 
Option 2 which is more likely for DSL. Most DSL modems uses PPPOE to connect to the 
internet. While there is a PPPOE client for linux I'd rather not get into it.. I'd
suggest getting yourself one of those DSL/cable routers (they look like a 4 port hub).. 
you plug the router into the cable/dsl line, configure it and then as many computers 
behind it you want. The only special thing in this case, is that you will need to configure 
the DSL/cable router to forward port 80 (http) to the ip address your linux box has been 
configured as internally, as the router is acting like a firewall now. If you want to
run PPPOE on your linux box, look for roaring penguin PPPOE client (comes with some 
distros now, otherwise search freshmeat.net for it)
All that behind, you've got connectivity with your machine.. If you went with a colocation 
decicated machine you don't have to deal with any of this, the ISP will just give you the 
IP, login and password of your machine and you are fully setup.
A few quick notes on managing servers. It can be time consuming! Now most of the 
servers that I manage host a maximum of 10 sites.. Some of them just 1.. In that can 
you can have a very unique setup and not have to worry about configuration issues.. 
One application I have recently started using is called Plesk. It's a hosting application 
that runs ontop of linux, and manages everything on the server (databases, virtual
hosting, email, ftp accounts, etc). And if you are going to host a wack of sites on a 
server, this program may be well worth looking into as it cuts administration time down 
extensively. Just a note, I don't work for these people or get any referrer fee *Wink* I 
have just been using it lately and found when hosting 40+ sites/applications on the 
same server it reduces adminstration time.
At this point your going to want to install apache/mysql/php. You can either opt to do 
a RPM/DEB install if you are using a distribution that supports packages. I prefer to 
custom compile all of those myself to disable and remove alot of functionality that 
I don't use.
I wanted to keep this article short and not very detailed, but to encourage people to 
go out and experiment.
You only learn something by going out and attempting it. Even if you fail or run into 
difficulties you'll end out on top in my books.
My only advice is be sure to not connect any systems up to the internet that are not 
properly secured from being broken into and used against other hosts on the internet. 
Don't decide to host your company website at home ;( As great as the idea might 
sound at some point, home connections DSL/Cable are to be considered
unreliable for commerical hosting. When you can get a dedicated box for 99$ a month, 
it's hard to justify running anything critical at home.
Please post feedback, questions, or more importantly what you want me to write 
about in the future.  I'd like to write more on the topic of PHP programming and design.
Managed With Tymbrel