How to Install Apache on Your Dedicated Server

In this lesson you will learn how to install Apache on your Dedicated Server.  If you don't yet have a Dedicated Server on site at your home office or facility, the best thing to do is to open an account at the Rackspace Cloud.  Provision a 256 MB Ubuntu cloud server.  This will run you about $10/month or a few cents per hour if you decide to unprovision the server after completing this lesson.

Apache Web server Installation in Ubuntu
Ubuntu Linux is a great platform to use for an Apache Web server Installation. From a simple machine you can serve web pages to an Intranet or the Internet using one of the most popular Web server configurations.

LAMP Server

For new installations of Ubuntu, the easiest method to get the Apache Web server is by selecting the “LAMP” option on Ubuntu’s software selection screen during installation. This process will get the standard Linux, Apache, MySQL, PHP configuration setup on your server in one automated process.

If you don’t want to configure the server as a LAMP, or if you have other requirements, you can install Apache as a separate application once Ubuntu is installed.

If you went the Rackspace Cloud route, Rackspace has images of Ubuntu already provisioned so you get to skip the installation process and just jump to the Apache installation step.

Download and install Apache Web server

Open a putty session to your server and type “sudo apt-get install apache2” and then press return.

Ubuntu will download and install the Apache Web server software. When the process is complete, you can test your Web server by loading http://localhost (or the IP address assigned to your server) in a browser.

Edit apache2.conf

If the default Apache page doesn’t load, you can try editing the apache2.conf file. Just type in “sudo nano /etc/apache2/apache2.conf” and then press enter to edit the file in Nano. Add the line, “ServerName localhost” to the file and then save and exit. Every time you change apache2.conf you should restart the Apache server so the changes will take effect. Type in sudo apache2ctl restart and press . When this is finished, try browsing to “localhost” in your Firefox browser.

Other considerations

Most of the time, people want to use PHP with Apache. To do this, all you have to do is type “sudo aptitude install php5 libapache2-mod-php5” into a terminal window and then press . If you need to have PHP4 installed, type in “sudo aptitude install php4 libapache2-mod-php4” and then press .

After that, enable the PHP modules by typing in “sudo a2enmod php4” and then pressing and then type “sudo a2enmod php5” followed by hitting the key. Type in sudo apache2ctl restart and press .


As you have seen, Apache Web server installation is really easy in Ubuntu. You can continue to add modules to Apache such as CGI and Perl if necessary. The Apache Web server is one of the most powerful available and is capable of running the most sophisticated Web applications.