Installing Apache on Linux/UNIX

Installing Apache on Linux/UNIX
This section explains how to install a fresh build of Apache 2.0.58 on Linux/UNIX. The general steps necessary to successfully install Apache from source are as follows:


1. Download the software

2. Run the configuration script

3. Compile the code and install it

The following sections describe these steps in detail.

Downloading the Apache Source Code
The official Apache download site is located at http://httpd.apache.org/download.cgi. You can find several versions of the Apache source code, packaged with different compression methods. The distribution files are first packed with the tar utility and then compressed either with the gzip tool or the compress utility. Download the *.tar.gz version if you have the gunzip utility installed on your system. This utility comes installed by default in open source operating systems such as FreeBSD and Linux. Download the *.tar.Z file if gunzip is not present in your system. (It isn’t included in the default installation of many commercial UNIX operating systems.)

The file you want to download will be named something similar to httpd-2.0.VERSION.tar.Z or httpd-2.0.VERSION.tar.gz, where VERSION is the most recent release of Apache. For example, Apache version 2.0.58 is downloaded as a file named httpd-2.0.58.tar.gz. Keep the downloaded file in a directory reserved for source files, such as /usr/src/ or /usr/local/src/.

Uncompressing the Source Code
If you downloaded the tarball compressed with gzip (it will have a tar.gz suffix), you can uncompress it using the gunzip utility (part of the gzip distribution).

By the Way

Tarball is a commonly used nickname for software packed using the tar utility.

You can uncompress and unpack the software by typing the following command:

# gunzip < httpd-2.0*.tar.gz | tar xvf

If you downloaded the tarball compressed with compress (it will have a tar.Z suffix), you can issue the following command:

# cat httpd-2.0*.tar.Z | uncompress | tar xvf

Uncompressing the tarball creates a structure of directories, with the top-level directory named httpd-2.0_VERSION. Change your current directory to this top-level directory to prepare for configuring the software.

Preparing to Build Apache
You can specify which features the resulting binary will have by using the configure script in the top-level distribution directory. By default, Apache will be compiled with a set of standard modules compiled statically and will be installed in the /usr/local/apache2 directory. If you are happy with these settings, you can issue the following command to configure Apache:

# ./configure

However, in preparation for the PHP installation in Chapter 4, “Installing and Configuring PHP,” you will need to make sure that mod_so is compiled into Apache. This module, named for the UNIX shared object (*.so) format, enables the use of dynamic modules such as PHP with Apache. To configure Apache to install itself in a specific location (in this case, /usr/local/apache2/) and to enable the use of mod_so, issue the following command:

#./configure –prefix=/usr/local/apache2 –enable-module=so

The purpose of the configure script is to figure out everything related to finding libraries, compile-time options, platform-specific differences, and so on, and to create a set of special files called makefiles. Makefiles contain instructions to perform different tasks, called targets, such as building Apache. These files will be read by the make utility, which will carry out those tasks. If everything goes well, after executing configure, you will see a set of messages related to the different checks just performed and will be returned to the prompt:


configure ok
creating test/Makefile
config.status: creating docs/conf/httpd.conf

config.status: executing default commands
#

If the configure script fails, warnings will appear, alerting you to track down additional software that must be installed, such as compilers or libraries. After you install any missing software, you can try the configure command again, after deleting the config.log and config.status files from the top-level directory.

Building and Installing Apache
The make utility reads the information stored in the makefiles and builds the server and modules. Type make at the command line to build Apache. You will see several messages indicating the progress of the compilation, and you will end up back at the prompt. After compilation is finished, you can install Apache by typing make install at the prompt. The makefiles will install files and directories and return you to the prompt:


Installing header files
Installing build system files
Installing man pages and online manual

make[1]: Leaving directory `/usr/local/bin/httpd-2.2.0′
#

The Apache distribution files should now be in the /usr/local/apache2 directory, as specified by the –prefix switch in the configure command. To test that the httpd binary has been correctly built, type the following at the prompt:

# /usr/local/apache2/bin/httpd -v

You should see the following output (your version and build date will be different):

Server version: Apache/2.0.58
Server built: May 12 2014 11:47:22

آموزش طراحی سایت اختصاصی یا آموزش اختصاصی طراحی سایت در mortezasaheb.ir

ارایه درگاه پرداخت ePayBank.ir برای هاستینگها برای فروش هاست های لینوکس

هاستینگهای ایرانی میتوانند خدمات شرکت خویش را در MyCityAd.ir آگهی نمایند.