What to learn in this chapter
--------- introduction httpd
----------rpm differs from Yum
---------- compile and install advantages
---------- compiling httpd
1. The relationship between Apache and HTTP
HTTP is a Hypertext Transfer Protocol, and the early Apache team used this protocol to develop a Web services software called HTTP. Later, through the bug repair and improve the function, on the basis of HTTP developed another software, called a patchy Server, referred to as Apache, and the Apache organization exactly the same name. Then the Apache team grew stronger, eventually becoming an open-source Software Foundation (ASF), and HTTP was no longer the only software it maintained, and it was obviously inappropriate to call this service software Apache, so we could call it httpd. But sometimes for historical reasons, we will still use Apache as a Web services software to address, and its we service specification has become the industry standard.
In order to be more rigorous, we use httpd to describe the software.
2, introduce the difference between RPM package and source installation
RPM package is to compile the source code package, as long as the installation can provide services, and the source package is the lowest code, if you want to use, but also compiled, obviously not as easy as RPM package, but the two have advantages, production and life, the source code compiled and installed mostly, if the practice use, RPM package installation mostly.
3. Advantages of compiling and installing
<1> Custom Software Features
<2> optimize compilation parameters to improve performance
<3> resolving unnecessary dependencies between software
<4> easy to clean and unload
4. Compile and install httpd-2.2.29
<1> Preparing development tools, development environments, and development libraries
[Email protected]/media/cdrom/packages] #yum groupinstall "Development Tools"
<2> Prepare source code and unzip to a directory
[Email protected]~] #tar-xf httpd-2.2.29.tar.bz2 [[email protected]~] #cd httpd-2.2.29/[[email protected]~/ Httpd-2.2.29] #du-sh42m # only 42M
You can use the View readme, install, and./configure--help to understand the installation process
<3> execute. Configure scripts, specify attributes, check external environments, and generate specific makefile files based on attributes
[Email protected]~/httpd-2.2.29]#./configure--prefix=/usr/local/httpd--sysconfdir=/etc/httpdchecking for KILLPG ... yeschecking bstring.h usability ... nochecking bstring.h presence ... nochecking for bstring.h ... nochecking for UNISTD. H... (cached) yeschecking for syslog ... yeschecking sys/times.h usability ... yeschecking sys/times.h presence ... yeschecking f Or sys/times.h ... yescreating test/makefile ... [[Email protected]~/httpd-2.2.29] #du-sh44m # increased to 44M
<4>make tool compiles, compiles. C Source code according to makefile file into application
[[email protected]~/httpd-2.2.29] #makebmod_status. la modules/ Generators/libmod_autoindex.la modules/generators/libmod_asis.la modules/generators/libmod_cgi.la modules/mappers/libmod_negotiation.la modules/mappers/libmod_dir.la modules/mappers/libmod_ actions.la modules/mappers/libmod_userdir.la modules/mappers/libmod_alias.la modules/mappers/ libmod_so.la server/mpm/prefork/libprefork.la os/unix/libos.la -lm /root/httpd-2.2.29/ srclib/pcre/libpcre.la /root/httpd-2.2.29/srclib/apr-util/libaprutil-1.la /root/httpd-2.2.29/srclib/ apr-util/xml/expat/libexpat.la /root/httpd-2.2.29/srclib/apr/libapr-1.la -lrt -lcrypt - lpthread -ldl make[1]: leaving directory '/root/httpd-2.2.29 ' [[email protected]~ /HTTPD-2.2.29] #du -sh74M # increased to 74M
<5>make Install, create a directory and copy files
[Email protected]~/httpd-2.2.29] #make installmkdir/usr/local/httpd/manmkdir/usr/local/httpd/man/man1mkdir/usr/ LOCAL/HTTPD/MAN/MAN8MKDIR/USR/LOCAL/HTTPD/MANUALMAKE[1]: Leaving directory '/root/httpd-2.2.29 '
<6> binary file import into the PATH environment variable
[Email protected]~] #vim httpd.sh#!/bin/bashpath= $PATH:/usr/local/httpd/bin# Reread configuration file [[email protected]~]#. /etc/profile.d/httpd.sh # View PATH environment variable [[email protected]~] #echo $PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/ Bin:/usr/local/httpd2/bin:/root/bin:/usr/local/httpd/bin
<7> start service
[[email protected]~] #apachectl start# view port [[email protected]~] #netstat -tnlpactive Internet connections (only servers) proto recv-q send-q local address Foreign Address State PID/Program name tcp 0 0 192.168.122.1:53 0.0.0.0:* listen 2021/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* listen 1577/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* listen 1575/ cupsd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1974/master tcp6 0 0 :::80 :::* listen 74875/httpd tcp6 0 0 :::22 :::* LISTEN 1577/sshd tcp6 0 0 : :1:631 :::* LISTEN 1575/cupsd tcp6 0 0 ::1:25 :::* LISTEN 1974/master
<8> Testing
# telnet test service is working properly [[email protected] ~]# Telnet 10.1.0.17Trying 10.1.0.17...telnet:connect to address 10.1.0.17:no rout E to host# Clear firewall rules [[email protected]~] #iptables-f# connection [[email protected] ~]# links 10.1.0.17
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/86/5F/wKiom1e9O-KSCkwwAABatwDguuI688.jpg "title=" 999. JPG "width=" "height=" 288 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:288px; "alt=" Wkiom1e9o-ksckwwaabatwdguui688.jpg "/>
Basic completion of configuration, in order to facilitate future operation, complete the following operations
<9> Import library files
[[Email Protected]~]#[[email protected]~] #vim/etc/ld.so.conf.d/httpd.conf/usr/local/httpd/lib# Reread library file list ldcofig-v
<10> Import header file
[Email protected]~] #ln-sv/usr/local/httpd/include//usr/include/httpd '/usr/include/httpd '/usr/local/httpd /include/'
<11> Import Help Manuals
[[Email protected]~] #vim/etc/man_db.confmandatory_manpath/usr/local/httpd/man...# Reread configuration file [[Email PR otected]~]#. /etc/man_db.conf
Linux under compilation installation httpd