|
Information
|

|
|


|
Top 10 Downloads
|

|
|


|
Advertisment
|

|
|


|
Quick Links
|

|
|

|
|
Apache 2
|

|
|

|
Print
PDF
Building Apache2
Apache version 2.x is the latest major version from the Apache.org
foundation. It has many great new features and performance
enhancements. At this time Slackware ships with the older 1.3
series of apache. Well to get all the improved performance and
features of Apache 2 you will either need to compile your own or
install a package from this site. Since this document is going to
address building your own version we wont cover installing a package
(thats easy).
First of course we need to grab the latest source. This can be
obtained from
http://mirrors.isc.org/pub/apache/httpd/httpd-$APACHE_VER.tar.gz
The great thing about Apache 2 is that you no longer need to compile
mod_ssl to get SSL support in your httpd since it is now part of Apache
2. So at least that is one step we do not need to cover :).
At this point in the process you might wish to backup your website and
any config files. We will not be installing the config file in
/etc/apache so they should be safe. You will need to copy any
site certificates over to the new configuration directory. We
will be using /etc/apache2 for this example. You will do this after we
finish the compile. The format for the httpd.conf is a bit different
so you will need to prepare a fresh one and don't try and use your old
one.
Once you have the source we will need to unpack it. Simply do the
following:
tar xfzv httpd-VERSION.tar.gz.
cd httpdVERSION
Ok now for a small sidebar. First we are going to learn the
correct way to build this. I get so sick of seeing people say hay
just ./configure make make install. No admin worth his weight
would take this approach to installing software on a production
machine. And since we are going to learn the correct way not the
lazy way I will show you how.
Our next step is to create the proper layout for Slackware. There
are a few default layouts in the config.layout file already but none of
them are good for our needs. No problem we will simply add an
entry to this file for our Slackware system. Simply open
config.layout with your favorite editor and add this to the file it
will be located in the top level of the source we just unpacked.
# Layout for Slackware Linux
<Layout Slackware>
prefix:
/usr
exec_prefix: ${prefix}
bindir:
${prefix}/bin
sbindir:
${prefix}/sbin
libdir:
${prefix}/lib
libexecdir: ${prefix}/lib/apache2
mandir:
${prefix}/man
sysconfdir: /etc/apache2
datadir: /var/www
iconsdir:
${datadir}/icons
htdocsdir: ${datadir}/htdocs
manualdir: ${datadir}/manual
cgidir:
${datadir}/cgi-bin
includedir:
${prefix}/include/apache2
localstatedir: /var
runtimedir: ${localstatedir}/run
logfiledir:
${localstatedir}/log/apache2
proxycachedir: ${localstatedir}/cache/apache2
infodir:
${exec_prefix}/share/info
installbuilddir: ${datadir}/build
errordir:
${datadir}/error
</Layout>
This as you can see will put everything in nice proper locations per
the FHS and Slackware standards. Once you have this added you can
then save the config.layout file. The above information is pretty
standard and just looking at it will tell you where things are going to
be installed. Again don't be lazy if you are going to do
something do it right and learn it the right way the first time.
Now that we have that part done we want to do one thing to the source
just to make sure everything has the proper ownership. From inside the
source directory type
chown -R root.root .
This will fix any file ownership issues that may be in the source files.
Now we are ready to configure and install. I use the below
configure options to start with
./configure --enable-layout=Slackware \
--enable-module=most \
--enable-mods-shared=most \
--enable-ssl=shared
As you can see if you have been building apache for awhile this is very
easy compared to the old days of building and having a bunch of
configure options. Also by doing the config.layout we are spared
the need to pass a bunch of prefix options. In the above example
we are simply telling it to enable all the modules, make the shared,
and also to enable ssl. Don't worry you don't have to use all the
modules or even SSL if you don't want but having them there and ready
is a good move. To compile SSL support of course you will need to
have openssl installed.
The build is pretty straight forward. Simply issue a make and
then a make install and you will be all set. After you issue the make install
you may see a box that gives you instructions about making your certs for ssl
if you don't have them. Simply follow those instructions to create a bogus
cert so you can still use SSL. Not required though unless you will be running
an SSL enabled server.
Post install
We need to do a few things after the post install. Of course you
need to edit your httpd.conf file for your site. This is not
aimed at teaching you how to run apache it is assumed you know that
much already. So our post install duties we will fix up the
logrotate.d and our rc script for starting it. Slackware has an
rc.httpd already in the /etc/rc.d area. This is part of another
package but just incase you don't have it here is a copy.
#!/bin/sh
#
# Start the Apache web server
#
case "$1" in
'start')
/usr/sbin/apachectl start ;;
'stop')
/usr/sbin/apachectl stop ;;
'restart')
/usr/sbin/apachectl restart ;;
*)
echo "usage $0 start|stop|restart" ;;
esac
Now this is optional but if you want logrotate to rotate your logs you
will need to add this to the /etc/logrotate.d directory. Simply create a
file called apache2 and copy this into it and save it in that folder.
/var/log/apache2/*_log {
sharedscripts
monthly
rotate 6
create
compress
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>
/dev/null` 2> /dev/null || true
endscript
}
With that done you are ready to start your new Apache 2 server with
/etc/rc.d/rc.httpd start. If it starts be proud you have just
built and install Apache 2 the proper way. Remember you will need
to build or rebuild PHP if you are going to need that support. We
will save that for another howto. For a good idea on how to build
it see the php slackbuild script on this site or the Slackware source
archive.
If you have any questions please or see something we missed drop me a
line and Keep on Slackin.......
|
|

|
Advertisment
|

|
|


|