Being my first blog post, I find it fitting to share how I actually got this site up and online in hopes that it might benefit someone else looking to accomplish the same thing.
Start by purchasing a domain name. I chose GoDaddy.com. Make sure that you google for promo codes before you actually buy the domain. There is a good chance that you will find something that can save you a considerable amount.
If you bought your domain name from GoDaddy and choose to host your site with them as well, you won’t need to make any necessary changes pertaining to your domain name. But if you choose to host with a different hosting company (such as Rackspace), you will need to log in to GoDaddy and update your name servers. The name servers will be provided to you by the company that you are hosting with. The name servers for Rackspace are DNS1.STABLETRANSIT.COM and DNS2.STABLETRANSIT.COM respectively.
Next, buy some server space. Many options are available including cloud and dedicated servers. Dedicated server will cost substantially more, but provide better performance. In both cases, the steps needed to install the correct software are the same. If you bought a server from Rackspace, log into the control panel. You will need to install an Operating System. I chose Ubuntu 10.10. It only takes minutes for the server to install your OS and soon after you will have an entry in your servers table. Click on the name of your server to continue configuration. This will bring you to a control panel where there are helpful tools such as resizing and rebooting your server. For now, click on the DNS tab. Under the “Domain Management” heading, click “add” to add a domain. Enter your domain name here (yoursite.com) and click OK. This will add your domain to the table. Click on your domain to continue configuring. Here, you will enter in three DNS records: Types A, CNAME, and MX. Configuration goes as follows:
Type: AName: yoursite.com (make sure you do NOT add www.)Content: your IP Address (34.234.45.32)TTL: 300Type: CNAMEName: www.yoursite.com (make sure you DO add www.)Content: yoursite.com (make sure you do NOT add www.)TTL: 300Type: MXName: yoursite.com (make sure you do NOT add www.)Content: yoursite.com (make sure you do NOT add www.)TTL: 300Priority: 10
Now that your domain name and host are configured, you need to install the lamp stack. Fortunately in Ubuntu 10.10, you are able to install Apache2, PHP5, MySQL and all the inter-dependencies with one line.
SSH into your server via the IP address that your hosting company has given you. Once authenticated, type the line:
sudo apt-get install lamp-server^
Make sure you have that carrot at the end, or this command will not work properly. About half way through set up, it will prompt you to create a password for the root user in MySQL. Do not forget this password, it is a headache if you do. When installation has completed, navigate to your Apache configuration file. It can be found in: /etc/apache2/apache2.conf. After the line #ServerRoot “/etc/apache2″, add this Directive:
ServerName yoursite.com:80
If you want to allow virtual hosts on your server, navigate over to your httpd configuration and open it up. It is located in /etc/apache2/httpd.conf. Enter the following code and save the file (this is assuming you will make a directory called “yoursite” in /var/www):
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/yoursite
ServerName www.yoursite.com
ServerAlias yoursite.com
</VirtualHost>
Next, navigate to the ports configuration. It is located in /etc/apache2/ports.conf. Comment out the lines (because you have now defined them in your httpd.conf):
NameVirtualHost *.80
Listen 80
From the command prompt, run the command (to enable mod_rewrite):
sudo a2enmod rewrite
Once this has finished installing, restart Apache!
sudo /etc/init.d/apache2 restart
Your LAMP stack is now ready for action.