How to install Apache Http server on Ubuntu

There is two ways to install Apache Http server on Ubuntu :

  1. Use apt command to install it automatically.
  2. Configure and build the source code, and install it manually.

1. Install it automatically

1. Search Apache package with “apt-cache search” command

apt-cache search apache

2. Get Apache package name “apache2”, issue the “apt-get” install command. You need “sudo” privileged for this installation.

sudo apt-get install apache2

3. Done, run your favor internet browser, e.g firefox or IE. Type “http://localhost” in your browser’s URL text box.

4. If you see the words “It work!” in your browser, it means Apache is installed on Ubuntu successfully.

Where is Apache Http server installed?
Issue a “find” command to reveal all the Apache folders and files location.

mkyong@mkyong-desktop:~$ sudo find / -name apache2

2. Install it manually

1. Download Apache Http server from Apache website (e.g httpd-2.2.13.tar.gz)

2. Unzip it with “tar” command.

tar xvfz httpd-2.2.13.tar.gz 

3. Configure the folder location with “./configure” command.

 ./configure --prefix=/usr/local/apache --enable-shared=max
The option –prefix is indicate the path where the server will installed, and –enable-shared is activated the load module support, it’s better to turn it on during installation stage for the future extend or customize the functionality without recompiling the server.

4. Build it with “make” command.


5. Install it with “install” command, you need “sudo” privileged for this installation.

sudo make install

6. Done, all the Apache http server’s files and folders are located at /usr/local/apache.

Should you install it manually or automatically?

This is really depend on your needs, and also your expertise. The “apt-get” command allocate all the folders structure properly, create start scripts in init.d file and configured many post-installation settings automatically. If you are lazy and do not care about the folder structure, then this is definitely the best choice to go.

However if you want to customize the Apache folder structure during the installation and need full control of what happened in your machine, the manual ways is what you need. For me.. the lazy apt-get install is the faster way to go 🙂

About the Author

author image
Founder of, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.


10 Comment threads
3 Thread replies
Most reacted comment
Hottest comment thread
12 Comment authors
HarshaSurabhi?epSaritaAlok Singh Mahor Recent comment authors
newest oldest most voted
How to install Apache Http server in Windows | Apache

[…] How to install Apache Http server in Windows Posted by mkyong , October 5, 2009 at 12:22 pm Installing Apache Http server in Windows is more easier than Linux. See my following posts for installing Apache http server in Linux system 1) How to install Apache Http server in Fedora Core 2) How to install Apache Http server in Ubuntu […]

Lee Murray
Lee Murray

Thanks for this tutorial. I prefer the manual install.

Do you have to compile the source for the manual install or is it possible to just get the binaries and do a manual install then?

medicinska oprema
medicinska oprema

Thank you for this guide. You should also paste some link for post installation configuration needed if apache is installed manually.


i am getting error APR not installed how to do it???


Thanks for the Post, realy useful.

I want to ask for some help, i did the automatic installation, and i can see the “it works” thing, but how can i upload my .html?, Is there a folder where you put it or something?

Hikmat Dhami
Hikmat Dhami

I have been getting invaluable help from your site.

Momo Ricotomo
Momo Ricotomo

when ever i use the tar comand I It returns no such file. do I have to download to a specific directoy?

Alok Singh Mahor
Alok Singh Mahor

I am successfully able to install and run httpd server with the help of your post.
could you please tell me how to add and enable rewrite module in this manually install httpd server?


Hi , I am installing Apache2 on Ubuntu manually. But i am getting error while configuring folder location

config.status: creating Makefile

./config.status: line 1077: awk: command not found

config.status: error: could not create Makefile

configure failed for srclib/apr-util

can you please help me ???


Thanks for sharing the manual steps. I am trying to do a manual install(since the server I am trying to install in, does not have internet). but I am running into issues. Installation is going fine but I am not able to start the service( it says apache 2 is installed) nor I see configuration files in /etc. I am not getting any error during installation :(.