One Kobo dot Com

Installing Apache On Linux

Download Apache from http://httpd.apache.org/docs/2.2/
httpd-2.2.4.tar.bz2 is/was the latest version of the Apache HTTPD Source as of this writing. Save the package to temporary directory.

root@lucy depot]# ls
flash-plugin-9.0.31.0-release.i386.rpm
mediawiki-1.9.3.tar.gz
httpd-2.2.4.tar.bz2
php-5.2.1.tar.bz2
httpd_install.log
rpminfoff

[root@lucy depot]# bunzip2 -vk httpd-2.2.4.tar.bz2
httpd-2.2.4.tar.bz2: done
Uncompress using bunzip2. Options “-vk” for verbose output and to keep original file.

[root@lucy depot]# ls
flash-plugin-9.0.31.0-release.i386.rpm
httpd_install.log
rpminfoff
httpd-2.2.4.tar
mediawiki-1.9.3.tar.gz
httpd-2.2.4.tar.bz2
php-5.2.1.tar.bz2

[root@lucy depot]# tar xvf httpd-2.2.4.tar
Unpack the TAR file.
httpd-2.2.4/
httpd-2.2.4/configure.in
httpd-2.2.4/support/
httpd-2.2.4/support/htpasswd.c

[ETC. ETC.]

httpd-2.2.4/LICENSE
httpd-2.2.4/Makefile.in
httpd-2.2.4/config.layout
httpd-2.2.4/INSTALL

[root@lucy depot]# ls
flash-plugin-9.0.31.0-release.i386.rpm
httpd_install.log
httpd-2.2.4
mediawiki-1.9.3.tar.gz
httpd-2.2.4.tar
php-5.2.1.tar.bz2
httpd-2.2.4.tar.bz2
rpminfoff

[root@lucy depot]# cd httpd-2.2.4
[root@lucy httpd-2.2.4]# ls
ABOUT_APACHE configure LAYOUT README
acinclude.m4 configure.in libhttpd.dsp README.platforms
Apache.dsw docs LICENSE ROADMAP
apachenw.mcp.zip emacs-style Makefile.in server
build httpd.dsp Makefile.win srclib
BuildBin.dsp httpd.spec modules support
Buildconf include NOTICE test
CHANGES INSTALL NWGNUmakefile VERSIONING
config.layout InstallBin.dsp os  

[root@lucy httpd-2.2.4]# ./configure --prefix=/etc/httpd
Run the configure script that scans your system and generates the build environment that allows the next two commands “make” and “make install” to work.
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu

[ETC. ETC.]

config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands

[root@lucy httpd-2.2.4]# ls /etc/httpd
[root@lucy httpd-2.2.4]# ls /etc/httpd/conf.d
mrtg.conf
squid.conf

[root@lucy httpd-2.2.4]# make1
“make” is a facility for compiling programs from source code.
Making all in srclib
make[1]: Entering directory `/opt/depot/httpd-2.2.4/srclib'
Making all in apr
make[2]: Entering directory `/opt/depot/httpd-2.2.4/srclib/apr'
make[3]: Entering directory `/opt/depot/httpd-2.2.4/srclib/apr'
/bin/sh /opt/depot/httpd-2.2.4/srclib/apr/libtool --silent --mode=compile gcc -g -O2 –pthread
-DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I./include
-I/opt/depot/httpd-2.2.4/srclib/apr/include/arch/unix -I./include/arch/unix
-I/opt/depot/httpd-2.2.4/srclib/apr/include -o passwd/apr_getpass.lo -c passwd/apr_getpass.c &&

[ETC. ETC.]

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 /opt/depot/httpd-2.2.4/srclib/pcre/libpcre.la /opt/depot/httpd-2.2.4/srclib/apr-util/libaprutil-1.la /opt/depot/httpd-2.2.4/srclib/apr-util/xml/expat/lib/libexpat.la /opt/depot/httpd-2.2.4/srclib/apr/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
make[1]: Leaving directory `/opt/depot/httpd-2.2.4'

[root@lucy httpd-2.2.4]# make install
“make install” moves the compiled files into the appropriate directories.
Making install in srclib
make[1]: Entering directory `/opt/depot/httpd-2.2.4/srclib'
Making install in apr
make[2]: Entering directory `/opt/depot/httpd-2.2.4/srclib/apr'
sed 's,^\(location=\).*$,\1installed,' < apr-1-config > apr-config.out
sed 's,^\(apr_build.*=\).*$,\1/etc/httpd/build,' < build/apr_rules.mk > build/apr_rules.out

[ETC. ETC.]

/usr/bin/install -c .libs/libexpat.a /etc/httpd/lib/libexpat.a
ranlib /etc/httpd/lib/libexpat.a
chmod 644 /etc/httpd/lib/libexpat.a
PATH="$PATH:/sbin" ldconfig -n /etc/httpd/lib
----------------------------------------------------------------------
Libraries have been installed in:
/etc/httpd/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

[ETC. ETC.]

----------------------------------------------------------------------
Libraries have been installed in:
/etc/httpd/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

[ETC. ETC.]

Installing header files
Installing build system files
Installing man pages and online manual
mkdir /etc/httpd/man
mkdir /etc/httpd/man/man1
mkdir /etc/httpd/man/man8
mkdir /etc/httpd/manual
make[1]: Leaving directory `/opt/depot/httpd-2.2.4'

[root@lucy httpd-2.2.4]# /etc/httpd/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.102 for ServerName
Use an editor such as nano or vi. Modify the httpd.conf file and add a value to the “ServerName” variable (ServerName lucy:80) to get rid of the above message. The next cmd shows the result without blank and comment lines

[root@lucy httpd-2.2.4]#
cat /etc/httpd/conf/httpd.conf | grep -v -e ^$ -e \# -e \;

ServerRoot "/etc/httpd"
Listen 80
<IfModule !mpm_netware_module>
User apache
Group apache
</IfModule>
ServerAdmin root@lucy
ServerName lucy:80
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/etc/httpd/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog logs/error_log
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog logs/access_log common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/etc/httpd/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/etc/httpd/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

[root@lucy httpd-2.2.4]# ps -ef|grep http
root 774 1 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start
daemon 775 774 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start
daemon 776 774 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start
daemon 777 774 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start
daemon 778 774 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start
daemon 779 774 0 20:32 ? 00:00:00 /etc/httpd/bin/httpd -k start

[root@lucy httpd-2.2.4]# /etc/httpd/bin/apachectl stop
Stop and restart the Apache HTTP Server.

[root@lucy httpd-2.2.4]# ps -ef|grep http
root 789 9066 0 20:32 pts/6 00:00:00 grep http

[root@lucy httpd-2.2.4]# /etc/httpd/bin/apachectl start
[root@lucy httpd-2.2.4]# ps -ef|grep http
root 903 1 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start
apache 904 903 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start
apache 905 903 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start
apache 906 903 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start
apache 907 903 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start
apache 908 903 0 20:57 ? 00:00:00 /etc/httpd/bin/httpd -k start


[root@lucy httpd-2.2.4]# chmod -R apache:apache /var/www/html
[root@lucy httpd-2.2.4]# cd /var/www

[root@lucy www]# chown -R apache:apache html icons manual mrtg
[root@lucy www]# chown -R webalizer:apache usage
Change ownership of the HTTP files as shown above.

[root@lucy www]# ll
total 40
drwxr-xr-x 3 apache apache 4096 Mar 23 18:40 html
drwxr-xr-x 2 apache apache 4096 Mar 23 19:59 icons
drwxr-xr-x 3 apache apache 4096 Mar 23 19:48 manual
drwxr-xr-x 2 apache apache 4096 Mar 22 10:54 mrtg
drwxr-xr-x 2 webalizer apache 4096 Mar 23 19:59 usage

[root@lucy www]# /etc/httpd/bin/apachectl stop
[root@lucy www]# /etc/httpd/bin/apachectl start

1. The UNIX/Linux Make process: http://wiki.linuxquestions.org/wiki/Make