Sunday, July 13, 2008

How to host your own website at home




Things You’ll Need:

* A high speed internet connection (preferably one with a high upload rate)
* An extra computer that will run 24/7 with a constant internet connection and with at least 512 mb of ram

Step1
First check to be sure that you do not have anything of value on your old computer because we will be erasing it completely.

Once you have your old computer ready to go download a copy of centos from either http://downloads.madtux.org/free_downloads/free.php?product_key=CentOS50x86_64DVD for the 64bit computer (I have not personally used this but should work just the same as the 32bit one) The 32bit download here http://downloads.madtux.org/free_downloads/free.php?product_key=CentOS50i386DVD (this is what most will be downloading unless you have a fairly new computer.

Next burn the image to a dvd and if your computer does not have a dvd burner or your old computer does not have a dvd reader you can download the cd versions from here: http://downloads.madtux.org/free_downloads/free.php?product_key=CentOS50i386CDSet

Step2
Next insert the dvd or first cd into the old computer and point the bios to boot from it. Install centos. If you need any additional help doing this check out the beginning of this tutorial http://howtoforge.com/perfect_setup_centos5.0

Step3
Once you have booted into Centos for the first time it is a good idea to install the updates (their will be a pop up in the right corner). After you have done this it is time to install everything you will need for your web server. We will be installing only the basic LAMP server (Linux + Apache + MySQL + PHP/Perl).

Step4
First we will install the Apache Web Server 2.0. We will be doing this in the command terminal because it is easier for a tutorial. To open a terminal right click on the desktop and go to terminal.

In the window copy in this text: yum install httpd httpd-devel
and press enter, it should start downloading a little but then it will ask you if you want to download the larger file and you have to press "y" and then enter again. After the terminal returns to the normal prompt copy and paste in:
/etc/init.d/httpd start
this will start your web server for the first time. (a green OK should appear on the right)

Step5
Next we will install the MySQL Database Server. This is not needed for every website but is is certainly something that you might need as you develop your website.

Once again copy and paste in the terminal:
yum install mysql mysql-server mysql-devel
again wait for it to ask you to press y to download the main files.

After you return to the normal prompt, copy in:
/etc/init.d/mysqld start
this will start mysql

Step6
Next we will install the PHP scripting language.

In the terminal again copy and paste in:
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
and press enter as always and again wait to press y and enter to download.

After the installation has completed you will need to restart apache to load in the php you just installed to do so copy in:
/etc/init.d/httpd restart
into the terminal.

Now your server is up and running but to keep it running if you restart the computer copy in:
chkconfig httpd on
(press enter)
chkconfig mysqld on
(press enter)

Step7
Now you are all set on the computer we have to work with the internet end of setting up the web hosting server. To test if your server is running open up firefox and type in:
127.0.0.1
You should see a centos test page if not look back to the apache instillation and see if you installed everything right.

Now to configure the firewalls so that people can access your computer to view your web page, you will need to go to the to left and click on system and then administration and then firewall. And make sure that the http and https are clicked. Next we need to forward your router so that port 80 and 443 are froward to your web server. If you need help forwarding ports there are some excellent tutorials on this website.

Step8
After those ports are forwarded your website (for this tutorial just the centos test page) will be visible on the internet but to access it you have to type in your ip address because we have not set up a domain name yet and you can not access your own website from external internet because you have the same ip address. But if you go to a friends house and type in your ip address (this can be found on the information page of your router) you should see the web page.

Step9
The next step is linking the ip address to a domain name. You might have to pay for a domain but it is not that expensive I got mine for 8 dollars. The only problem is that if you are hosting from a residential internet account your ISP typically gives you a dynamic ip address meaning that it changes often with out your notice. To counter act this I signed up for a free account at no-ip.com and download the linux client that will send your current ip address to there server every 5 min or what ever you like and give you a stable domain name, such as yourwebsite.no-ip.com thus when ever you type that in to your address bar it will find your correct ip address.
Step10
If you are lucky enough to have a static ip address simply point your domain to your ip address. And you are done


Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home