There are two ways to install Apache Http server in Ubuntu, either with apt command to install automatically and manual install it by compiling the source.

Steps to install automatically

1) Search Apache package with apt-cache search command

apt-cache search apache

2) Get the Apache package name, and issue the apt-get install command. You need sudo privileged to install it.

sudo apt-get install apache2

3) Done, open your favour internet browser , and type “http://localhost”

4) Make sure it shows “It work!”

Where the Apache Http server installed?

mkyong@mkyong-desktop:~$ sudo find / -name apache2
/var/lock/apache2
/var/run/apache2
/var/log/apache2
/var/cache/apache2
/usr/sbin/apache2
/usr/lib/apache2
/usr/share/doc/apache2
/usr/share/doc/apache2.2-common/examples/apache2
/usr/share/apache2
/usr/share/bug/apache2
/etc/default/apache2
/etc/logrotate.d/apache2
/etc/cron.daily/apache2
/etc/init.d/apache2
/etc/apache2

Steps to install manually

1) Download the Apache Http server from Apache website (e.g httpd-2.2.13.tar.gz)
http://httpd.apache.org/download.cgi

2) Unzip it

tar xvfz httpd-2.2.13.tar.gz

3) Configure the folder location

 ./configure --prefix=/usr/local/apache --enable-shared=max

Note
The option –prefix is indicate the path where the server will installed, and –enable-shared is activated the load module support, it’s better turn it on during installation stage for the future extend or customise the functionality without recompiling the server.

4) Build it

make

5) Install it , you need sudo

sudo make install

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

Should i install it manually or automatically?

This really depend on your needs, and your expertise. Apt-get install did all the folders structure and automatically start scripts, put in init.d and many post configuration for you, if you are lazy and not really care about the folder structure, 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 :)

This article was posted in Apache category.

Related Posts