Introduction: Home Server / Host Your Own Websites!

From the guy that brought you Table top aquarium https://www.instructables.com/id/Table-Top-Aquarium


1. Ubuntu Server edition 10.04 LTS - http://www.ubuntu.com/business/get-ubuntu/download
  - put it on a cd. guide on ubuntus site.
2. Fusion WOL - Remote switching on of the server - http://www.fusion-online.com.ar/en/products/wol/
3. FileZilla - http://filezilla-project.org/
4. A pc for the server nothing special..
5. Make sure the PC has a cdrom drive


If you need help drop me an email! I also offer setup services remotely if you want me to do everything else. after installing Ubuntu. send me an email brett_pittaway@yahoo.com

Step 1: Pre Game

I suggest having another computer near by for this entire build, in part to follow this instructable in part for using for remote access to test certain steps along the way.

Set up your soon to be server, power, monitor, keyboard, (no need for mouse), internet connection.

1. Before installing ANYTHING go into your BIOS ( On my computer that was switch on the computer and press DEL key)
   - Find the Wake on Lan Feature and enable it.
   - Make sure your computer is bootable from CDROM drive ( Mine was i just had to hit F12 to change the boot order)
   - Save settings and PUT THE UBUNTU CD IN THE DRIVE
2. Restart and boot from the CD (I had to press F12 and select the CD to boot)
   - You get the screen below
3. Next step... INSTALLATION.

Step 2: Installation Part 1 - Install Ubuntu Server

Ok I will make this as easy as possible so here we go....

1. Select your language ( I picked ENGLISH) Then Press ENTER
2. You will now see the UBUNTU INSTALL MENU.
3. Select "INSTALL UBUNTU SERVER"
4. It will ask if you want it to AUTO DETECT your keyboard layout, Select NO
5. Select your keyboard layout (For me it was USA)
6. If you DIDNT FORGET to plug in the internet ethernet cable the next thing you will see is the system setting up the networks, checking for drives etc..
7. If you DID FORGET to plug in your internet follow the onscreen instructions.
8. You will now get a screen that says 'Please enter the Hostname of this computer' (You can use anything here its not relevant I used web-server), hit enter.
9. Set your time Zone, hit enter.
10. After some more detection it will say "Partition Disks" Select GUIDED - USE ENTIRE DISK (you could go with lvm but honestly for home use its not needed and creates extra work. hit enter.
11. Select the Disk you want to use, generally the only one you have. hit enter
12. It will ask do you want to write changes.. select YES then hit enter.
--- INTERMISSION ---
13. Go to the bathroom, get a cup of coffee it will now install.
--- INTERMISSION ---
14. Once installed it will need a "user account" to log in everytime you need to do anything.
15. Enter your name or business name here, hit enter
16. Next it will ask for a username (Do me a favor, GET A PEN AND PAPER, write it down), hit enter
17. Next it will ask for a password (Write it down TOO!), hit enter
18. It will ask you to re-enter your password, do it then hit enter.
19. Next it will ask you to set up your proxy info (if you dont know what it is then just hit enter - advanced users will know what to do here)
20. It will go through an updates loading screen.
21. Next you will come to a menu of options...
  - IMPORTANT: DO NOT HIT ENTER RIGHT AWAY
  - Highlight "OPENSSH SERVER"
  - PRESS SPACEBAR (you will see an * next to "openssh server")
  - Then press enter look at the screenshot.
22. ALMOST DONE - It will go through installing your selections and updates.
23. REMOVE CD, and restart your PC then go to the next step.

Step 3: Login, Update, Package Installs

Congrats! you now have the server installed! Now its time to install the key components!

Update First

1. Once the computer has booted after install you will be welcomed with the login page
2. Enter your username then hit enter
3. It will ask for your password (NOTE: it will look like its not typing thats normal.) Hit enter
4. now its time for some command line codes.. I will Put what you have to type in bold to make it easier.
5. First lets update yoru server with the latest packages.
6. Type: sudo aptitude update && sudo aptitude dist-upgrade   hit enter
7. It will ask if you want to continue press y then hit enter
8. After the updates install you will need to restart type this to restart sudo shutdown -r now

Install apache, mysql and php - These are needed to run a website.


1. Log in to your server again
2. Once logged in type sudo aptitude install apache2 php5-mysql libapache2-mod-php5 mysql-server hit enter
3. This begins to install everything for you.
4. During install you will be asked to enter a "MYSQL" password, make it difficult and write it down. hit enter
5. Another hard part done!
6. Next step

Step 4: Security

Time to reward yourself!

1. Type ifconfig | grep inet
2. It will display a bunch of info what your looking for is the inet addr mine was 192.168.177.129  Use your OTHER COMPUTER (it must be on the same network) open a browser and type in that number hit enter
4. You should see a window load up that says something like "It Works!"
5. Rewarding isnt it!
6. OK youve had your fun.. Now back to the server..

Security

1. We dont want any personal info about your server being shown so do the following
2. Type sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak - this backs up the config file
3. Type sudo nano /etc/apache2/apache2.conf - this opens the file in a text editor
4. Look for "ServerTokens Full" and change it to "ServerTokens Prod" - If you cannot find it add it to the end of the file
5. Look for "ServerSignature On" and change it to "ServerSignature Off" - If you cannot find it add it to the end of the file
6. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
7. Now lets do the same for php
8. Type sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.bak
9. Type sudo nano /etc/php5/apache2/php.ini
10. Look for "expose_php = On" and change it to "expose_php = Off" - If you cannot find it add it to the end of the file
11. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
12. Now lets restart apache to update the changes
13. Type sudo /etc/init.d/apache2 restart

Firewall - shorewall

1. Type sudo cp /usr/share/doc/shorewall/examples/one-interface/* /etc/shorewall/
2. Type sudo nano /etc/shorewall/rules
3. Add the following lines above where it says “#LAST LINE”
4. HTTP/ACCEPT net $FW
SSH/ACCEPT net $FW

5. Look at the image below
6. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
7. Now lets make sure it runs on bootup
8. Type sudo nano /etc/shorewall/shorewall.conf
9. Look for "STARTUP_ENABLED=No" and change it to "STARTUP_ENABLED=Yes"
10. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
11. Type sudo nano /etc/default/shorewall
12. Look for "startup=0" and change it to "startup=1"
13. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
14. Firewall Done!

Permissions

Before we go further lets change some permissions.
1. Type sudo usermod -g www-data [YOUR USERNAME] (replace this with the username of your system you wrote it down earlier)
2. Type sudo chown -R www-data:www-data /var/www
3. Type sudo chmod -R 775 /var/www
4. Permissions done!




Step 5: Webmin Remote Management

Lets now install a remote management application so you can access your server and make changes anywhere in a nice graphic enviroment

1. Type sudo nano /etc/apt/sources.list
2. Add these two lines of code
deb http://download.webmin.com/download/repository sarge contrib
 deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
3. press "CTRL - O " this saves the changes then press "CTRL - X " this exits the editor
4. Then type the following
wget http://www.webmin.com/jcameron-key.asc
   sudo apt-key add jcameron-key.asc
   sudo apt-get update
   sudo apt-get install webmin

5. Now go to THE OTHER COMPUTER and open a browser then type this
https://[IPAddress]:10000 - (IP Address is what you used earlier)
6. This should load up webmin - if you have any problems visit webmin.com
7. Next Step

Step 6: Access Over the Net! and FTP Guide

Now weve done all the work on the server lets get it working WORLD WIDE.

1. This part is hard to explain but I will do my best.
2. You need to port forward from your router to your server so that it handles connections and outside access.
3. Log into your router, you can get this info by searching online easily for your router.
4. For me I open a browser and login by typing 192.168.1.1 ( I have a linksys)
5. GO to port forwarding and create these permissions.
  on port 22 and port 80 to the ip of your server (you used this earlier)
6. An easier option is to DMZ the ip address. (this will allow the net to go right to your box with little work and the firewall will take care of it.)
7. Also get the MAC address for the server IP this will be used for remote switch on of your server
8. Done.

Now for the rewarding part. GO to http://what ismyip.com write down the ip address. This is how the internet sees your access.

Open a new browser and try these two links
http://[ThenewIP] - this should get your page that says "It Works" If you call a friend and tell him to do the same from his computer guess what.. he will also see the same thing!
https://[ThenewIP]:10000 this will get you into webmin to manage your server

COOL so now we have gotten your computer accessible WORLDWIDE now what...

Lets get you FTP access so you transfer web files to your server
I use Filezilla to access my server and its much easier in my opinion. here are the steps.

1. On any OTHER COMPUTER open filezilla
2. Click "File" (top left corner)
3. Click "Site Manager"
4. Click "New Site" - bottom left
5. Under host put your new ip address 
6. Under server type select "SFTP - SSH File Transfer"
7. Under login type enter your server Username
8. Under Password enter your server password
9. Hit Connect
10. navigate to this directory /var/www/
11. upload your website there...
12. YOUR DONE!! you have a website accessible anywhere by your IP!

Step 7: Wake on Lan

Your visiting a friend and you want to show him your home server... But its not working it must be off....
Thats ok..

1. Download Fusion WOL and run it.
2. Enter your IP address. There is one other thing you will need from the server. the MAC address. Once you have it enter it in FUSION WOL
3. hit turn on PC
4. Now that button sent a signal to your server to switch it on. give your computer up to 10 minutes to turn on.. and then VOILA you can show your website, access ftp or webmin!

YAY YOUR ALL DONE!!!