Thursday 30 March 2017

Setup Apache Server on Linux Step by Step

The Apache HTTP Server is an open-source HTTP server for modern operating systems including UNIX, Microsoft Windows, Mac OS/X and Netware. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services observing the current HTTP standards. Apache has been the most popular web server on the Internet since April of 1996.

Development:

  • Programming language: C 

Apache HTTP Server 2.4.25 is available for download from:


Setup Apache Server on Linux Step by Step

-login as root or administrator
-Download the latest release from http://httpd.apache.org/download.cgi#apache24
-/dumps/apache-server

-Extracting the source from the Apache HTTP Server tarball is a simple matter of uncompressing, and then untarring:

gzip -d httpd-2.4.25.tar.gz
tar xvf httpd-2.4.25.tar
cd httpd-2.4.25

-If PREFIX is not specified, it defaults to /usr/local/apache2.
./configure --prefix=/etc/apache2

[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.
Got above error.
If you are using 2.4 than you can go to apr.apache.org and download the latest apr and apr-util. unpack them and move them into the apache source file into /srclib. make sure they are named apr and apr-util not apr.x.x.x. then you can use the --with-included-apr flag
download to "/dumps/apache-server"

tar -xvzf apr-1.5.2.tar.gz
tar -xvzf apr-util-1.5.4.tar.gz
Rename apr-1.5.2 to apr and apr-util-1.5.4 to apr-util. Move it under httpd-2.4.25/srclib/ folder.
[root@oel11 httpd-2.4.25]# pwd
/dumps/apache-server/httpd-2.4.25
[root@oel11 httpd-2.4.25]# ./configure --prefix=/etc/apache2 --with-included-apr
[root@oel11 httpd-2.4.25]#
-Now you can build the various parts which form the Apache package by simply running the command:
make
-Now it's time to install the package under the configured installation PREFIX (see --prefix option above) by running:
make install
-Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/.
vi /etc/apache2/conf/httpd.conf
-Now you can start your Apache HTTP server by immediately running:
/etc/apache2/bin/apachectl -k start
/etc/apache2/bin/apachectl -k stop

Install Apache 2.4.25 by rpm in linux

rpmbuild -tb apr-1.5.2.tar.bz2
rpm -ivh /root/rpmbuild/RPMS/x86_64/apr*.rpm
rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr*.rpm


[root@oeldev apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
error: Failed build dependencies:
        freetds-devel is needed by apr-util-1.5.4-1.x86_64
[root@oeldev apache-server]# yum install freetd
Loaded plugins: refresh-packagekit, security
Setting up Install Process
No package freetd available.
Error: Nothing to do
[root@oeldev apache-server]# rpm -ivh freetds-0.91-2.el6.x86_64.rpm
warning: freetds-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds                ########################################### [100%]
[root@oeldev apache-server]# rpm -ivh freetds-devel-0.91-2.el6.x86_64.rpm
warning: freetds-devel-0.91-2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:freetds-devel          ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb apr-util-1.5.4.tar.bz2
[root@oeldev apache-server]# rpm -Uvh  /root/rpmbuild/RPMS/x86_64/apr-util*.rpm
Preparing...                ########################################### [100%]
   1:apr-util               ########################################### [  8%]
   2:apr-util-dbm           ########################################### [ 17%]
   3:apr-util-devel         ########################################### [ 25%]
   4:apr-util-freetds       ########################################### [ 33%]
   5:apr-util-ldap          ########################################### [ 42%]
   6:apr-util-mysql         ########################################### [ 50%]
   7:apr-util-nss           ########################################### [ 58%]
   8:apr-util-odbc          ########################################### [ 67%]
   9:apr-util-openssl       ########################################### [ 75%]
  10:apr-util-pgsql         ########################################### [ 83%]
  11:apr-util-sqlite        ########################################### [ 92%]
  12:apr-util-debuginfo     ########################################### [100%]
[root@oeldev apache-server]#
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

cd /root/rpmbuild/SOURCES
wget ftp://ftp.gmd.de/…/source/SRPMS/d/distcache-1.4.5-23.src.rpm
rpmbuild --rebuild distcache-1.4.5-23.src.rpm

[root@oeldev SOURCES]# rpm -ivh /root/rpmbuild/RPMS/x86_64/distcache*.rpm
Preparing...                ########################################### [100%]
   1:distcache              ########################################### [ 33%]
   2:distcache-devel        ########################################### [ 67%]
   3:distcache-debuginfo    ########################################### [100%]
[root@oeldev SOURCES]#

[root@oeldev SOURCES]# cd /dumps/apache-server/
[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2

Getting Error:

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib64/httpd/modules/mod_proxy_hcheck.so

[root@oel11 apache-server]# tar xjf httpd-2.4.25.tar.bz2

Open httpd.spec file
Add
%{_libdir}/httpd/modules/mod_proxy_hcheck.so
missing in the %dir after
%{_libdir}/httpd/modules/mod_proxy_ftp.so
Save file

[root@oel11 apache-server]# tar -cjvf httpd-2.4.25.tar.bz2 httpd-2.4.25

[root@oel11 apache-server]# rpmbuild -tb httpd-2.4.25.tar.bz2
...
...
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm


[root@oel11 apache-server]#

yum install /root/rpmbuild/RPMS/x86_64/httpd-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-devel-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-manual-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-tools-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_authnz_ldap-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_lua-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_proxy_html-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_socache_dc-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/mod_ssl-2.4.25-1.x86_64.rpm
yum install /root/rpmbuild/RPMS/x86_64/httpd-debuginfo-2.4.25-1.x86_64.rpm

Completed!

No comments:

Post a Comment

Jenkins Startup and Configuration

Steps to setup jenkins on ubuntu:- -After installation. check the jenkins services running on not on the server. sudo service jenk...