In this quick tutorial, we will be aiming to install a dedicated web server for free. There are several reasons a web server will come in handy, including a testing platform for websites and hosting them afterwards. It will take about one to two hours and should be easy enough for beginners to complete. As an overview, we’ll be installing the Ubuntu Server operating system because of its user friendly interface and simple administration. It is a solid choice for anyone just getting into the Linux community. A LAMP stack will be installed afterwards, which consists of Linux, Apache, MySQL, and PHP. Apache is the best web server out there currently. Finally, we’ll install a firewall for your server, to prevent any intruders from tampering with your hard work.

We must first acquire a copy of Ubuntu Server onto a blank CD or some sort of portable device. Head over to the Ubuntu website and click on the download link on the left menu, and choose Server Edition. Burn the .iso onto a blank CD. If you don’t have an ISO burner, there are multiple reliable and free programs on the internet that you can find easily. Next, install Ubuntu Server onto your computer, or server if you have one. Boot from CD, and the Ubuntu install will run automatically. Select “Install Ubuntu Server”, and follow the simple instructions to complete the installation. As a quick note, make sure you label all of your variables, such as host name, properly and clearly so you can reference them later.

Once Ubuntu is installed, you have to transform it into a web server. Installing applications on Ubuntu is different from the typical way, but still relatively simple. We’ll need Apache to establish a web server, MySQL as a database server, and PHP as the server side language. In order to install all three of these entities on Ubuntu, go into the Package Manager, and type in the following command: sudo aptitude install mysql-server php5-mysql apache2 libapache2-mod-php5. Press enter and Ubuntu will automatically download and install the programs listed in the command. If there are any missing requirements needed, Ubuntu will automatically install those for you too.

Once all of the installations are in place, we need to test if the web server is up and running. Find your server’s IP by typing in ifconfig | grep inet in the command line. Locate the first IP listed and copy it down. Go to your web browser and type in that IP. If you get a response that says “It works!”, then you have successfully installed your own web server. Don’t pop the champagne yet though; we have to install the firewall.

We’ll want to install a command-line firewall in order to protect our web server. Shorewall is a reliable standard command line firewall. Install it by typing: sudo aptitude install shorewall. Once installed, we need to establish permissions. Block all connections besides the HTTP port and the SSH port by opening up the rules: sudo nano /etc/shorewall/rules. Add in these lines where it says #LAST LINE: HTTP/ACCEPT net $FW. SSH/ACCEPT net $FW. Then, press ctrl-o and ctrl-x. Your firewall is now optimized to only allow incoming HTTP and SSH traffic. Congratulations, you now have your very own dedicated web server, and for free. Go celebrate and have some fun!