skip to main | skip to sidebar

Linux Tutorial for Beginners

Pages

  • Home
 
  • RSS
  • Twitter
Thursday, February 14, 2013

Apache Installation and Configuration through source code

Posted by Raju Gupta at 5:29 AM – 52 comments
 

In this example we extract the source code to a directory under /usr/local/src/


cp httpd-2.0.46.tar.gz /usr/local/src

 cd /usr/local/src

 gunzip httpd-2.0.46.tar.gz

 tar -xvf httpd-2.0.46.tar

 rm -f httpd-2.0.46.tar

 cd httpd-2.0.46


You will see quite a few options there, we will set the prefix (the directory to install apache, we picked /usr/local/apache2) and also tell it which modules to compile and install. We will tell configure to compile and install all modules as shared DSO libraries, that way we can easily enable and disable them in the httpd.conf file. Here's how we ran configure:

 ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all

Compile Apache Now to compile apache we run make this compiles the source code into executable binaries.

 make

Installing Apache The next step copies the binaries into the install directory, and sets up the modules.

make install

Starting/Stopping/Restarting Apache Now to start/stop apache use apachectl in the bin directory of your install dir.

 cd /usr/local/apache2/bin
 
 ./apachectl start
 
 ./apachectl stop
 
 ./apachectl restart


A script for init.d (optional) Here's a script you can save to /etc/init.d/httpd it is a modified version of the one that came in the rpm for Apache 2.0.40

#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
pid=$httpd/logs/httpd.pid
prog=httpd
RETVAL=0


# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        daemon $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        killproc $httpd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd $pid
}
reload() {
        echo -n $"Reloading $prog: "
        killproc $httpd -HUP
        RETVAL=$?
        echo
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $httpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f $pid ] ; then
                stop
                start
        fi
        ;;
  reload)
        reload
        ;;
  graceful|help|configtest|fullstatus)
        $apachectl $@
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|condrestart|reload|status"
  echo $"|fullstatus|graceful|help|configtest}"
        exit 1
esac

exit $RETVAL


Next run chkconfig to setup runlevels for which httpd will run:

chkconfig --add httpd
 
 chkconfig --level 2345 httpd on
 
 chkconfig --list
 

Labels: Apache Email This BlogThis! Share to X Share to Facebook

52 Responses so far.

  1. Unknown says:
    November 17, 2017 at 9:44 PM

    usefull and awesome article.

  2. Unknown says:
    November 17, 2017 at 9:45 PM

    Really helpful post.

  3. Unknown says:
    November 17, 2017 at 9:46 PM

    Verynice aricle.

  4. Unknown says:
    November 17, 2017 at 9:47 PM

    Thank you for sharing.

  5. Unknown says:
    November 18, 2017 at 1:02 AM

    very nice blog thanks for sharing

  6. Unknown says:
    November 18, 2017 at 1:03 AM

    very nice blog It was really useful

  7. Unknown says:
    January 30, 2018 at 9:23 PM

    Nice blog

    uipath training in bangalore

    angular4 interview questions
    python interview questions
    artificial intelligence interview questions


    python online training
    artificial intelligence online training
    talend training
    docker training

  8. Unknown says:
    January 30, 2018 at 9:24 PM

    Nice blog
    myTectra Profile | Trainingindustry.com
    myTectra | Instagram
    myTectra | Youtube

  9. UNKNOWN says:
    February 3, 2018 at 3:14 AM

    Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.

    AWS TRAINING IN BANGALORE

  10. UNKNOWN says:
    February 3, 2018 at 3:15 AM

    Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.

    AWS TRAINING IN BANGALORE

  11. UNKNOWN says:
    February 3, 2018 at 3:25 AM

    Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    Angularjs2 Training in Porur

  12. UNKNOWN says:
    February 3, 2018 at 3:26 AM


    I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

    php training in porur

  13. UNKNOWN says:
    February 3, 2018 at 3:28 AM

    I‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.

    oracle training in porur

  14. Unknown says:
    February 7, 2018 at 2:26 AM

    It has been simply incredibly generous with you to provide openly
    what exactly many individuals would’ve marketed for an eBook to end
    up making some cash for their end, primarily given that you could
    have tried it in the event you wanted.


    aws training in chennai



    aws training in bangalore

  15. Unknown says:
    February 7, 2018 at 2:26 AM

    It has been simply incredibly generous with you to provide openly
    what exactly many individuals would’ve marketed for an eBook to end
    up making some cash for their end, primarily given that you could
    have tried it in the event you wanted.


    aws training in chennai



    aws training in bangalore

  16. Unknown says:
    February 16, 2018 at 9:12 PM

    Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    python training in chennai

  17. Phpscots says:
    February 24, 2018 at 10:11 AM

    Find latest interview questions on PHP, MySQL, Zend PHP, MySQL, Zend Framework, CakePHP, jQuery, NodeJS, Laravel, Angularjs, Angular 2, React Js, Vue js, JSF, struct, CSS3, HTML5, Javascript, JSON, MAVEN, jQuery, NodeJS, Laravel, Angularjs, React Js
    https://www.onlineinterviewquestions.com/

  18. Anonymous says:
    April 25, 2018 at 11:18 PM

    Good collection of information do keep updating us with useful information thanks...
    Best Online Software Training Institute | Apache Spark Training

  19. Unknown says:
    May 24, 2018 at 5:43 AM

    Awesome blog with smart content...
    Summer Course Training in Chennai | Summer Course Training in Velachery

  20. ajay says:
    June 2, 2018 at 4:50 AM

    Wonderful article, very useful and well explanation. Thanks a lot for offering this unique post with us. I really enjoyed by reading your blog post.
    Citrix Exams in Chennai | Xenapp exam center in Chennai

  21. rajendran says:
    June 3, 2018 at 12:59 AM

    I really enjoyed reading the Post. It was very informative and useful..Embedded Project Center in Chennai | Embedded Project Center in Velachery

  22. karthik says:
    June 3, 2018 at 4:09 AM

    Thanks for your informative article. Your post helped me a lot in understanding the career prospects
    OCJP Exam Center in Chennai | OCJP Exam Center in Velachery

  23. Dipanwita says:
    June 3, 2018 at 9:59 PM

    nice blog cloud computing training in chennai

  24. Unknown says:
    June 10, 2018 at 8:31 PM

    Wonderful post. I learned so many things from your blog.. keep posting.Java Project Center in Chennai | Java Project Center in Velachery

  25. Devi says:
    June 11, 2018 at 11:46 PM

    Your blog was so awesome., you explained clearly each and every topic..VLSI Project Center in Chennai | VLSI Project Center in Velachery

  26. Sarath K says:
    June 23, 2018 at 5:09 AM

    Excellent information...It was getting more information about your blog. Thanks for sharing, keep updating.
    Python Courses Certifications Training in Chennai | Excellent Python Classes in Saidapet

  27. revathi says:
    July 7, 2018 at 4:35 AM

    Very good informative article. Thanks for sharing such nice article, keep on up dating such good articles.
    Cisco Certifications Coaching Center in Chennai | Best Cisco Courses in Chromepet

  28. Jerome says:
    July 13, 2018 at 4:50 AM

    I am happy to read your blog,its really amazing with useful information.keep updating
    ISTQB Certifications Course in Chennai | QA Testing in Medavakkam

  29. Unknown says:
    August 8, 2018 at 10:11 PM

    IOT Training in Bangalore - Live Online & Classroom
    IOT Training course observes iot as the platform for networking of different devices on the internet and their inter related communication. Reading data through the sensors and processing it with applications sitting in the cloud and thereafter passing the processed data to generate different kind of output is the motive of the complete curricula. Students are made to understand the type of input devices and communications among the devices in a wireless media.

  30. nancy says:
    September 9, 2018 at 9:19 AM

    Thank you so much for sharing this.

  31. Anbarasan14 says:
    December 14, 2018 at 4:10 AM

    One of the best blogs that I have read till now. Thanks for your contribution in sharing such a useful information. Waiting for your further updates.

    IELTS Training Institute in T Nagar
    IELTS Classes in KK Nagar
    IELTS Classes in Chennai Ashok Nagar
    IELTS Coaching near Porur
    IELTS Training in Poonamallee
    IELTS Coaching Center near me
    IELTS in Ramapuram

  32. Suba says:
    December 14, 2018 at 4:20 AM

    Blog with more latest info stuffed. Thanks for sharing with us.

    selenium training in tambaram
    selenium training in adyar
    iOS Training in Chennai
    French Classes in Chennai
    Big Data Training in Chennai
    web design training in chennai
    website designing training
    web designing training in chennai

  33. velraj says:
    December 26, 2018 at 2:01 AM


    the above information is valuable and i got so many good ideas from this.thanks for this information.
    Devops course in Chennai
    Best devops Training in Chennai
    Devops Training institutes in Chennai
    AWS course in Chennai
    AWS Certification in Chennai
    R Training in Chennai

  34. vijaykumar says:
    January 6, 2019 at 8:39 PM

    thanks for giving a chance to read this.its very very helpful for study.good job
    Amazon web services Training in Chennai
    Best AWS Training in Chennai
    AWS Training institute in Chennai

  35. vijaykumar says:
    January 8, 2019 at 4:50 AM

    Its such a wonderful arcticle.the above article is very helpful to study the technology thanks for that.
    Python Classes in Chennai
    Python Training Institute in Chennai
    ccna Training Institute in Chennai
    ccna Institute in Chennai
    R Training in Chennai
    R Programming Training in Chennai

    Python Training in OMR
    Python Training in Porur

  36. jvimala says:
    January 18, 2019 at 10:59 PM

    Really awesome blog. Your blog is really useful for me
    Regards,
    Data Science Course In Chennai
    Data Science Course Training
    Data Science Training in Chennai
    Data Science Certification Course
    Data Science Certification Training
    Data Science Training Institute

  37. sheela rajesh says:
    January 30, 2019 at 2:00 AM
    This comment has been removed by the author.
  38. sheela rajesh says:
    February 7, 2019 at 1:35 AM

    Your blog is full of creative ideas and that shows your thoughts.thank you very much for giving us this blog.
    SEO Training in Chennai
    Digital Marketing Course in Chennai
    JAVA Training in Chennai
    german classes in chennai
    SEO Training in Chennai
    SEO Training Center in Chennai
    SEO Training in OMR

  39. viji says:
    February 18, 2019 at 4:46 AM

    You are doing a great job. I would like to appreciate your work for good accuracy
    Data Science Course in Chennai
    Data Science With R
    Python Training in Chennai
    Machine Learning in Chennai
    SAS Traioning in Chennai

  40. Rajesh says:
    June 3, 2019 at 3:24 AM

    Thanks for blog really informative. Hope i will find more interesting post from you
    UiPath Training in Bangalore
    UiPath Training in BTM
    Artificial Intelligence training in Bangalore
    Artificial Intelligence training in BTM
    data science with python training in Bangalore
    data science with python training in BTM

  41. Big Data Hadoop training institutes says:
    September 20, 2019 at 5:39 AM

    Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    If you are looking for any Data science Related information please visit our website Data science courses in Pune page!

  42. Julia Loi says:
    March 2, 2020 at 1:37 AM

    I am really happy to say it’s an interesting post to read. I learn new information from your article, you are doing a great job, Keep it up.

    mobile phone repair in Novi
    iphone repair in Novi
    cell phone repair in Novi
    phone repair in Novi
    tablet repair in Novi
    ipad repair in Novi
    mobile phone repair Novi
    iphone repair Novi
    cell phone repair Novi
    phone repair Novi

  43. chandhran says:
    March 13, 2020 at 3:00 AM

    Thanks for sharing the valiuable post, it is easy to un derstand the contepts.
    PHP Training in Bangalore
    PHP Training in Chennai
    PHP Course in Bangalore
    PHP Training Institute in Bangalore
    PHP Classes in Bangalore
    AWS Training in Bangalore
    Data Science Courses in Bangalore
    DevOps Training in Bangalore
    DOT NET Training in Bangalore
    Data Science Course in Chennai

  44. varsha says:
    May 15, 2020 at 8:32 AM

    Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful

    AWS training in chennai | AWS training in anna nagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery

  45. veeraraj says:
    December 18, 2020 at 8:27 AM

    Really good information to show through this blog. I really appreciate you for all the valuable information that you are providing us through your blog.
    visit : Digital Marketing Training in Chennai || Digital Marketing Course in Chennai

  46. nayar says:
    June 2, 2021 at 12:21 AM

    Great post. Thanks for sharing.....
    AWS Training in Bangalore
    AWS Training in Pune
    AWS Training in Hyderabad
    AWS Training in Delhi
    AWS Training in Gurgaon

  47. ramyapranauv says:
    June 24, 2021 at 3:02 AM

    Good Informative Blog.. Keep updating
    PHP Training in Chennai
    PHP Course in Chennai
    PHP Training Institute in Chennai
    PHP Classes in Bangalore
    Best PHP Training Institute in Bangalore

  48. manasha says:
    March 17, 2022 at 2:22 AM

    Great post. keep sharing such a worthy information.
    Angularjs Training in Chennai
    Angularjs Certification Online
    Angularjs Training In Bangalore

  49. Back linker says:
    August 31, 2022 at 4:43 AM

    How to Crack Hotspot Shield VPN Elite · Firstly, uninstall all the previous versions of Hotspot Shield installed in your system. Hotspot Shield Elite For Pc

  50. milka says:
    September 1, 2022 at 3:35 AM

    Great post. keep sharing such a worthy information.
    Data Science Course in Chennai

  51. Links For You says:
    September 1, 2022 at 9:19 AM

    The Unexpected Moment Is Always Sweeter Words Quotes Inspirational Words Words. Thoughtful Surprise Gift Quote Gift Quotes Surprise Gifts Personalized Gifts. Life Surprise Quotes

  52. hanumanchalisa says:
    June 6, 2023 at 7:21 AM

    Thanks for sharing this very useful post
    Hanuman Chalisa Lyrics Pdf
    Hanuman Chalisa Tamil Pdf
    Hanuman Chalisa English Pdf

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments (Atom)

Our Blogs

  • Java Programs with Output
  • C Programming Tutorial
  • Language Tutorial
  • Android Development Tutorial
  • Web Development Tutorial
  • Popular
  • Recent
  • Archives

Popular Posts

  • Apache Configuration File Security Option
    you’ll examine the security options available in the main Apache configuration file, httpd.conf. That file can be modified to secure the e...
  • AWS VPC Overview
    What is VPC ? A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other vir...
  • SSH login without password
    The following steps can be used to ssh from one system to another without specifying a password: 1. On the client run the following com...
  • Advantages & Disadvantages of Kerberos
    Advantages of Kerberos Most conventional network services use password-based authentication schemes. Such schemes require a user to au...
  • Apache Installation and Configuration through source code
    In this example we extract the source code to a directory under /usr/local/src/ cp httpd-2.0.46.tar.gz /usr/local/src cd /usr/local/src...
  • How to automatically chroot jail selected ssh user logins
    1. Creating basic chroot environment First we need to create a simple chroot environment. Our chroot environment will consist of a bash she...
  • Apache and SELinux File Labels
    Take a look at the SELinux settings associated with Apache. To review, SELinux settings, as they relate to a service, mostly fall into tw...
  • How to Create the Kerberos database
    Create the database with the following command.  [root@coma ~] kdb5_util create -s This will prompt you for a password. You will ...
  • Kerberos and PAM
    Kerberos-aware services do not currently make use of Pluggable Authentication Modules (PAM) — these services bypass PAM completely. However...
  • History of MINIX 3
    MINIX has a long history. It goes back to 1987 when the first edition of the book Operating Systems: Design and Implementation by Andrew S...
Powered by Blogger.

Archives

  • ►  2014 (1)
    • ►  May (1)
  • ▼  2013 (4)
    • ▼  February (4)
      • SSH login without password
      • How to automatically chroot jail selected ssh user...
      • Apache Installation and Configuration through sour...
      • Tcpdump command with some examples
  • ►  2012 (89)
    • ►  November (1)
    • ►  March (4)
    • ►  February (36)
    • ►  January (48)
 

Followers

Labels

  • Apache (8)
  • aws (1)
  • Bridge (1)
  • cloud computing (1)
  • Configuration (1)
  • dhcp server (7)
  • DNS (8)
  • File system (11)
  • Fping (1)
  • Iptable basic (3)
  • KDC slave server (1)
  • Kerberos (14)
  • kerberos configuration (5)
  • kerberos database (1)
  • LaTeX (1)
  • Ldap basic (2)
  • Linux aliases (1)
  • Linux Commands (4)
  • Linux History (2)
  • Linux Installation (3)
  • Linux kernel (3)
  • Linux shell (2)
  • Linux software (2)
  • Lvm (1)
  • Mail Server (3)
  • Network Script (1)
  • PHP (1)
  • Raid (6)
  • SELinux (1)
  • Sendmail (3)
  • ssh (2)
  • Tcpdump example (1)
  • Virtualization (5)
  • Webmin (1)
  • Yum (2)
 
 
© 2011 Linux Tutorial for Beginners | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger