How to install it?

Answer

How to install Apache

There are numerous ways of installing the package or application.  There are enlisted below -

  1. One of the features of this open source web application is that anyone can make installer as per their own environment. This has allowed various vendors like Debian, Red Hat, FreeBSD, Suse etc. to customize the file location and configuration of apache taking into account other installed applications and base OS.
  2. Apart from installing it from a vendor based installer, there is always the option of building and installing it from the source code. Installing Apache from source file is a platform independent & works for all OS.

The apache web server is a modular application where the administrator can choose the required functionality and install different modules as per his/her requirement.

All modules can be compiled as a Dynamic Shared Objects (DSO is an object file that could be shared by multiple apps while they are executing) that exists separately from the main apache file.  The DSO approach is highly recommended, it makes the task of adding/removing/updating modules from the servers configuration very simple.

 

APACHE INSTALLATION ON LINUX PLATFORM

On Red Hat or rpm based systems

If you are using an rpm (RedHat Package Manager is a utility for installing application on Linux systems) based Linux distribution i.e. Red Hat, Fedora, CentOs, Suse, you can install this application by either vendor specific Package Manager or directly building the rpm file from the available source tarball.

You can install Apache via the default Package Manager available on all Red Hat based distributions like CentOs, Red Hat and Fedora.

1
[root@amsterdam ~]# yum install httpd

The apache source tarball could be converted into an rpm file using the following command.

 

[root@amsterdam ~]# rpmbuild -tb httpd-2.4.x.tar.bz2

It is mandatory to have -devel package installed on your server for creating .rpm file from source.

Once you convert the source file into an rpm installer, you could use the following command to install Apache.

1
[root@amsterdam ~]# rpm –ivh httpd-2.4.4-3.1.x86_64.rpm

After the installation the server does not start automatically, in order to start the service, you have to use any of the following command on Fedora, CentOs or Red Hat.

1
2
3
4
5
[root@amsterdam ~]# /usr/sbin/apachectl start
 
[root@amsterdam ~]# service httpd start
 
[root@amsterdam ~]# /etc/init.d/httpd start

Installing Apache from Source

Installing apache from the source require the –devel package to be installed on your server. .You can find the latest available version of Apache, you can download it here .  Once you download the source file move it to the /usr/local/src folder.

1
2
3
4
5
6
7
[root@amserversterdam ~] cd /usr/local/src
 
[root@amserversterdam ~] gzip -d httpd-2.2.26.tar.gz
 
[root@amserversterdam ~] tar xvf httpd-2.2.26.tar
 
[root@amserversterdam ~] httpd-2.2.26

In order to see all configuration option available for Apache, you can use ./configure –help option.  The most common configuration option is –prefix={install directory name}.

1
2
3
4
5
6
7
[root@amserversterdam ~]./configure --help
 
[root@amserversterdam ~]./configure –prefix=/usr/local/apache –enable-so
 
[root@amserversterdam ~] make
 
[root@amserversterdam ~] make install

The above example shows the compilation of Apache within the /usr/local/apache directory with the DSO capability. The –enable-so option, can load required modules to apache at run time via the DSO mechanism rather than requiring a recompilation.

Once the installation completes, you can browse the web servers default page with your favorite browser.  If firewall is enabled on your server, you must have to make exception for port 80 on your OS firewall.  You can use the following command to open port 80.

1
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

service iptables save

You can see the default Apache Welcome screen by browsing your server IP address.

All apache Questions

Ask your interview questions on apache

Write Your comment or Questions if you want the answers on apache from apache Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---