Setting Up a Dedicated Web Server

How to Setup a Dedicated Web Server for Free

Dec 4th in PHP by Alex Villmann

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.

PG

Author: Alex Villmann

I'm Alex Villmann, a web developer/designer from Oregon. I mostly design websites, but I can sometimes be caught tinkering with web servers and optimizing MySQL databases. I'm always happy to provide help with PHP, MySQL, and other related web technologies.

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!

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

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.

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.

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.

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.

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.

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.

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.

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:


Related Posts

Check out some more great tutorials and articles that you might like

Enjoy this Post?

Your vote will help us grow this site and provide even more awesomeness

Plus Members

Source Files, Bonus Tutorials and
More for $9 a month for all TUTS+
sites in one subscription.

Join Now

User Comments

( ADD YOURS )
  1. PG

    nightS December 4th

    That’s interesting…thanks alot..

    ( Reply )
  2. PG

    Maor Hazan December 4th

    Thank you so much! :)

    ( Reply )
  3. PG

    Ben Griffiths December 4th

    This was great, personally I do this with CentOS, however that’s because I’m getting on in my years and stuck in my ways ;)

    Thanks, great write up :)

    ( Reply )
  4. PG

    Adam Hawkins December 4th

    Gentoo + lighttpd forever. FreeNAS users can also get this kinda stuff setup very easily as well.

    ( Reply )
  5. PG

    David Turner December 4th

    excellent article, i’m digging an old pc out as we speak :)

    ( Reply )
  6. PG

    Selvam December 4th

    Simply amazing..nettuts rocks !

    ( Reply )
  7. PG

    Foss December 4th

    Thanks, Alex. A great write up – very easy to follow!

    ( Reply )
  8. PG

    Shane December 4th

    Congratulations Alex – this is a fantastic article. Thanks very much!

    ( Reply )
  9. PG

    Morgan Daly December 4th

    Looking forward to working through this article. But seriously, how old are you Alex? How I wish I had started coding when I was younger. Thanks heaps for the tutorial.

    ( Reply )
  10. PG

    Andrea December 4th

    FANTASTIC!!

    ( Reply )
  11. PG

    Volkmar Kantor December 4th

    Thanks a lot!
    I have ordered a ubuntu vserver just one day before for test purpose. But haven’t slightly knowledge of configure or update an ubuntu server (as windows user i really need some graphical UI ;-) ).
    So this article are just in time.

    ( Reply )
  12. PG

    Roshan Bhattarai December 4th

    Thanks for posting this…..very useful………bookmarked……….

    ( Reply )
  13. PG

    Mnowluck December 4th

    I love ubuntu and I’m gonna wipe out all of my ubuntu desktop and try this.. thanks a lot for the tutorial

    ( Reply )
  14. PG

    BroOf December 4th

    Okay, Thats great!

    ( Reply )
  15. PG

    duellsy December 4th

    pretty well laid laid out, i think this will get a lot of hits in future…. pity i already set mine up with centos otherwise I mighta had a crack at Ubuntu.

    ( Reply )
  16. PG

    insic December 4th

    wow! new great stuff I found here. Great job.

    ( Reply )
  17. PG

    Mohsen December 4th

    Thanks Alex!
    Really greate article.
    bookmarked

    ( Reply )
  18. great article! thank you so much Alex!

    ( Reply )
  19. PG

    Alex December 4th

    Great job!

    If you are looking for any other kind of server-setup, I can recommand http://howtoforge.com/ :-)

    ( Reply )
  20. PG

    Neill Horsman December 4th

    Nice tut, now all i need is a static ip from my isp hahah
    Always wanted to know how to port foward my web server through my router but never really tried, Thanks

    ( Reply )
  21. PG

    Mojito December 4th

    Very useful tutorial !

    [quote]You can access your server from anywhere as long as your IP doesn’t change.[/quote]

    If you want to access to your server with a dynamic IP (a common situation) you can use a service like DynDNS http://www.dyndns.com/services/dns/dyndns/ that gives you a free domain name that is tied to your IP. You have to configure your router to ping the dyndns server so it updates the link between the domain name and your IP.

    ( Reply )
  22. PG

    Online Hry Zdarma December 4th

    Wow! Great! Thanks Alex, respect.

    ( Reply )
  23. PG

    VitaminCM December 4th

    This is a great tutorial. If you want to set up a similar server on a Windows machine, here’s a video tutorial on setting up a XAMPP server on a windows machine. There are printable step by step instructions.

    ( Reply )
  24. PG

    Jeffrey Way December 4th

    Yeah, Alex did a really good job on this. If you guys like the topic, I’ll have him write a follow-up.

    ( Reply )
  25. PG

    Dan Cole December 4th

    I’ve already done this at home, but with Fedora, it does have a lot of benefits. It would be cool if he could do a follow-up on the benefits of doing this and what not.

    Why be the passenger when you can drive?

    ( Reply )
  26. PG

    Phil Gill December 4th

    I’ve read a few tutorials on this subject and this is one of the better ones.

    ( Reply )
  27. PG

    matt December 4th

    Quick suggestion, something I only recently learned.

    Instead of “sudo shutdown -r now”, Ubuntu offers a “reboot” command.

    “sudo reboot” will perform the same task and is much easier to explain to beginners.

    ( Reply )
  28. PG

    Alex December 4th

    Good article Alex.

    Jeff, a decent follow-up could include setting up SVN on the server and deploying websites to your server with SVN (imo, much more simple than FTP)

    ( Reply )
  29. PG

    Jay B. December 4th

    This only works, however, if your IP lets you…most home broadband plans ban home-based web servers.

    ( Reply )
  30. PG

    OpenSourceHunter December 4th

    Thanks this was what i have been looking for !! :D

    greetz
    http://www.opensourcehunter.com

    ( Reply )
  31. PG

    Rijalul Fikri December 4th

    Wow, I like the tutorial. Btw, can anyone post similar topic but in different OS. I’m experimenting with Open Suse. I’m using XAMPP and it won’t works. I don’t know why.

    ( Reply )
  32. PG

    Simon Brix December 4th

    Very nice tutorial.
    I’ll definitely try it out !
    I only got one question: How do you make the “|” on an european QWERTY keyboard ?

    ( Reply )
    1. PG

      Kimme Utsi May 5th

      The “|” sign is on my Norwegian keyboard just under the escape key.

      ( Reply )
  33. PG

    Andrew December 4th

    The “LAMP Server” option works just fine for what you are doing. BTW, you can always choose to install the LAMP Server or any of those other options after the system install with `sudo tasksel`.

    ( Reply )
  34. PG

    Dan December 4th

    +1 for a follow up

    ( Reply )
  35. PG

    kepenk December 4th

    i’ve already bookmarked it.

    Thanks lot.

    ( Reply )
  36. PG

    Dan December 4th

    Bookmarked!
    I hope to pull this off soon.

    ( Reply )
  37. PG

    Jay December 4th

    Great Tutorial! I have been thinking about setting up my own web server and after reading this tutorial I’m gonna go for it.

    Thanks a lot!

    +Bump for a follow up

    ( Reply )
  38. PG

    moon December 4th

    Alex–great, awesome tut!

    Jeffrey–please have Alex continue on this article. Maybe some basic commands for ssh/ubuntu, SVN, and maybe expand on Alex’s statement of “There is obviously a lot left to be learned”. I want to learn a lot more and will go home and see if I have a spare ol’ pc sitting anywhere.

    How about a Windows server as well? That’d be awesome.

    Is this: “This only works, however, if your IP lets you…most home broadband plans ban home-based web servers.” really true? If so, then what’s the purpose of building one?! :( Does comcast ban you from this?

    ( Reply )
  39. PG

    Jade Robbins December 4th

    For the record the LAMP install of ubuntu server is identical to doing the apt-get command later to install them all.

    ( Reply )
  40. PG

    Manuel December 4th

    Nice written tutorial. I like it!

    ( Reply )
  41. PG

    demogar December 4th

    OMG- This is an awsome tutorial but WHY TODAY?!?!
    I did all of this by myself yesterday (incluiding a svn server!).

    ( Reply )
  42. PG

    Stephan Miller December 4th

    Great tutorial. I have an old box lying around that I have been meaning to do this with. Then I can create my own web services and stop depending so much on what’s freely available. Thanks. It might get me moving now.

    ( Reply )
  43. PG

    crysfel December 4th

    thanks for the tutorial!! it is very useful indeed!!

    ( Reply )
  44. PG

    Vince December 4th

    1. if your IP is dynamic you can use DynDNS.com or simliar services to map the ever changing ip to a domain

    2. Make sure you read up on linux security.

    This is good for “testing” or maybe mapping office.yourdomain.tld so you can run openvpn, but the upstream from your to your provider on dsl/cable is the bottleneck, so don’t expect good results.

    fun for tinkering though ;)

    ( Reply )
  45. PG

    redwall_hp December 4th

    Great tutorial, but it’s not exactly “free.” You still need hardware and a good connection. :)

    ( Reply )
  46. PG

    andre December 4th

    awesome article… I’ve wanted a simple how-to on ubuntu servers for a while… very tempting now to do this.

    ( Reply )
  47. PG

    wallpaper December 4th

    an afternoon! – took me days just to get linux up and running – but that was a couple of years ago though – maybe it’s time to have another crack!

    ( Reply )
  48. PG

    Frank December 4th

    If you read the Ubuntu Server guide you’ll see it’s just like this, but without the screenshots.

    Alex, you’re installing Apache, MySQL and PHP after you installed ubuntu. But you can select those when you’re installing Ubuntu. that saves a bit of work. (At screenshot 13).

    LAMP = Linux Apache MySQL and PHP.

    If you install Samba File server. with Samba you can share your folders and files with windows computers. It’ll be easier to manage.

    About not being able to write to the /var/www/ dir. You can do that with:

    sudo chgrp www-data /var/www/somefolder
    sudo chmod -R 0777 /var/www/somefolder

    Don’t make the whole www folder writable. You’ll make your server less secure with that. Only make the one writable that need to be.

    And if one of you guys put you’re server on internet then be sure to read this first: http://doc.ubuntu.com/ubuntu/serverguide/C/security.html

    ( Reply )
  49. PG

    Mr K December 4th

    Hmm, I’d have simply said download MAMP or XAMP or WAMP, run and badda bing you have a local server setup for local development – often so much faster & easier for (I’m going to guess) 80% of webdevelopers?

    ( Reply )
  50. PG

    Frank December 4th

    AN Ubuntu server is much easier to extent and manage then a WAMP install. And the Ubuntu server is also faster.

    ( Reply )
  51. PG

    Xof December 4th

    Very interesting!

    Now how to install Ubuntu on a remote dedicated server :)

    ( Reply )
  52. PG

    mmoore500 December 4th

    Unreal timing! Thanks for this Alex! I have a website that I paid waaaayyyy too much money to build in C# ASP.NET and am still paying tons to host it each month. I’m redoing the entire site in PHP and MySQL and this info is PRICELESS!

    ( Reply )
  53. PG

    tom December 4th

    i gave xampp a try… it was really simple

    ( Reply )
  54. PG

    Richard December 4th

    Freakin’ awesome

    ( Reply )
  55. PG

    Jim Cassidy December 4th

    Great contribution, Alex. Thanks for giving back to open source. You are a credit to the community. Well done.

    ( Reply )
  56. PG

    lem December 4th

    NOT FREE

    Software might be but a computer is still going to cost money!

    ( Reply )
    1. PG

      Amanda August 2nd

      don’t buy a new computer… go to goodwill or salvation army and pick up an OLD one for like $10-20…

      ( Reply )
  57. PG

    Sam December 4th

    Thanks for the tutorial. It’s a great article.

    ( Reply )
  58. PG

    James December 4th

    Great tutorial Alex!

    ( Reply )
  59. PG

    Mike rice December 4th

    Very awesome tutorial. I think a lot of people will benefit from this!

    ( Reply )
  60. PG

    Filip Růžička December 4th

    Thanks for this awesome post. I finally found some usage for that PC lying under the stairs =)

    ( Reply )
  61. PG

    Mark December 4th

    Best tut you’ve guys ever presented. Thanks

    ( Reply )
  62. PG

    Michael Espinosa December 4th

    Great article and would definitely look forward to a follow up.

    ( Reply )
  63. PG

    Chris December 4th

    Great Tutorial!

    So this won’t work on a cable broadband internet connection, but it isn’t a static IP? Not unless I use a service like http://www.dyndns.com/? Did I understand this correctly?

    ( Reply )
  64. PG

    Pierre Quillery December 4th

    Everything I need in one single post :)
    Thanks a lot !

    ( Reply )
  65. PG

    ronald December 4th

    Great tutorial, but what do I need to do when the procedure stalls in the step: scanning the mirror?

    (with an open and working internet connection?)

    “configuring apt”
    “42%”
    “scanning the mirror”

    image: http://www.box.net/shared/zeumrq6ylb

    thx

    ( Reply )
    1. PG

      eh3mp7o July 1st

      Had the same problem before. For a quick fix just unplug your internet connection, it will time-out for about 30 sec, then plug it back again. If this happens again later, just do the same trick. Hope it helps.

      ( Reply )
  66. PG

    Stefan December 4th

    Nice tutorial!

    I do get a problem though, I have come to the Install Apache, MySQL, and PHP step and typed in sudo aptitude install apache2 php5-mysql libapache2-mod-php5 mysql-server.

    Here it asks me if I want to continue after some building and I answer ‘y’ and hit enter and here’s where the problem is:

    It says it can’t connect to security.ubuntu.com so if I understand this correct it didn’t install these packages. It also says E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-dfsg-5.0/mysql-common_5.0.51a-3ubuntu5.4_all.deb

    Any ideas why I get these error messages?

    ( Reply )
  67. PG

    Alex Villmann December 4th

    @Andrew (and multiple others): Regarding the LAMP option, I figured as much, but, like I said in the article, I haven’t used that option. I wasn’t about to show you guys something I didn’t know myself :-)

    @matt: I wasn’t aware of the “reboot” command. I’ve always used “shutdown”, but it’s nice to learn something new.

    @Frank: That is the way I usually run my server, but for beginners, making the whole directory writable will save a few headaches later on.

    @ronald: I can only guess that maybe you have a faulty disk, or the main Ubuntu mirror is bogged down with a lot of people running updates. What I would do is try burning a new disk.

    I’m glad that you all have enjoyed the tutorial!

    ( Reply )
  68. PG

    M.A.Yoosuf December 4th

    thanks man, its a great job,

    keep it up, will be with open source!

    ( Reply )
  69. PG

    Taylor Satula December 4th

    Great tut,

    all the people that are saying WAMP/XAMPP/MAMP this is not so that you can have a dev inviroment. It is so that you can know how to set up a ubuntu server. Because most of the tuts on this on the internet are complicated and go in circles.

    Thanks.

    ( Reply )
  70. PG

    Lee December 4th

    No offense but I doubt this can fly in the majority of the cases.

    1. Most ISPs block port 80 on incoming so there’s no way for you to actually serve up the pages
    2. Not very many people could afford a dedicated line to their machine
    3. The whole purpose of a Dedicated Server is to be able to use a dedicated/shared line.

    So yes, in theory every computer is already a dedicated server, the problem is not many can actually serve.

    ( Reply )
  71. PG

    yusuf1 December 4th

    ive had vertrigo its also pretty neat, but this blowed me away!!!!!

    ( Reply )
  72. PG

    Alex Villmann December 4th

    @Lee: I haven’t encountered a single ISP that blocks port 80; I’ve used Qwest, Comcast, and Verizon.

    For everyone wondering, I’ve never had a problem using a consumer ISP (Comcast, Qwest, etc.) for this. Just don’t expect to host a site with a lot of traffic; your router will crash due to the traffic load.

    You don’t need a static IP; although, without one, you’ll need to make sure you always know your IP. In addition, you can always use one of many Dynamic DNS services if your ISP doesn’t provide static IPs.

    ( Reply )
  73. PG

    Adam Hawkins December 4th

    @Moon

    I’m working on SVN article as we speak.

    ( Reply )
  74. PG

    Adam Hawkins December 4th

    doh, for double post, but i find it easier to just dual NIC instead and connect via switch. Then there are no ip problems, but that’s for local access only.

    ( Reply )
  75. PG

    Roa December 4th

    mmmm one more tutorial about LAMP

    search in google and finding more tutorial about it.

    ( Reply )
  76. PG

    Ignas December 4th

    I know it is question which do not fits in the topic, but what about graphical interface which used here and the theme of it :)

    About the tutorial – nice for the beginers and notes to remember for all of us :) thanks :)

    ( Reply )
  77. PG

    SoftMind December 4th

    Hi,

    Excellent tutorial indeed. I would like to extend this to make it work with Ruby on Rails and Merb as well.

    If any one is sharing same thoughts like me than pl. follow me on twitter account ” SoftMind” and send a message as well.

    May be we can try this and achieve something more.

    Thanks for a great tutorial once again.

    Thanks

    ( Reply )
  78. PG

    Eric December 4th

    Great noob guide. Very comprehensive.

    ( Reply )
  79. PG

    Simon Brix December 4th

    I got a problem.
    I can’t start my firewall, and when I look in my .log file it says “ERROR: Invalid Action in rule “ACCEPT – - tcp 80 – - – -”

    What does that mean, and how do I fix it ?

    ( Reply )
  80. PG

    Sean Lum December 5th

    :D great tut, in depth and specific ^^

    You can do this with Ubuntu Server Edition, and also the Ubuntu Desktop Edition

    I got a little box with Ubuntu Desktop (8.4.01 i think) on it and it hosts just fine, I use the Desktop because of the GUI, but hey whatever works xD

    also if you’re running windows XP, I know you can also make a web-hosting server if you get tomcat (apache for windows, for those of you who don’t know, and it too is open source), or some other apache-like app.

    And from what I’ve seen, they all put out the same result ^^

    ISP stuffs.

    now I’ve only used Comcast so far as an ISP and they don’t auto-block port 80, though if they decided to check out “Mr.John Smiths” bandwidth usage, and saw that the outgoing bandwidth usage was substantially larger than incoming, they could very well remove your account, or fine you, or some other form of punishment, because it would be obvious that you are hosting.

    Other stuff.

    so I noticed that you had to enter the site IP address to access it, you could make it easier by getting a DynDNS.

    Also, don’t you have the option in the installation of Linux Ubuntu, to install MySQL, and PHP with the base instillation and not after the base installation has been made?

    also, it’s pretty close to free, I mean you could build a linux box that can run just fine with like… 250 dollars or so. Though if you wanted something nice, then it only goes uphill from there, basically with this tut the only thing that is free is the OS, and the server technologies.

    and if you are doing SFTP and you’re using windows, I recommend Filezilla, it’s open source, and it’s awesome (in my opinion, it rocks, I like it better than Adobe Dreamweaver’s built in SFTP).

    correct me if I’m wrong ^^ I’m just 16, but I’m pretty sure I got my facts straight.

    ( Reply )
  81. PG

    mmoore500 December 5th

    Everything seems to work so far. However, when I tried to add myself to the group using:

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

    I get an error that no user exists with my username. What is the problem?

    ( Reply )
  82. PG

    pixelsoul December 5th

    Nice tut!

    You know it is almost like nettuts puts up tutorials that we actually want to see, amazing!

    Ubuntu is great, did you know it is developed in Oregon? And you are from Oregon. I am also from Oregon. So that makes us extra cool ;)

    lol

    ( Reply )
  83. PG

    Simon Brix December 5th

    I really like your tutorial, but I think there might be something wrong with my computer.
    When I try to connect through SFTP it says: “Connection refused”
    Have I done anything wrong ?

    PS: I’m using Transmit

    ( Reply )
  84. PG

    Lee December 5th

    not at first obviously but if you’re aiming to make anything even relatively “high-trafficked” that not even a free or a shared host can take care of, I doubt that you’re ISP would allow it. And by todays standards, unless you can afford to lease a dedicated for over half a grand a month, your Upload speed will be horrible. In the end it defeats the whole purpose of having your own server unless you can also afford a T1 line (at least) which means you might as well could just lease the highest-end dedicated servers out there.

    Anyways, I’m just always a skeptic about everything so….

    ( Reply )
  85. PG

    Frank December 5th

    @mmoore500: Try this:

    sudo chgrp www-data /var/www
    sudo chmod -R 0777 /var/www

    ( Reply )
  86. PG

    ronald December 5th

    Regarding being stuck at 42%, I just did the whole thing again and it went well. So far for “it’s bits, only “1″ and “0″.

    And what I failed to mention is that I set this up on a virtual machine. And it works ;-)

    So there’s no need for an extra pc if you just want to try this yourself; just use a virtual machine (I prefer VirtualBox over VMware), and you have your Ubuntu webserver (and if you like an Ubuntu OS) running on your existing XP or Vista or whatever.

    Why? erm …

    “Why do dogs lick their genitals?”

    “Because they can.”

    ( Reply )
  87. PG

    Janckos December 5th

    great article!

    ( Reply )
  88. PG

    alifaan December 5th

    awesome tutorial, nice to see some other tuts here. keep it up guys.

    ( Reply )
  89. PG

    David December 5th

    This is going to be fun. And this is especially helpful because you went through all the steps with detail. I was about to install Ubuntu, and now that is higher on my list!

    ( Reply )
  90. PG

    Bryan P. December 5th

    I think its great Linux is slowly working it way into mainstream circles like this. When I first started tinkering with Linux a few years ago, you could get help on specialized forums.

    I worked with Red Hat 8.0 which at the time was the biggest and badest of all Distros. Now, there are so many different types who can keep up. I have found the Ubuntu family of products to be top of the line.

    I like Kubuntu and Ubuntu!

    ( Reply )
  91. PG

    Alex Villmann December 5th

    @Simon Brix: That error means that you set the firewall rule in incorrectly. Make sure that your firewall rules reflect mine. Since the firewall can’t start, this error is probably stopping you from logging in with Transmit as well.

    ( Reply )
  92. PG

    awake December 5th

    FANTASTIC guy…

    How does one install a GUI after doing this though? It’s the only reason why I use Ubuntu Desktop and install LAMP after doing so

    ( Reply )
  93. PG

    Cameron December 5th

    @Lee
    This really isn’t for hardcore hosting, but rather to set up a convenient dev environment. It is obviously good for web development but can be used for other things too, like hosting music or other files you might want to access from somewhere else (though admittedly I end up using a usb drive instead).

    ( Reply )
  94. PG

    Yizi December 5th

    Great tutorial, very useful!

    ( Reply )
  95. PG

    Alex Villmann December 5th

    @awake: You can run the command “sudo aptitude install ubuntu-desktop” and that will install the GUI.

    ( Reply )
  96. PG

    Kevin McKernan December 5th

    Surprised that noone has mentioned Webmin yet.
    http://www.webmin.com
    A web GUI for your Ubuntu server!

    ( Reply )
  97. PG

    amosquito December 5th

    While you’re in php.ini you should increase the memory limit to at least 32M

    ( Reply )
  98. PG

    kiran December 5th

    Wonderful tutorial.Great…

    ( Reply )
  99. PG

    degentd December 6th

    Thanx for this great tutorial. It is a very comprehensive and very useful article.

    ( Reply )
  100. PG

    Alex Tayra December 6th

    nice and very detailed tutorial. thanks, Alex

    ( Reply )
  101. PG

    Constantin Tovisi December 6th

    I really think that this is educational and good for web developers to get a feel of how is it to setup a Linux server for them to host their projects.

    However, I personally have a quite different choice of an Linux distribution for this purpose, and the simplest way to accomplish an LAMP installation in about an hour or less, with the minimum amount of Terminal commands possible is using ClarkConnect distribution.

    The advantages are also that this would also work on less powerful hardware and also provides both an proprietary and Webmin interfaces for server administration from within the browser, over the network.

    titel

    ( Reply )
  102. PG

    Simon Brix December 6th

    @Alex Villmann: If you run the command “sudo aptitude install ubuntu-desktop”. Can you then run a command to uninstall the ubuntu-desktop and go back to the original no GUI server ?

    ( Reply )
  103. PG

    Henrique December 6th

    Very GOOD

    ( Reply )
  104. PG

    Sajid December 6th

    This was the easies way I ever read. Mostly I get bore with long manuals.

    ( Reply )
  105. PG

    Frank December 6th

    @Simon Brix

    sudo apt-get remove ubuntu-desktop

    I think that should work.

    ( Reply )
  106. PG

    Chad December 6th

    Great tutorial. I would like to see a follow up on how to load a site onto this server…kinda want to have a testing site.

    ( Reply )
  107. PG

    Alex Villmann December 6th

    @Simon Brix: As far as I know, no. “ubuntu-desktop” is a meta-package, meaning it just stands for a bunch of other packages. Removing it would only remove the meta-package, not the other packages that were installed with it.

    ( Reply )
  108. PG

    trs21219 December 7th

    This tutorial is one of the best ones i have read for ubuntu. I just started tinkering with installing it the other day and found this when i started. This is so much better than all of the tutorials i have read on the ubuntu forums for this. I have been using SSH for my company’s webserver for a while now but i want to play around and learn how to fix things i break :) . I cant wait until you (or someone else) produces more of these awesome articles.

    ( Reply )
  109. PG

    Luis.tic616 December 7th

    Boy, this tutorial got me impressed. Thanks!

    ( Reply )
  110. PG

    simpyaw December 7th

    good thing I got here… This tutorial is very descriptive indeed. I need this to have my own server set-up. Manay thanks. simpyaw from Philippines

    ( Reply )
  111. PG

    Simon Brix December 7th

    @Alex Villmann: Okay, thanks alot ! Great tutorial. Now there is only a need for a tutorial explaining how to use the sql database, and maybe show how to make a little PHP based system ..

    Cheers !

    ( Reply )
  112. PG

    Takumi86 December 8th

    I have bad experience using ubuntu. The last time i tried to install it, it went crash when i set up my profile wrongly and to tell you the truth, the installation wasn’t dedicated for beginner, you need an advanced experience and widely knowledge on System administration skill

    ( Reply )
  113. PG

    got80s December 8th

    By the way, the line **Now, scroll down a little further and change “ServerSignature On” to “ServerSignature Off”**. When I try finding that line in that file I can not. What does that do anyways?

    I highly suggest installing the graphic interface for Ubuntu so that you can actually pull up a browser [to check your ip] and make it feel more friendly to those of us who are used to GUI’s rather than the command line.

    Also, perhaps there should be a follow-up tutorial on how to configure your router on various isp’s to allow serving up the website to the outside world. One in particular is Verizon Fios. While having a basic [non-business] account does not allow you to setup a server, you can still do it. It just takes some work. If you have a small website you aren’t going to catch their eye.

    ( Reply )
  114. PG

    Adrian December 9th

    Perfect timing. I was just about done setting up my own server using WAMP and XP Pro. I’ll make a partition and try Ubuntu. Thanks Alex;

    ( Reply )
  115. PG

    weblizzer December 9th

    such a great article, it’s very good to learn tricky things about web services, i hope you can do more

    ( Reply )
  116. PG

    Alex Villmann December 9th

    @got80s: It’s not a huge deal if you can’t find that line; all it does is tells your web server not to disclose information about itself.

    ( Reply )
  117. PG

    Vinay Vidyasagar December 9th

    +1 for a followup with media streaming with this server.

    Just a small note, most of the commands can be shortened.. like for eg.

    sudo aptitude install shore.. can be sudo apt-install shore.

    and you can do a search for available stuff on the net by just typing sudo apt-cache find (package name)

    ( Reply )
  118. PG

    karthik December 10th

    it is easily understandable to newbie’s….. great !!!!

    ( Reply )
  119. PG

    cornnery December 10th

    Thanks for the tutorial. It’s a great article,awesome . But when nettuts in french please !!!

    ( Reply )
  120. PG

    arshad December 10th

    wow .. that was really cool.thanks a lot pal :)

    ( Reply )
  121. PG

    Daniel December 10th

    Maybe mention that for it to be globally accessible you need a static ip address from your carrier. Most companies now renew ips based on time/connection activity…whatever. Or at least something that redirects it. And if you have a router, making sure to port that to the local computer. And why not use a gui based distro? Might make it easier?

    ( Reply )
  122. PG

    got80s December 10th

    @connery

    It’s fairly easy to translate to loose French. Just subscribe to Nettuts in google reader and follow this article.

    Il est assez facile de traduire pour desserrer des Français. Juste souscrivez à Nettuts dans le lecteur de Google et suivez cet article.

    http://googlereader.blogspot.com/2008/11/is-your-web-truly-world-wide.html

    ( Reply )
  123. PG

    Michael December 10th

    @Alex Villmann

    I have the same problem as Simon

    “I really like your tutorial, but I think there might be something wrong with my computer.
    When I try to connect through SFTP it says: “Connection refused”
    Have I done anything wrong ?

    PS: I’m using Transmit”

    I’m using FileZilla, and I’m getting:

    Command: open “michael@192.168.0.194″ 22
    Error: Network error: Connection refused
    Error: Could not connect to server

    and I’m sure I’ve set the firewall rules correctly, twice in fact.

    sudo usermod -g www-data michael
    sudo chown -R www-data:www-data /var/www
    sudo chmod -R 775 /var/www

    would that be correct? Please send an email as I’ll forget to check back here :P

    Thank you very much!!

    I can’t believe I got this far…

    ( Reply )
  124. PG

    Matt December 10th

    Really – if you just want a dev server and are a Windows user, I very much highly suggest checking out XAMPP prior to going through an entire new OS route. It installs simply and has most everything you need.

    ( Reply )
  125. PG

    Dean December 12th

    I personally use WAMPserver, it is very easy to set up. My ISP (AOL) won’t allow its customers to run web servers, but it’s a good way to test your site before uploading to a free host.

    ( Reply )
  126. PG

    Emil Nordh December 12th

    I have a problem installing! I do get an error message that says MP-BIOS bug: 8254 timer not connected to IO-APIC do anyone know why?:O

    ( Reply )
  127. PG

    Stan December 12th

    Several things. First, do NOT do this unless you have a real need. When you do this, then your IP address will respond to pings on http and ssh ports. This means you WILL be attacked, and unless you know what you are doing, and have set things up securely, you invite a host of problems from botnets to becoming an illegal file repository. Bots will be banging against your SSH (port 22) all day long, and other bots will be looking for web vulnerabilities, such as buffer overruns. So unless you have a real need to run your own web or ssh server, do not do this. I also highly recommend running ssh on a different port, for security, and/or using Denyhosts to help defend your ssh server.

    Also, it is a pain to have to remember your IP, and it will likely change anyways. To combat this, use a dynamic DNS service like dyndns.com. It is free, and will allow you to use a url tied to your IP. Then install a simple program that will keep the dynamic host updated to your current IP. That way, all you have to remember is your url, just like any other site.

    ( Reply )
  128. PG

    Jeff December 13th

    I used XAMP just to test MediaWiki installation.
    This tutorial is really amazing, step by step and error free.
    Great job!

    ( Reply )
  129. PG

    Buddy_ca111 December 13th

    This is great! My friend who is a bigger computer nerd then me is bugging me to get a server(he has one too) and now I can! Thank you alex for the wonderful tutorial!

    ( Reply )
  130. PG

    Joe December 15th

    Could you put an ASP server on your router as well as the PHP server? and then setup another instance of port forwarding?

    ( Reply )
  131. PG

    PhillyBones December 15th

    Fantastic! Thanks so much for such a thorough and polished guide. I had a PC sitting around unused, and this weekend I threw a little over three hours at it using your guide, and now I have my “anywhere” LAMP sandbox. Excellent work!

    ( Reply )
  132. Wicked tutorial, extremely helpful! I love it!

    ( Reply )
  133. PG

    Pink_Alert December 16th

    If you want to test a website with server side code without a server (for ex. php)… you CAN use your desktop pc or even a mac. WAMP and MAMP are beautiful for that!

    ( Reply )
  134. PG

    Ivo December 16th

    Hell yeah, a great tut, thanks for the info and the pics too :) ))

    ( Reply )
  135. PG

    abdel December 17th

    I was looking for such article a while ago… massive thanks for your work alex ^^

    ( Reply )
  136. PG

    Alonso December 17th

    Excellent post, thanks

    ( Reply )
  137. PG

    Xtraord December 18th

    How to Get Dedicated IP Address ?

    ( Reply )
  138. PG

    Codrin H December 22nd

    the tut is nice, but u should cover just a part, like.. configuring apache+php+mysql manually on a ubuntu server.

    security tips, ftp apps and other stuff should not be here.
    focus more on a subject
    “apt-get install” is fkin easy
    tell us how make our php/apache/mysql faster, better, more secure.
    and this should be net-tuts, about coding and not installing apps ;)

    how many of the coders got their own dedicated server that run lamp just for developing ?

    usually they got shared hosting or run script from own pc, like xampp or if is ubuntu, lamp on desktop.

    sry for my -_-’ed up english. hope u get it, stay focused !

    ( Reply )
  139. PG

    Muhammad Raheel December 24th

    HI alex, Perfect and useful article. Keep up posting such articles.

    Good Job!!!

    ( Reply )
  140. PG

    laiha boduh December 24th

    Is that mean if I registered a domain xyz.com and I could direct my domain name to my IP address from the company IP forward? Even if I’ve no static IP address? Is that mean my xyz.com follows me wherever I moved? NO hosting fee and no bandwidth cap limit?

    Thanks.

    ( Reply )
  141. PG

    Mohamed Aslam December 27th

    Awesome tutorial..!
    Thank you very much.

    Keep it up.

    ( Reply )
  142. PG

    A youngman from Belgium January 4th

    What a wondefull tutorial! I thought I would be in trouble as soon you started with the command-shizzle, but it did go very well.

    Thank you.

    ( Reply )
  143. PG

    A youngman from Belgium January 4th

    Hi Alex. How can I set up a sql-database to run with my site? I’m new to linux, I tried webmin but my browser doesn’t show anything when I try to get it working.

    I hope you can help me. Thanks a lot.

    ( Reply )
  144. PG

    mo January 4th

    I wonder if you need a dedicated static IP address for the project?
    I’ve something in mind intend for not-for-profit purpose for few years now. Only thing stop me from starting that is the cost on bandwidth and the hosting fees. From what Alex taught us to my understanding is, we cold set up hosting service from our own basement with an old PC, correct?
    If presume is correct, another question, how do I direct the url traffic to my server without static IP? Many thans in advance.
    Add a ‘m’ in front of my e-mail to contact me.

    ( Reply )
  145. PG

    A youngman from Belgium January 5th

    In the meanwhile, I managed to get phpmyadmin working on my server, so I can manage the sql-databases.

    Thank you very much for this tutorial.

    ( Reply )
  146. PG

    Louis Tim Larsen January 5th

    Good guide, but why don’t use Debian for servers instead?

    ( Reply )
  147. Or buy Clark Connect and it’s all that an a whole lot more, toughened, etc…

    I’m lazy.

    ( Reply )
  148. PG

    Latvian January 7th

    A good guide. Better recommend ubuntu to use Debian consumes less computer resources and more stable. There will be tested :D pity that I have ADSL upload: 800kbit / s :(

    ( Reply )
  149. PG

    Derek January 8th

    I had a similar problem to Michael and Simon. I had repeatedly checked my settings for shorewall to make sure they matched the tutorial, but whenever the firewall was running all traffic was blocked.

    After checking /var/log/messages, I noticed the following line constantly showing up:

    Shorewall:INPUT:REJECT:IN=eth1 OUT= MAC=XXX SRC=192.168.0.$

    I went to the Shorewall FAQ website at http://www.shorewall.net/FAQ.htm and clicked on the “How do I decode Shorewall log messages?” section. The FAQ said that since it was an INPUT error, it meant that it was triggered due to the fact that the source IP wasn’t in any of the firewall zones.

    My motherboard has two ethernet jacks and I use the one named eth1. However, shorewall’s default setting uses eth0. After changing /etc/shorewall/interfaces to use eth1 instead of eth0, everything seems to work great.

    ( Reply )
  150. PG

    Daniel Poveda-Sharman January 8th

    Can this be installed alongside windows and if so how is it accessed?

    Great tutorial by the way! :D

    ( Reply )
  151. PG

    Neill Horsman January 11th

    So today I finally pulled out the old PC and installed Linux on it, setup my webserver.

    Went to port forward it and didnt have much luck as my web server is plugged into a router which is plugged into my modem. so no luck.

    any solutions for this?

    ( Reply )
  152. PG

    Siva January 16th

    Really Help full Thanks !!!

    ( Reply )
  153. PG

    DemonicViller January 16th

    hello there, excellent tutorial .. but i want to know how to chang the HTTP port from 80 to 8000?

    i typed

    sudo nano /etc/apahce2/ports.conf

    but still can’t connect to the server using port 8000 instead of 80 ..

    any ideas?

    ( Reply )
    1. PG

      Adam Balliet May 8th

      You can’t use 8000. You have to use 80.

      ( Reply )
      1. PG

        sravan July 3rd

        Hi,

        I am doing academic project, i the part of that…i need to host my own webserver. So, i requested my sysadmin to provide port for me to host webserver. Then he open the port 7574 for my webserver. This tutorial is very helpful to me. But here the webserver is running under port 80…i cant run my webserver in this port…because already institute webserver running on this port. So, please help me how to change this port. I followed this tutorial up to installing then after that…i understood..i have to change port number. So, i didnt configure “rule” . Can you please help me how to change my port successfully to 7574.
        Thanks,

  154. PG

    mh ansari January 17th

    wow thats wonderful alex keep going on .great great great instructions thanks.

    ( Reply )
  155. PG

    Jim Turner January 19th

    Well done Alex – this is a really useful article, especially for beginners. I installed Ubuntu Server 8.10 and there were a couple of discrepancies. The section on changing ServerTokens & ServerSignature are in /etc/apache2/conf.d/security (not apache2.conf). The other was that in shorewall.conf, startup is already enabled (Yes) by default. Thanks very much!

    ( Reply )
  156. PG

    Araba Oyunları January 19th

    Thanks Nettuts. Very nice information.

    ( Reply )
  157. PG

    Jé Maverick January 21st

    Awesome!

    ( Reply )
  158. PG

    jonny rocket January 23rd

    great job. very cool. i have always wondered how to do this with
    out a GUI. thanks.

    ( Reply )
  159. PG

    timo January 24th

    This is the first time I setted up a server, especially a linux server.
    This tutorial is so easy to understand!!!!

    thanks

    ( Reply )
  160. PG

    Scott January 26th

    @ mmoore500

    I had the same trouble with my setup until I figured out that when Alex uses brackets it means put what is inside the brackets with out the brackets. So for example if your name is mike [USERNAME] means enter the command line as follows:

    sudo usermod -g www-data mike

    not

    sudo usermod -g www-data [mike]

    I am sure this method is common knowledge for programers, but for us rookies it is not so evident.

    ( Reply )
  161. PG

    Mathew Edison January 28th

    The only thing I gotta worry about now would be my electricity bill if I keep this thing running xD. Thx for the great post! :D

    ( Reply )
  162. PG

    :P January 30th

    wow alex looking fat in that picture…. jk hows jon + everyone else
    Get off your computer fatty!

    ( Reply )
  163. PG

    Jarad January 31st

    Very Well Written but it is incomplete.
    Needs – Create SQL Database and Such Items

    ( Reply )
  164. PG

    Laith January 31st

    Many thanks Alex,
    I have this note
    This kernel requires an x86.64 CPU, but only detected an i1586 CPU.
    Unabale to boot – please use a kernel appropriate for your CPU.

    May you help me step by step with many thanks

    ( Reply )
    1. PG

      Artur June 2nd

      You must download another one file – for 32 bit. Your downloaded file was for CPU with 64 bit.

      PS you made one mistake else —but only detected an i1586 CPU.
      correct info is — i386CPU

      If I am wrong, I do not know, who can help you!

      ( Reply )
  165. PG

    Noor Khan February 2nd

    wow nice article dear

    n many many thanks for you

    ( Reply )
  166. PG

    Rob February 6th

    Hello fellow Oregonian. Great tutorial.

    ( Reply )
  167. PG

    mike February 9th

    doestn’t connect to the internet! :s :(

    ( Reply )
  168. PG

    Jumanji February 13th

    THis is cool! cheers!

    ( Reply )
  169. PG

    Bob Jansen February 20th

    Thanks, this helps me out a lot! Great!

    ( Reply )
  170. PG

    Andrew February 24th

    That’s great that the Ubuntu Server has appeared :)
    I started using FreeBSD on a stand-alone old Pentium II several years ago as a home dedicated server” for testing/debugging/developing purposes. That was a much more tough way than using Ubuntu as described above. But, thanks to my efforts, now I’ve become almost an expert :)
    I host some of my projects using another, much more upgraded server still powered by FreeBSD.
    It’s great! It’s terrific!!!
    Good luck to everyone – it’s WORTH trying!

    ( Reply )
  171. PG

    Calvyn February 28th

    your tutorial is very nice, digg your story already at

    http://digg.com/linux_unix/How_to_Setup_a_Dedicated_Web_Server_for_Free_NETTUTS

    ( Reply )
  172. PG

    Mike February 28th

    Hey, how about a note about setting the nameservers and setting the domain to point to your dedicated server. I feel like you took this article to the 95 yard line, then walked off the field.

    ( Reply )
  173. PG

    TyBEAST2000 February 28th

    very poorly written, i barfed all over my keyboard. you give me headaches. lol just kidding, your awesome. ubuntu. thats a funny word. -p.s. lets play some XBL

    ( Reply )
  174. PG

    Nic March 1st

    It seems to work well, but when i test the php, it simply outputs the php code.. not sure what is going on.

    ( Reply )
  175. PG

    Paul Morales March 2nd

    Amazing Tutorial! I stumbled this post. I learned a ton. I am probably going to setup a Ubuntu server myself on a spare PC I have.

    Thanks for the informative post! Will help me a lot.

    ( Reply )
  176. PG

    Dramoth March 3rd

    Excellent tute, but I did notice one thing that you missed.

    Setting up a firewall, awesome and well thought out, but what about those guys who like knocking on doors to see if there is a hidden catch anywhere so that they can get in.

    For this, I would heartily recommend using something like portsentry or snort to monitor for someone scanning your network.

    ( Reply )
  177. PG

    La Ode Adam March 3rd

    now i’m using ubuntu desktop.

    to add ubuntu server just click

    SYSTEM >> PREFERENCE >> SYNAPTIC PACKAGE MANAGER >> EDIT >> MARK PACKAGES BY TASK >>

    choose BASIC UBUNTU SERVER + LAMP

    ( Reply )
    1. PG

      gops March 24th

      will this work

      ( Reply )
  178. PG

    Vinny March 5th

    About not being able to write to the /var/www/ dir. You can do that with:

    sudo chgrp www-data /var/www/somefolder
    sudo chmod -R 0777 /var/www/somefolder

    Don’t make the whole www folder writable. You’ll make your server less secure with that. Only make the one writable that need to be.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Ok. I want my server to be more secure. How do I undo the “write command” to that folder in tut. Thank you

    GREAT F’N Tutorial man…. Keep’m comin’

    ( Reply )
  179. PG

    host March 13th

    It

    ( Reply )
  180. PG

    Matt Tolman March 14th

    I’m new to this I’ve been using windows in the past and I am just beginning to play with linux.

    In the tutorial when I went in to change the “sever token” I couldn’t find it so I didn’t go any further.

    Also when I exited out of the apache2.conf I didn’t save it. When I retyped it to edit again it was blank.

    I think I may have messed something up?

    How do I get the apache2.conf back I did back it up first.

    ( Reply )
  181. PG

    Mark I March 21st

    The port forwarding info got me going. Thanks

    ( Reply )
  182. PG

    Migel David (Spain) April 7th

    Thank you very much.
    Where can I get names and dns ip of my server to run my Com.ar domain?
    Thank you very much.

    ( Reply )
  183. PG

    Bicky April 8th

    install PHPMYADMIN for browser based mysql administration.

    sudo aptitude update
    sudo aptitude install phpmyadmin

    - when asked select APACHE2 from the list.

    once installed open web browser and type http://YOURIPADDRESS/phpmyadmin
    then login with “root” as username and its password which you have assigned when mysql was installed

    Has anybody installed web server control panel?? like webmin , ispconfig

    ( Reply )
    1. PG

      anmp3r April 16th

      hey hey :P

      i have run into problems when i get to sql management using phpmyadmin,

      i can login using root and my pw fine, however when i make a new user in phpmyadmin i am unable t use this user to login… (so basically i can only use my root login to login… )

      do i need to change something in mysql config or something to allow another user???

      cheers!

      ( Reply )
  184. PG

    Bicky April 9th

    install WEBMIN for browser based server administration.

    -First intall PERL (if u havent)
    sudo aptitude install perl5 libnet-ssleay-perl

    -Restart Apache
    sudo /etc/init.d/apache2 restart

    -Now download WEBMIN
    sudo wget http://prdownloads.sourceforge.net/webadmin/webmin-1.470.tar.gz

    -Extract webmin-1.470.tar.gz
    sudo tar xzvf webmin-1.470.tar.gz

    -go to inside the webmin folder and run setup
    cd webmin-1.470
    sudo sh setup.sh

    now the WEBMIN installation starts, it will ask u several questions, just leave the default options. It will ask you to assign username and password for WEBMIN. Once finished restart apache. Then from your web browser use https://YOURIPADDRESS:10000 then enter the username and password to login.

    Now u can manage your server.

    ( Reply )
    1. PG

      Simon! April 10th

      if you do this would you need to add a rule in your apache settings or anything else to allow it?

      ( Reply )
      1. PG

        Bicky April 11th

        nope u dont need to add anything in apache settings.

  185. PG

    Simon! April 9th

    i couldn’t find “ServerTokens Full” and “ServerSignature On” in the apache.config file…..

    maybe its cos i used ubuntu 8.10 server instead of 7.04 LTS ??

    anyone know what i should do?? can it be found somewhere else or should i put it in manually into the config file???

    cheers!
    ps love the how too..

    ( Reply )
  186. PG

    Simon! April 9th

    woops i meant 8.04 not 7.04… ;)

    ( Reply )
    1. PG

      Bicky April 11th

      “ServerTokens Full” and “ServerSignature On” are in
      /etc/apache2/conf.d/security
      not in apache2.conf

      ( Reply )
      1. PG

        simon! April 15th

        so /etc/apache2/conf.d/security/ what???

        whats the file name that i need to edit?? is it just apache2.conf in that folder?

        or was that /etc/apache2/conf.d/security.conf ??

        cheers!

      2. PG

        simon! April 15th

        ok so i worked it out… sorry for being so dense.. :P

        it is just /etc/apache2/conf.d/security

        so use:
        sudo cp /etc/apache2/conf.d/security /etc/apache2/conf.d/security.bak

        then:
        sudo nano /etc/apache2/conf.d/security

        and edit the file… :)

  187. PG

    Simon! April 10th

    another thing… i was trying to use winscp and i got into my web server ok, but then for some reason i couldnt change any permissions on my files… (but i could still upload and delete them… anyone have any ideas?

    ( Reply )
  188. PG

    anmp3r April 15th

    hey hey :P

    i have run into problems when i get to sql management using phpmyadmin,

    i can login using root and my pw fine, however when i make a new user in phpmyadmin i am unable t use this user to login… (so basically i can only use my root login to login… )

    do i need to change something in mysql config or something to allow another user???

    cheers!

    ( Reply )
  189. PG

    George April 20th

    Thanks for the tut, Alex. Everything went fine with the installation, but I find I can’t log onto my server from my local LAN, 192.168.1.X. I did some research and thought I could fix it by modifying the rfc1918 file: I changed the line for 192.168.0.0 to RETURN from droplog (if I remember the original action). But it still didn’t work. I’ve used WinSCP, putty, end FileZilla and they all say something like “connection refused”. I’ve looked at the rejection messages in the log file, but nothing jumps out at me. I followed your directions exactly; I can log in through the console just fine, but not from another computer on my LAN. Any suggestions?

    ( Reply )
  190. PG

    George April 21st

    I’ve found the problem: Shorewall defaults to eth0, and my active network card was on eth1. After I made the changes in the interfaces file to point to eth1 everything worked!

    ( Reply )
  191. PG

    Gary Callaghan April 27th

    Very detailed article, I might look into this. Thanks

    ( Reply )
  192. PG

    Mark April 30th

    I might setup one after reading this article. Thanks for the tutorial!

    ( Reply )
  193. PG

    Adrian May 2nd

    Reading this a few months later, I realized how much I messed up before. Maybe I will try this once I am not so worried I will break something. :)

    ( Reply )
  194. PG

    Ellis Benus May 4th

    I love NetTuts.

    ( Reply )
  195. PG

    thepinnacle1 May 5th

    Fantastic article. I was blown away by the clarity of the directions provided. I have paid hundreds of dollars for programs from so called Garus that frankly couldn’t hold a candle to what I have just read for zip, nada. Thank you

    ( Reply )
  196. PG

    blAh May 5th

    Free? Do you know how much it costs to run an old clunker 24/7?

    ( Reply )
  197. PG

    Harsh Agrawal May 5th

    Very useful post.. Stumbled!!

    ( Reply )
  198. PG

    Adam Balliet May 7th

    I love you.

    ( Reply )
  199. PG

    Richard May 11th

    That

    ( Reply )
  200. PG

    Albert Pak May 12th

    Sweet tutorial! I’ve been meaning to use a box that I’ve put together out of my old PC parts for something, so I guess web dev. server it is :D

    ( Reply )
  201. PG

    Josh May 16th

    WOW I LOVE THIS….I AM DEFINITLY USING THIS AGAIN!

    ( Reply )
  202. PG

    gito May 20th

    che coo entro al servidor desps de que lo instale ¿

    ( Reply )
  203. PG

    Rajesh May 20th

    While installation my DHCP server is not getting configured automatically, I tried configuring manully but its not working..

    wht should i do now.. pls help me…

    ( Reply )
    1. PG

      bicky June 12th

      for manual assign of ip

      nano /etc/network/interfaces
      use the following reference:

      # This file describes the network interfaces available on your system
      # and how to activate them. For more information, see interfaces(5).

      # The loopback network interface
      auto lo
      iface lo inet loopback
      auto eth0
      iface eth0 inet static
      address 192.168.0.1
      netmask 255.255.255.0
      network 192.168.0.0
      broadcast 192.168.0.255
      gateway 192.168.0.254

      configure dns address

      /etc/resolv.conf & type followings (use ur dns address)

      nameserver 194.72.0.98
      nameserver 194.72.0.114

      now restart networking
      /etc/init.d/networking restart

      ( Reply )
  204. PG

    Mohamad May 24th

    thanks Alex, this is a great step by step course.

    ( Reply )
  205. PG

    Denis Alvinlove June 1st

    Hey Man, Thats Great. I’ve just switched to linux of recent and of course am using ubuntu

    ( Reply )
  206. PG

    StReO June 4th

    Great job ;)

    ( Reply )
  207. PG

    copperb June 5th

    thanks, alex.
    straight forward and easy enough.

    ( Reply )
  208. PG

    Ram Sainath June 6th

    Great tutorial. I’m almost there down to the last two pages. I’ve got to the point “Add your website to your webserver” and got stuck there. Tried logging in to my server from another desktop using WinSCP, with both machines connected to each other via an Airlink router. Getting message “Network error, connection timed out”. I’m sure there’s a simple answer, and someone’s already solved this, but to a rookie like me, I need your help. Could you please ? Thanks People and THANKS ALEX !!!!!!!

    ( Reply )
  209. PG

    liv3dn8as June 7th

    Awesome! Going to try it has soon as my d/l finishes.

    ( Reply )
  210. PG

    Steve June 15th

    Great tutorial – really clear, covering just the stuff I need to set up a home dev environment.

    ( Reply )
  211. PG

    H@Ri June 17th

    i want to run :’http://localhost/pma”
    what can i do for this reply

    ( Reply )
  212. PG

    Rukshan Chathura June 21st

    Thanks, Alex. Really helpful.

    ( Reply )
  213. PG

    Mike Burrell, Jr. June 21st

    Up and running … You are the man!

    ( Reply )
  214. PG

    Darwin June 23rd

    This was the easyest step by step I have ever used for a linux. You not only use the correct jargon, you explained what it ment and why you were doing it. Thanks, you have made my Ubuntu Server experience a good one.

    ( Reply )
  215. PG

    sunil June 26th

    Sir

    i installed ubuntu 8.4 after installation i got message

    “starting up

    this kernel requires the following features not present on the cpu:0:6

    unable to boot – please use a kernel appropriate for your CPU.”

    now what should i do?

    i installed ubuntu on my laptop

    sunil

    ( Reply )
  216. PG

    sunil June 26th

    alex

    can you show some way to boot my laptop ?

    now i confused much

    i deleted all my data and xp os

    sunil

    ( Reply )
  217. PG

    Tyler June 27th

    I’ve seen a lot of tuts on this and this is the easy than all the others!

    ( Reply )
  218. PG

    khalil July 1st

    thanks a lot
    that ’s the community open source

    ( Reply )
  219. PG

    Gale July 6th

    how do I install openSSH after main install? I missed it in the inital install by using the LAMP instead?

    ( Reply )
  220. PG

    Jonathan W July 15th

    How would I go through this process if I want to run the server via virtualbox? I got to the point where everything is installed, but could never get the connection to the Internet, accessable by others. I’m assuming its an IP Configuration issue. A little help regarding running Ubuntu Server from Virtualbox? Thanks!

    ( Reply )
  221. PG

    Na-zure July 15th

    i appreciate and i love Linux is easy.

    ( Reply )
  222. PG

    peter p July 18th

    As this is the first time I have setup a linux server that was a great help! you have done a good job of explaining the process and showing how to protect the server.
    I wiil use your suggestions.

    ( Reply )
  223. PG

    Dalius July 19th

    Thanks, it was helpful.

    ( Reply )
  224. PG

    David Maskell July 30th

    hi, alex, thanks for this, but how do you change the web address?
    Also can you give people user names and passwords if they want to access your Site?

    ( Reply )
  225. PG

    Juniper August 8th

    Maybe, if it’s not too complex, you could write a tutorial on how to host people on the server? That’s what I am trying to do with mine. Thanks, the tutorial is great.

    ( Reply )
  226. PG

    Pete August 9th

    Amazing tutorial! THANK YOU SO MUCH

    ( Reply )
  227. PG

    rat32 August 14th

    wonderful thanks you

    ( Reply )
  228. PG

    Sebastian August 16th

    hello, nice article…
    But I advance you install with php librares: php-gd, php-pear and php5-dev.

    “sudo aptitude install apache2 php5-mysql libapache2-mod-php5 mysql-server php5-gd php-pear php5-dev”

    and then install “make”

    “sudo apt-get install make”

    So, now you can install php extensions like bbcode, fileinfo and etc… :)
    This make server moke usefull :)

    (!) Don’t forget add extension to php.ini !

    ( Reply )
  229. PG

    Geoffrey Krachum August 19th

    This tut helped me a lot, since I’ve just installed a new webserver at home. Cheers

    ( Reply )
  230. PG

    Trevor August 29th

    Thank you for interesting and informative reading, I have installed Apache web server 2.2.9 at home on Ubuntu 9.04, running on an Intel Pentium 3 @ 800 mhz with 512 memory.

    It took me a couple of days to build the computer and configure the Apache Server. This has been an interesting learning curve, great stuff

    It Works!

    ( Reply )
  231. PG

    Joshua August 31st

    Can anyone help me on this, i did everything smoothly as the tut says but when i try to access it using my ip it won’t access i get a connection time out. is there something i missed? i did the portforwarding, the static ip, the DMZ. but nothing. help me pls,, :(

    ( Reply )
  232. PG

    rock on September 14th

    Thanks for the knowledge you are sharing!. Youre Definitely fantastic
    good job.

    ( Reply )
  233. PG

    headblade September 15th

    Fantastic, you know, i might have to find an old computer and charge my school to host there new website

    ( Reply )
  234. PG

    Tobi September 28th

    Great Tutorial, I think i prefer using CentOS Or Redhat Linux Over Ubuntu, But Great Tutorial, I wouldnt mind installing a CGI-Bin On It..
    Im not fussed on ubuntu Linux Personally, i prefer older distributions like Redhat, Slackware, And CentOS Because Its Like Redhat, thats just personally, other then that great tutorial, i can set up servers and all that, but i cant explain how to LOL

    ( Reply )
  235. PG

    Brian September 29th

    Hey, i’ve installed on virtual box, the problem is like some other people here is that view anything. I get to the part where you say to type in the ip address and it should display a page saying “It works!” But i get a error page.

    Im wondering if this could be because the network im connected to is not a personal one, its from my uni. the IP address i get from the virtual machine looks kindda odd as well its like 127.0.0.1. Any suggestions?

    Thanks a lot for the tutorial it was good.

    ( Reply )
  236. PG

    Aaron October 7th

    I must admit, pretty sweet. Thankfully, all I had to do was install the firewall and forward my ports and I was good to go.

    ( Reply )
  237. PG

    ReignMan October 7th

    Excellent… 90 minutes from scratch and I’m up and running with a home hosted web site through my TZO account.

    Ubuntu 9.04 has a few more options too (virtual server etc).

    ( Reply )
  238. PG

    Dan October 9th

    Excellent article, Alex! Thanks!

    One question – I switched from Windows 2003 Server with IIS6.0 to Ubuntu server with Apache but before I did that, i backed up all of my MySQL databases onto my Windows workstation. Once I have completed the install of Ubuntu server, how do I get my databases back into MySQL? And, I want to use phpmyadmin with my server so I guess I could import them back to MySQL with that… I think I answered my own question, LOL!

    Also, I have 3 domains that I want to host off my server… where is the config file where I can specify those domain names? Each one goes to the same IP address, but are in different folders.

    Thanks for any help… I guess you can tell, I’m a newbie… haha!

    ( Reply )
  239. PG

    mon villarin October 21st

    Well, this is great the only thing i dont understand is: how can i access my site from my webserver using my website name? am sure people dont like visiting site with using your webserver’s ip address how can i get the nameservers of my server so that i can update my domains in godaddy.com.

    -I hope i can get some solutions here. tnx!

    ( Reply )
  240. PG

    christer November 1st

    Excellent article i have never used anyting exsept windows an after 3 ouers i have my joomla page up and running on my new server :)

    ( Reply )
  241. PG

    johnfamaouz November 12th

    @alex villaman

    i thinks its a awesome tutorial even if i did not yet tried and do you have a tutorials for php

    ( Reply )
  242. PG

    harry November 16th

    gud.. but!

    improvements:

    1) how did you get from ifconfig command to a graphical screen showing apache ‘it works’? are these same machine or different?

    2) why not turn this article into ‘THE’ ultimate 1-stop guide to setting up a linux web server – because really that’s what every body wants to do by:

    a) using diagramms

    b) showing how to port/copy – wamp/xamp development accross into linux.

    c) showing proper configuration of a/the best modem/router for the setup.
    ( people will buy that router – just to get things done!)

    d) showing how to deal with more than 1 statc ip. ie. 1 static ip for the server, and one static ip that can be shared by the router for normal internet access.

    e) a little more on security

    f) backip & RECOVERY – it’s important!!

    g) list of references & regular updates so that any unmentioned/proplematic areas are rectified.

    FINALLY, if you done the above, stick a ! DONATE ! link, and i am sure people will donate generously.

    i am sitting on a pretty good idea, i have done a great website from having no development knowledge – 50k php lines! but i cant implent it securely because of complexity of linux.

    if i and others like me can get our job done – we will donate $$$$ !!
    try it!

    thanks

    ( Reply )
  1. Arrow
    Gravatar

    Your Name
    November 16th