843-846.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 117 行
HTML
117 行
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:Configuring a WWW Site</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=51//-->
<!--PAGES=843-846//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="841-843.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="846-848.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Using make with Apache Software</FONT></H4>
<P>When you obtain the Apache software, you may have it in source code form only and not compiled for your system. Some CD-ROM versions of Linux do include pre-compiled versions of Apache, so you don’t have to worry about this step if that’s the case. If you download from an FTP site or a Web page, though, you’ll most likely have to compile the software yourself. This isn’t a major problem, though, because the entire process has been automated with a utility called <TT>make</TT>. We look at the <TT>make</TT> utility in a lot more detail in Chapter 56, “Source Code Control,” but you don’t need to know too much detail to follow this section.</P>
<P>First, let’s make sure the Apache software is ready to go. If you have downloaded the file, you’ll have a single compressed file (most likely called <TT>apache.tar</TT> with either a <TT>.Z</TT> or <TT>.gz</TT> extension. Copy the file to a temporary directory (any directory name will do). You can unpack the file with one of these two commands:</P>
<!-- CODE SNIP //-->
<PRE>
uncompress apache.tar.Z
gunzip apache.tar.gz
</PRE>
<!-- END CODE SNIP //-->
<P>depending on the extension of your file. (We looked at the compression systems used by Linux in Part II, “Getting to Know Linux” and Part VI, “Linux for System Administrators.”)
</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B><BR>If you are using the <TT>GNU tar</TT> version (which is included with most Linux systems) you can uncompress and untar with the single command:
<!-- CODE SNIP //-->
<PRE>
tar zxvf apache.tar.gz
</PRE>
<!-- END CODE SNIP //-->
<HR></FONT>
</BLOCKQUOTE>
<P>After the file has been uncompressed it will be called <TT>apache.tar</TT> (or the same name as the compressed file without the <TT>.Z</TT> or <TT>.gz</TT> extension; we’ll use <TT>apache.tar</TT> as the example throughout this section but you should substitute the real filename if it differs, of course). The <TT>tar</TT> file contains all the files needed by Apache and has to be untarred using this command:</P>
<!-- CODE SNIP //-->
<PRE>
tar xvf apache.tar
</PRE>
<!-- END CODE SNIP //-->
<P>This will unpack the <TT>tar</TT> file and leave a whole bunch of separate files, mostly lowercase but a few with uppercase names like README. The README file tells you how to compile Apache when you are ready. Before compiling, you have to make sure the system is properly configured for your hardware and software. This is done through the Configuration file, which must be edited with an ASCII editor.</P>
<P>The Configuration file is a little awkward. There’s a lot of subtlety and power in the Configuration file, most of which is much too complicated to explain in a section like this. Luckily, most of it you’ll likely never need. The Configuration file is used by a special script called Configure, which generates a file called Makefile used by the <TT>make</TT> utility to compile Apache. There are four kinds of lines in this file:</P>
<DL>
<DD><B>•</B> comments—any line starting with # is a comment.
<DD><B>•</B> commands for <TT>make</TT>—lines that start with nothing.
<DD><B>•</B> modules—any bunch of lines that start with the keyword Module.
<DD><B>•</B> rules—any line that starts with the word Rule.
</DL>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B><BR>Don’t directly edit the <TT>Makefile</TT> file. Any changes you make to this file are overwritten and lost when you run the Configure script. The <TT>Makefile</TT> is generated automatically by the Configure tool by reading all the lines in the Configuration file.<HR></FONT>
</BLOCKQUOTE>
<P>In almost all cases for Linux, all you need do with the Configuration file is remove comment symbols from some lines or add them to others. All the rules and modules can be ignored until you get into tweaking the system. If you look at the Configuration file you’ll see that most of the comments lead into a Module section. These comments can be removed to trigger the inclusion of that Module during the <TT>Makefile</TT> generation. The standard version of Apache for Linux has all the right choices already selected for you, but you can read through the Configuration file and see what the different options are.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>TIP: </B><BR>While there is little harm in uncommenting most sections in the Configuration file, there are three you should leave commented. The <TT>cern_meta_module</TT> is used for backward compatibility with an old CERN server. The <TT>dld_module</TT> is used for dynamic-link loading of code and is not supported by Linux. Finally, <TT>msql_auth_module</TT> is for SQL management of large user password files and is essentially useless unless you are running Minerva SQL.<HR></FONT>
</BLOCKQUOTE>
<P>To start the generation of the <TT>Makefile</TT> from Configuration, you need to issue the <TT>Configure</TT> command (note that the uppercase letters are usually specific and must be typed if they appear that way when you do a directory listing). To run <TT>Configure</TT>, make sure you are logged in as <TT>root</TT> and simply type the utility’s name:</P>
<!-- CODE SNIP //-->
<PRE>
Configure
</PRE>
<!-- END CODE SNIP //-->
<P>You’ll see a few messages, most likely just these two:
</P>
<!-- CODE SNIP //-->
<PRE>
Using Configuration as config file
Configured for FreeBSD platform
</PRE>
<!-- END CODE SNIP //-->
<P>Your second line may be a little different, depending on the version of Apache you obtained. To finish the process, you need to invoke the <TT>make</TT> utility (which depends on you having installed the C compiler and utilities):</P>
<!-- CODE SNIP //-->
<PRE>
make
</PRE>
<!-- END CODE SNIP //-->
<P>By default, <TT>make</TT> looks for a file called <TT>Makefile</TT> and runs that. You may get error messages or simple status messages from the compiler (assuming it can be found), and then you’ll get your shell prompt back. The end result of all this is a single executable file called <TT>httpd</TT>, which is the HTTP daemon. If you tried to run the <TT>httpd</TT> program, you may get a message that a file is missing. The file <TT>httpd</TT> is complaining about is the Apache run-time configuration file (usually called <TT>httpd.conf</TT>).</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="841-843.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="846-848.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?