Setting Up a Dedicated Web Server

How to Setup a Dedicated Web Server for Free

Tutorial Details
  • Technology: LAMP Install
  • Difficulty: Intermediate
  • Completion Time: 1-2 hours

All great websites have a great server behind them. In this tutorial, I’ll show you how to set up a dedicated web server (with Apache, MySQL, and PHP) using that old computer you have lying around the house and some free software.


1. A Quick Overview

In this tutorial, we are aiming to accomplish several things:

  • We’re going to install the Ubuntu Server operating system. I commonly use Ubuntu because of its ease of use and
    simple administration. It also has a rather large and extremely active community behind it, which makes getting
    support a breeze.
  • We’re going to install an OpenSSH server. This allows you to administer your server from remote computers.
  • A LAMP (Linux, Apache, MySQL, and PHP) stack is going to be installed. This provides the backbone that will run
    your web site. Apache is the industry standard web server on Unix-based operating systems; it’s what most web hosts
    use (NETTUTS is using it right now!) and it’s what we’re going to use.
  • We’re going to install a firewall to protect your server from unauthorized access.

In order to follow this tutorial, you’re going to need a few items:

  • A computer to use as your server. It doesn’t need to be powerful; as long as it’s not ancient, it’ll work fine. Please
    don’t do this on your desktop PC; Ubuntu will completely wipe your computer.
  • A CD burner and a blank CD. These are so that you can burn Ubuntu to a disk in order to install it.
  • Time. Seriously, this process is time-consuming, especially if you run into problems. Try to set aside an afternoon
    to follow this tutorial.

You may be asking why you’d want to have your own web server. There are several reasons, a few of them being: you can have your own testing
ground for your websites; with a little modification, you could host your own site; and, you will learn a lot about Linux/Unix as you go.
With that said, let’s get started!


2. Download Ubuntu Server

First and foremost, we’re going to need a CD with Ubuntu on it. Point your web browser to http://www.ubuntu.com/,
and click download from the menu to the left. You will now be presented with a box with two tabs: “Desktop Edition” and
“Server Edition”. Click the “Server Edition” tab, and select “Ubuntu 8.04 LTS”. Next, select a download location from the
drop-down box. Finally, hit the “Begin Download” button.

Now you need to burn the ISO (the file that you downloaded) to a blank CD. If you don’t know how to do this, there is an
excellent guide at https://help.ubuntu.com/community/BurningIsoHowto


3. Install Ubuntu Server

Now that you’ve downloaded and burned the ISO, let’s get Ubuntu installed on your server. Put the disk in the drive, and boot from the CD. In most modern computers, this will happen by default if a disk is in the drive when you turn it on. If it doesn’t, then you need to press a key on your keyboard right when you turn it on. For my laptop, it’s F12, and for my server, it’s F2. It just depends on your computer. You can find it by looking at the text on your screen right when you turn the computer on, during the BIOS. You’ll see something like “Press [KEY] to change boot order”. Press that key, and select your CD drive.

Still with me? Good. Now that you’ve booted up Ubuntu, you should see the following screen:

Select your language, and hit enter. Now you’ll see this screen:

Select “Install Ubuntu Server”, and away we go!

The installer will now ask you if you want it to detect your keyboard layout. Personally, I always choose no, because
it’s faster to select a standard american keyboard from the list than to have the installer detect it. Either option is fine,
just follow the on-screen instructions.

After you’ve done that, you’ll now see a bunch of loading screens saying things like “Detecting CD-ROM drives” and such.
These should pass quickly and without problems. However, during these screens, the installer will try to auto-configure your
network settings. For most cases, this will work without complaint. However, if it doesn’t work for you, just follow the
on-screen instructions to get it working.

After it’s done with all of that, it will ask you for a host name. You can usually set this to anything; I always set
mine to “web-server”.

The system will now want you to set the time zone for your clock. For me, it’s Pacific. Choose the one that applies to
you.

Now, the system will detect more hardware, and you’ll be prompted to “partion the disk(s)”. Select “Guided – use entire
disk”.

You will now need to select the disk you wish to partition. For most setups, only one disk will be available; however,
for more specialized systems, more options will be available here. Choose the one that applies to you.

It will ask you if you want to write the changes to the disk. Select “Yes” and hit enter. The installer will now proceed
to format the drive and set up the partitions.

Now the magic happens. The system will begin to install. While this happens, go get a cup of coffee. This can take anywhere
from 10 minutes to an hour. It just depends on your system. There might be times that it seems like it’s frozen; don’t worry,
it isn’t. Just let it do it’s thing. However, if it’s stuck on one thing for upwards of an hour, then yes, it is frozen.

Now that the system is installed, it needs to set up the account you are going to login with. First, give it your full
name and hit “Continue”.

Now give it your username. It will normally just set it as your first name,
but you can change it. One name you may not use is “root”.

You will now be asked to provide a password. It is ESSENTIAL that you choose a strong password, or your server will not
be secure at all. I recommend at LEAST a mixture of numbers, lowercase letters, and uppercase letters. However, for my servers
I use symbols, as well as a mixture of the above. DO NOT use a password shorter than 7 characters.

Then, re-enter your password to verify that you typed it correctly.

The system will now attempt to configure the “Package Manager” (we’ll get to what that is shortly). Provide it with your
proxy information, or leave it blank if you don’t use a proxy, and select “Continue”.

The system will now scan several servers looking for updates and configuration settings.

After that has completed, you will be presented with several options to install server software. Now, listen VERY carefully.
Select OpenSSH server, and press SPACE, NOT ENTER. If you hit enter, the install will proceed without installing the OpenSSH server.

You could install “LAMP server” as well, but I have no experience with this option, so we’re going to install it all with a different
command later on.

The system will now install your selected software, as well as other system components.

Finally, the install will finish. Remove the CD, and hit enter. The computer will reboot. If all goes well, you will be
presented with a screen that looks similar to the following:

Congratulations! You’ve just finished the hardest part. Ubuntu is now installed, and it is time to turn this computer into
a web server.


4. Update Your New Server

Before we go any further, we need to make sure your server is up-to-date. To do this, you need to login. First, type your username
(the one you chose earlier), press enter, and then type your password. As you’re typing your password, you’ll notice that nothing
seems to be happening. Don’t worry, that’s the way it was designed to work. After you’ve finished typing your password, hit enter,
and your screen should look similar to the one below if all went well:

Now, type:

sudo aptitude update && sudo aptitude dist-upgrade

It will ask you for you password, and again, you won’t see anything as you’re typing it. After you’ve done that, it will ask you if
you want to continue. Type “y” and press enter. Your screen will look similar to the following:

Your system will now download and install all the latest updates. This will take a while depending on your internet connection. After
it has finished, your computer will need to be rebooted. To do this, type:

sudo shutdown -r now

And let it reboot. Your server is now completely updated.


A Quick Note About “Sudo”

By now, you may have noticed that all of the commands you have typed have started with “sudo”. This is because they require
administrator privileges, and that’s what “sudo” does. It runs the command (i.e. “shutdown”) as an administrator, allowing it to work
properly. This is also why it asks you for your password. However, after you have typed “sudo” once and entered your password,
you do not have to enter your password again for five minutes. Not all commands require sudo, only ones that modify parts of the system.
Got all of that? Good.


5. Install Apache, MySQL, and PHP

It is now time to install some programs. In order to access your sites from the internet, we’re going to need to install a web server (Apache). In additon to the web server, we’ll
also want a database server (MySQL) and a server-side language (PHP) so that we can run popular applications such as WordPress. So,
let’s get to it!

Installing programs on Ubuntu is a lot different than installing programs on Windows or
OS X, in that Ubuntu will download and install the programs for you with a simple command. This is because Ubuntu has something called
a Package Manager, which manages nearly all the programs on your system. All we have to do is tell the package manager
(called “aptitude”) that we want it to install Apache, MySQL, and PHP. To do this, type the following command:

sudo aptitude install apache2 php5-mysql libapache2-mod-php5 mysql-server

And press enter. Aptitude will download and install of the programs you specified. It will also download and install any
dependencies.

During the install process, MySQL will ask you for a root password. You can set this to anything, just be sure you make it long and secure.
Whatever you do, DO NOT leave this blank.

After that has all finished, you now have a fully working web server. To test it out, first find your server’s IP by typing:

ifconfig | grep inet

It’s usually the first IP returned. In my case, it’s 192.168.177.129. Now that you know the IP, open your web browser and point it
to your server IP. If you see the “It works!” message, then congratulations, it works.

However, we’re not done yet. We don’t want Apache or PHP to disclose any information about themselves, as this information is not needed
by your users and could pose a security risk. First, back up the original Apache configuration file:

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak

Now open the configuration file:

sudo nano /etc/apache2/apache2.conf

Scroll down (down arrow) to where it says “ServerTokens Full” and change it to read “ServerTokens Prod”

Now, scroll down a little further and change “ServerSignature On” to “ServerSignature Off”

Finally, press Control-O followed by Control-X. That will save the file and exit the text editor.

Now, we need to do the same thing for PHP. First, back up the original PHP configuration file:

sudo cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.bak

Open the configuration file:

sudo nano /etc/php5/apache2/php.ini

Change “expose_php = On” to “expose_php = Off”

Again, press Control-O followed by Control-X. Now that the configuration files are updated, restart Apache:

sudo /etc/init.d/apache2 restart

You are done setting up Apache, MySQL, and PHP.


6. Install a Firewall

We now are going to lock down our server a bit more by installing Shorewall, a command-line firewall. To install it:

sudo aptitude install shorewall

By default, Shorewall is installed with no rules, allowing complete access. However, this is not the behavior we want.
Instead, we’re going to block all connections to anything other than port 80 (HTTP) and port 22 (SSH). First, copy the configuration
files to the Shorewall directory:

sudo cp /usr/share/doc/shorewall-common/examples/one-interface/* /etc/shorewall/

Now, open the “rules” file:

sudo nano /etc/shorewall/rules

Add these lines above where it says “#LAST LINE”

HTTP/ACCEPT	net		$FW
SSH/ACCEPT	net		$FW

Then press Control-O and Control-X. Your firewall is now configured to only accept HTTP and SSH traffic. The last thing we need to
do is tell Shorewall to start on boot. So, open up the main Shorewall configuration file:

sudo nano /etc/shorewall/shorewall.conf

Scroll down to “STARTUP_ENABLED=No” and set it to “STARTUP_ENABLED=Yes”

Press Control-O and Control-X. Now, open the Shorewall default configuration file:

sudo nano /etc/default/shorewall

And change “startup=0″ to “startup=1″. Press Control-O and Control-X. Finally, start your firewall:

sudo /etc/init.d/shorewall start

Congratulations! Your firewall is now set up and protecting your server.


7. Add Your Website to Your Web Server

Now that you’ve got everything all set up, you’d probably like to add a website to it. By default, all of the files Apache serves
up to the internet are located at “/var/www/”. However, you cannot write to this folder. Let’s make it so you can:

sudo usermod -g www-data [YOUR USERNAME]
sudo chown -R www-data:www-data /var/www
sudo chmod -R 775 /var/www

What happened there was you added yourself to the “www-data” group, and made the website folder writable to the members of the “www-data”
group.

Now, you’re going to log into your server using SFTP (not to be confused with FTPS). Some clients that support SFTP are:
WinSCP (Windows, Free), FileZilla (Windows, Linux, OS X, Free),
Cyberduck (OS X, Free), and, my personal favorite, Transmit
(OS X, $30)

Connect to your server using your username and password, and, if your client supports it, a default path of “/var/www” (if it doesn’t,
simply browse to /var/www once you have logged in): (Transmit pictured)

You may now add your files to this folder (/var/www) and they will show up on your server when you browse to it with your
web browser.

Now, you may wonder why we’re using SFTP instead of FTP. Mainly, because SFTP is already built into OpenSSH (which you installed
earlier). However, it is also a lot more secure than FTP, and makes it difficult (if not impossible) for malicious users to gain access
to your login credentials.


8. Make Your Server Accesible to the Internet

Most modern home networks are behind a router these days. Because of this, your web server will not be visible to the internet without
a little work. As I don’t have every router available to test with, I can only give you general directions in this area.

There are two ways to open your server up to the internet: a DMZ or Port Forwarding. The main difference you’ll notice is that with a DMZ, your server uses the
firewall we installed earlier to protect itself. However, with Port Forwarding, your server will be protected by your router’s firewall.

However, before we go on, you’re going to want to give your server a static LAN address. To do that, login to your router, and look for something
along the lines of “Static IPs” or “Static Routing”. After you have given your server a static LAN address, you can do these next parts. Remember,
Google is your friend.

To port foward, there is an excellent website, PortForward.com, that, while ugly, can
help you get the job done for almost any router. The ports that you want to forward are 22 and 80.

To create a DMZ, you need to login to your router and look for something like “DMZ settings”. Once you find it, add your server to
the DMZ, and you’ll be set. Again, Google is helpful in situations like this.

Now, find your public IP, and voila! You can access your server from anywhere as long
as your IP doesn’t change.


9. Managing Your Server Remotely

Beside allowing you to upload files, OpenSSH allows you to login to your server from anywhere as long as you know it’s IP. For Windows, you’ll
need an SSH client. I recommend Putty. For OS X, SSH is
already installed. Simply open up Terminal, and type “ssh you@yourip“. For Putty, choose SSH, and put in your IP, username, and password
when it asks for it. You’ll notice that, once you login, it looks exactly the same as the screen on the server:

You can do anything from here that you would do actually sitting at the server. To logout from the server, simply type “exit” and hit enter.


10. That’s It!

You now have a completely functioning web server. It makes for a great testing ground, and would even be suitable to host websites with fairly
low traffic. There is obviously a lot left to be learned, but hopefully you have gained a little insight into how web servers work.

If you’d like to read more on the topics I covered, here are some great guides:

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.matthewfedak.co.uk Matthew Fedak

    This is a great tutorial, I followed on similar last year on linode.com when I had a VM. Yes this article is about installing it on some hardware in your office/bedroom but all you need to do to up the stakes is buy a VM from someone like linode.com and you can do all this with a real cloud based VM.

  • http://www.dekarmedia.com Danny

    Great tutorial! I get to the point where I use filezilla for FTP and I cannot connect.

    Status: Connecting to 192.168.21.131:21…
    Status: Connection attempt failed with “ECONNREFUSED – Connection refused by server”.
    Error: Could not connect to server

    When I type 192.168.21.131 it shows the example page. Could this be an issue with my ISP blocking port 80/21?

    • Tom

      I had this problem too Danny.

      This happens because you’re trying to connect via FTP, not SFTP. To solve it, click on File > Site Manager…

      Then add a new site and where it says Server Type, choose SFTP.

      Hope this helps :)

  • rupesh

    Hi,
    Nice tutorial, so simple yet so powerful.
    I had already installed linux server in virtualbox, but didnt know what to do with that. Now after this tutorial,
    not only I am accessing web page from my other host, but i also installed filezilla and i was able to establish ssh connection. This is so cool.
    Thank you very much
    Rupesh

  • http://www.cosmintest123.com Elayne

    I wanted to tell you how much my partner and i appreciate everything you’ve contributed to help improve lives of an individual in this subject matter. Through your own articles, I’ve really gone via just a beginner to an expert in the area. It truly is truly a honor to your efforts. Thanks

  • Pingback: I’m trying to build a webserver…?

  • EJ

    I already have Ubuntu Desktop Edition. Is there a way to convert it to Server edition?

  • Manuel

    First of all, I only need this web server to learn basic PHP and MySQL scripting – so it only has to run locally.

    Secondly, the Ubuntu version I installed was 11.10 (latest version) and the install went smooth; however, I am getting a “sudo: usrmod: command not found” error for “sudo usermod -g www-data [YOUR USERNAME]“.

    Please help, thank you in advance.

  • Manuel

    Please disregard my last posting, I had misspelled one of the commands. However, i do have two issues with the tutorial (which is brilliant by the way):

    1. Under the Apache setup (For the following “sudo nano /etc/apache2/apache2.conf”):
    Scroll down (down arrow) to where it says “ServerTokens Full” and change it to read “ServerTokens Prod”

    * I do not see anywhere on the document where “ServerTokens” is listed.

    2. Under the Shorewall setup – to block all connections to anything other than port 80 (HTTP) and port 22 (SSH): Add these lines above where it says “#LAST LINE”

    * Once again, I do not see anywhere on the document where “#LAST LINE” appears.

    Thank you for any help.

  • Pingback: For those of you looking to setup a server of your very own | Stuart's Blog

  • bvkiran

    Please help!! I am stuck with a command not found error….
    I am not able to get past this command :
    sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
    when i type that I get :
    sudo: cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak: command not found…..
    it happens with all the sudo commands….
    Please help!!!

    • Ben

      I get the same error. Anyone have a clue?

      • Ben

        Never mind, I was typing ect instead of etc. haha

  • ajr

    Thanks! I don’t usually take the time to comment on articles, but this one was just too excellent. Great job & thanks!

  • noname

    It is a lot easier then this and you can have a lot more setup, type these lines via terminal

    wget http://www.ehcp.net/ehcp_latest.tgz
    tar -zxvf ehcp_latest.tgz
    cd ehcp
    ./install.sh

    This will setup the webserver and give you an easy to use control panel to run it.
    visit http://www.ehcp.net for more details

  • G.Avdish

    Nice tutorial!

    I dont know anything about PHP and MySQL but I will start following this tutorial and see how far i can go.

    I read somewhere that WAMP is good, so i downloaded it. But the problem is that i dont know how to handle the program or what to do whit it.

    Is WAMP good or bad?

    • http://crgeary.com/ Christopher Geary

      WAMP is alright, it does the job. I’m currently running MAMP (mac version). If you are using WAMP you don’t really need to follow this tutorial, as here we are installing server OS and LAMP (linux version). If you follow the installation guide for WAMP on a windows PC, it should be straightforward enough. If you have trouble, you could try easyPHP, its not as versatile, but its afar easier to use (its basically the same thing).

      Then, you just make a php file eg:

      Save it with a .php extension, try it out and if you get a page with loads of information on, then it works, your WAMP/LAMP/MAMP/easyPHP or Whatever you install, is running fine.

  • http://142.33.201.111 Mohit Gupta

    This is a wonderful tutorial. It works fine and I can access it out of my network fine. But how do I set up ftp for more folders and how can I host multiple websites on this server? How can I point my domain to this server, setup a folder with ftp access? Will I have to install DNS? Please help me.

  • Pingback: Introducing HNInstant « pennyhacks

  • Ali

    great instructions thanks got my box all up and running..a config on multi sites hosting would be great :-)

  • http://adult-link.me/member92773.html Find filthy sluts online

    such a great look at your website is actually, i am thrilled my spouse and i found visit, i uncovered you actually upon facebook. i’m going to glastonbury this year not to mention document cant hold on.

  • http://ostatic.com/member/jarrodglenn1026 Mindy Ockimey

    I updated to the latest version, and now it keeps on coming up with that tab whenever i startup firefox. What should i do?. I have updated it, there is a tab saying that i have, that is the problem. It is telling me all of the new features that this version offers and everything..

  • http://digzz.com/stories/1736232/Question_is_7_zip_free_.html Harold

    Spot on with this write-up, I really suppose this website needs way more consideration. Iíll in all probability be once more to learn much more, thanks for that info.

  • Prince igwe festus

    I here to introduce myself with the name, for instance as a missionary by call,i want to enquirer if i will be allowed in your country carry out the evangelical mission work.this is our name The city of Living church of God.thanks God bless u.

  • robert

    works great for localhost viewing and development on intranet … but remote access does not. I find my ip address as suggested, then attempt to go there with browser, and it simply takes me to the configuration page for my modem.

    • JM

      Robert, you need Putty or an ssh client to remotely login to your server. Your browser wont do it. As mentioned in the tutorial you can use Putty for an ssh connection and supply your public IP address along with your server username and password. This will allow you to remotely administer your webserver.

  • Yan

    Awesome tutorial. Clear, neat and fully documented. Works perfectly here. Thanks d’-’

  • http://www.aviary.com/artists/lamontleach102 full length mirror

    I just wanted to inform you about how much I actually appreciate anything you’ve discussed to help increase the value of the lives of individuals in this theme. Through your current articles, I’ve really gone through just an inexperienced to an expert in the area. It truly is truly a gratitude to your efforts. Thanks

  • http://www.wholesalesupra.com Lyndsey Mcmurdie

    Some times its a discomfort within the ass to read what men and women wrote but this internet site is really user friendly ! .

  • http://www.doogle.com Andy

    My only ‘criticism’ of this excellent tutorial is no discernment between setting up a ‘serious’ server (i.e. you want it to be 100 everything any server is) and a hobbiest. Using OpenSSH and then SFTP make it very difficult to FTP files from various locations etc. My scenario is doing this ‘just for fun’.

  • JOey

    I have a 2 questions.

    1. when I go to edit the apache config file there is no “server token” or “server signature”

    2. When I went to edit the shorewall/rules I went to edit it and there was no code there what so ever a completely blank black page.

    Is there something I am doing wrong or missing.

    Oh and whenever I tried to back up the config files it tells me those files can’t be found and it tells me to enter –help

  • allan

    i need help; when I typed sudo aptitude update && sudo aptitude dist-upgrade it comes up with
    err http://au.archive.ubuntu.com oneiric InRelease and so on that looks similar

  • Martin

    I need some help. I need to install VBoxManage. I type:

    sudo apt-get update && sudo apt-get install VBoxManage
    or
    sudo apt-get update && sudo apt-get install vboxmanage

    but I get the following error:

    sudo apt-get install VBoxManage
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Couldn’t find package VBoxManage

    What do I need to do to fix this?

  • Jack

    For those having trouble like I did with copying to the shorewall directory and with finding the ServerTokens and ServerSignature lines….this solved it for me:

    For editing the ServerTokens and ServerSignature lines you need to open up a different file than specified in the tutorial. It’s in
    /etc/apache2/conf.d/security

    And for the copying the shorewall example file for one-interface to the shorewall directory, use this command
    sudo cp /usr/share/doc/shorewall/examples/one-interface/* /etc/shorewall/

    This works for me as of 12/28/2011 with whatever release of these programs I have. Not sure where the files might be located in the future

  • Pingback: where can get a free dedicated server? | Turn Hosting

  • CoolinNchillmode

    This is a GREAT tutorial, especially for Linux newbies. I think I had “fun” just like everyone else setting this up, but I was able to get it running. However, I haven’t quite secured it yet. When I go to copy the Apache file, I get a “cp: cannot stat” error — no such file or directory. Is the file I want in another location?

    Update this page…this is great!

  • Todd

    ok i am at the point of starting shorewall and it is saying

    #### WARNING ####
    The firewall won’t be started/stopped unless it is configured

    any one know what this is about?

  • http://becasestudiar.blogspot.com/ Svetlana Kemble

    as I website owner I believe the written content here is rattling wonderful, regards for your efforts.

  • raman

    i have ubuntu desktop eddition and i had install phpmyadmin (LAMP server)…….but now i m confused “what to do” how to add site on server or access remotly “PLEASE HELP ME” …..any body have any idea?????????????? PLEASE HELP i really want to create my own server ……….

  • http://www.bajki.elk.pl Bajki

    There are thousands of sites of the same kind on the Internet, but solely your one includes content I was searching for. I’ll be checking it frequently! I add the site to my bookmarks!

  • http://www.balloonshelium.co.uk Helium

    Hi, thanks for this article, it help me to solve a problem I had installing LAMP for over 10hrs.

  • http://www.w3sanju.in Sanju

    Works great !! Thanks

  • mr.benimble

    When I type my public IP address into a browser it takes me to my modem’s login screen instead of opening the index.html page I have on my server. I turned on the port forwarding on the router, do I need to turn it on via the modem’s configuration settings?

    Below are the options I found in the port forwarding section of the modem’s configuration settings. Can anyone help me figure out what I need to set them to or if the modem even needs to have the port forwarding set?

    Protocol=?
    WAN Port Start=?
    WAN Port End=?
    LAN IP Address=?
    LAN Port Start=?
    LAN Port End=?

  • http://arahmanbd.blog.com Abdur Rahman

    Awesome tutorial for web server till now I found…. described step by step clearly and precisely… thanks a lot…

  • Caitmcd4

    Hi, I’m new to Ubuntu, I followed the instructions throughout the installation. But when I get put in the upgrade command “sudo aptitude update $$ sudo aptitude dist-upgrade” I get the error ” E: The update command takes no arguments” and when I try installing any of the packages I get “Couldn’t find any package whos name or description matched “xxx”, can anyway help be and let me know what I’m doing wrong? Thanks

    • Aidan

      You’re putting in the wrong command…

      “sudo aptitude update $$ sudo aptitude dist-upgrade” should actually be:
      “sudo aptitude update && sudo aptitude dist-upgrade”

      Also if you downloaded the latest version of Ubuntu server you do NOT need to install the packages (apache2, php5 etc…) these come pre-installed. During installation it should as for your mySQL password as this author listed after the package install.

      Basically this guide is for an older version of Ubuntu server, you will also need to follow Jacks comment above to locate the correct files.

  • sezar

    that’s interesting, but there are many important things you didn’t cover in this post, like how much the bandwidth will be? and which control panel we will be using? and will be there emails for your domain? sending and receiving? will be cron job? i mean like real dedicated server that hosting companies use! if it doesn’t look like real dedicated server with decent control panel and everything is available then it doesnt worth doing this at all

    • scott

      the reason he didnt cover that is this was to build a webserver. providing email accounts on ur website requires a total different software. yn a must have the software for building an email server. ipop or i map one is secure and the other is not. one allows for remote access and the other doesn’t. everything covered here was strictly to set up a webserver. not really install your website or doma:-) in. ya cant do that until you register your domain at ICanN and they approove your domain. usually cost 10-35$ a:-) year. email server i’s a whole different tutorial. as an email server must be configured with firewalls as well.. and different ports must be opened to handle emails. ya can change the ports to fight hackerrs but ya must configure it so it knows to use the different ports and to send the info out detailing what ports are being used. meaning say un r website uses port 80 to communicate through the hyper text transfer protocol qand ya want to change it to a different port ya must have ya website send this data out to the computers so they can communicate through that port instead.
      B.S. Computer forensics.

  • James

    Thank you very much for this awesome info.
    Just to help out a little bit.

    Follow Jacks advice
    “For editing the ServerTokens and ServerSignature lines you need to open up a different file than specified in the tutorial. It’s in
    /etc/apache2/conf.d/security

    And for the copying the shorewall example file for one-interface to the shorewall directory, use this command
    sudo cp /usr/share/doc/shorewall/examples/one-interface/* /etc/shorewall/”

    Other important tips

    For the Shorewall to start you need to edit /etc/shorewall/shorewall.conf and make the STARTUP-ENABLED=No to STARTUP-ENABLED=Yes

    Also, an awesome program for the ssh and sftp is Tunnelier. It allows for remote desktop, remote terminal, and sftp.I personally like it more than filezilla. It is for windows.

  • Vlad Pop

    Excellent post, I followed it step by step and got myself a nice running server to host my web page. Thank you very much!

  • jon

    i having trouble with ubuntu. this is what im geting when i boot the computer

    [ 854.250122] sd 6:0:0:0: [sdb] asking for cache data failed
    [ 906.474334] sd 6:0:0:0: [sdb] assumg drive cache write througt (etc)

    i need help

    • http://hmm tom

      try

      sudo rmmod ums_realtek

  • Edoardo

    I followed all your instructions and I can get to the server page, edit the index.html with FileZilla and everything, but when others try to get to the server typing the IP in the URL bar, or when I try to enter from another router, this is the result: “HTTP error 403: the service you requested is restricted [...] the restriction can be based on your Ip address, hostname, browser software, time-of-day or other variables. Most likely you requested a service that was made available to a restricted subnet.”
    What can I do?

  • David

    So I followed this, but how can I give the server a domain? aka so instead of putting in the ip to get to the server, something like a .com name? or one of those free domain stuff.

    • scott

      to get an actual .com domain name ya must register and pay for the domain. yaa must pay each year to use it. Cont act ICANN (internet corporation for assigned names and numbers) for the details. ya can’t host a domain without registering with the icann

  • Waqas

    Great Tutorial!! Thanks alot.

  • Reece

    i have gotten up to sudo usermod -g www-data [YOUR USERNAME] and when i put my username in it just says, user ‘[reece]‘ does not exist
    its working fine on filezilla i can see the directory i just dont have permission to write

    • Reece

      scratch that, I have ports forwarded and everything necessary but i can’t see my website when i type in the i.p address but it works fine when I use the local ip

      • Tyler

        If you are connecting from home, you must use your local ip, the domain name that you register is only for external users.I run two game servers on ubuntu and had a similar problem when i was first starting out.

  • Vladorz

    Nice tutorial but how do I link a domain name to my newly created web server? :D

    • Andy

      You add an A record on your domain that points to the server IP.

  • pramod

    thanks a lot . but will you please advice me what to do when my server memory gets full. should i implement some methods to increase the hard disk space.