This is the simple howto for installing apache 2.4.2 on Solaris. If you want to install latest apache on Ubuntu follow this post
Step 1 : Setting the environment
export PATH=/usr/ccs/bin:/usr/sfw/bin:$PATH export CC=gcc
Step 2 : Downloading pre-requisites. I am downloading all the required software to /home/vidyadhar/install folder. Here we are downloading apache http server 2.4.2 source, apr / apr util source and pcre lib source. Open a terminal and run following commands
cd /home/vidyadhar/install wget http://apache.mirrorcatalogs.com//apr/apr-1.4.6.tar.gz wget http://apache.mirrorcatalogs.com//apr/apr-util-1.4.1.tar.gz wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz wget http://apache.tradebit.com/pub//httpd/httpd-2.4.2.tar.gz
Step 3 : Extracting source. Open a terminal and run following commands
cd /home/vidyadhar/install tar zxvf httpd-2.4.2.tar.gz tar zxvf pcre-8.30.tar.gz tar zxvf apr-util-1.4.1.tar.gz tar zxvf apr-1.4.6.tar.gz
Step 4 : Installing PCRE to /home/vidyadhar/pcre folder. Open a terminal and run following commands
cd /home/vidyadhar/install/pcre-8.30 ./configure --prefix=/home/vidyadhar/pcre make make install
Step 5 : Copying apr and apr-utils to srclib of apache http server. Open a terminal and run following commands
cd /home/vidyadhar/install/ mv apr-util-1.4.1 /home/vidyadhar/install/httpd-2.4.2/srclib/apr-util mv apr-1.4.6 /home/vidyadhar/install/httpd-2.4.2/srclib/apr
Step 6 : Installing apache http server to /home/vidyadhar/apache2.4 directory. Open a terminal and run following commands
cd /home/vidyadhar/install/httpd-2.4.2 ./configure --prefix=/home/vidyadhar/apache2.4 --with-included-apr --with-pcre=/home/vidyadhar/pcre make make install
Step 7 : If everything goes well you have a working setup of apache 2.4.2 http server working setup. Before starting the http server you have to do some changes in the http server configuration i.e. in httpd.conf file.
Step 8 : First we will take the backup of original file
cd /home/vidyadhar/apache2.4/conf cp httpd.conf httpd.conf.orig
Step 9 : Now you need to adjust following parameters as per your requirement.
Listen port, User / Group who will be running apache demon, ServerAdmin, ServerName.
I am going to run apache http server through “nobody” user. For the same first you have to create nobody user and group.
Step 10 : I am having multiple nic card on my machine and as per the requirement I will be running http server on 8080 port. So my Listen and ServerName directive should be something like below
Listen 192.168.1.100:8080 ServerName 192.168.1.100:8080
Step 11 : Before starting http server you should always test your configuration. Run following command to check you configuration.
/home/vidyadhar/apache2.4/bin/apachectl -f /home/vidyadhar/apache2.4/conf/httpd.conf -t
The idle output of above command should be Syntax OK
Step 12 : Now we are ready start our http server. Run following command to start http server
/home/vidyadhar/apache2.4/bin/apachectl -f /home/vidyadhar/apache2.4/conf/httpd.conf -k start
Now open your browser and enter http://192.168.1.100:8080 in URL.
Remember in above URL 192.168.1.100:8080 is the IP and PORT on which my http server listening.
If your are unable to start apache http server check for the http server logs which are located at /home/vidyadhar/apache2.4/logs folder