Ubuntu Home Server

Ubuntu Home Server

An Ubuntu Linux Home Server can be built with the server or home edition. Using Ubuntu for a Linux Home Server is an excellent option because it is free, the support and documentation is very good and updated and in general, it performs well. Furthermore, Ubuntu is such a good desktop operating system that using it as a server at the same time can offer the best of both worlds.

Install php and mysql

user# sudo -s

For all installations, type 'Y' when necessary
root# apt-get install mysql-server mysql-client
root# apt-get install apache2

root# apt-get install php5 libapache2-mod-php5
root# /etc/init.d/apache2 restart

Restart server and set the config to restart automatically (often, this is already the default setting). 

Router Port Forwarding for your IP
Test your ip in browser.

Create a DNS zone for which the website points to your ip. Set the dns to point to your ip. You can do this with an online hosting account or free service like free dns.

root# /etc/apache2/apache2.conf
Open the file in text editor and scroll to the bottom
Add: Include conf.d/sites/*.conf

Make a new folder called sites
Now, open the directory /etc/apache2/conf.d and make a file for your website. For example, for the website example.com I will call the file example.com.conf. It is a good idea to give the file the same name as the top level domain since it is unique and you will be well organized.

root# vi example.com.conf

Add a virtual host entry to the file:

<VirtualHost *:80>
        ServerName www.example.com
        ServerAlias example.com *.example.com
        DocumentRoot /var/www/example.com

        <Directory "/var/www/example.com">
                Order allow,deny
                Allow from all

Now set up the folder for the site example.com
open /var/www/
root# cd /var/www
root:/var/www# mkdir example.com
Copy the original index.html file from www/index.html to www/example.com/index.html
root# cp index.html example.com/index.html
Edit the example.com/index.html so that you know it comes from this directory. Just add a simple line like "This is from example.com"

Access your firewall in browser (ie
Select advanced > allow port 80 with tcp