821-824.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 177 行

HTML
177
字号
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Setting up a Gopher Service</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=50//-->

<!--PAGES=821-824//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="819-821.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="824-826.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">Setting Up the Makefile</FONT></H4>

<P>Two files need modification for the compilation process to proceed properly. These two files are <TT>Makefile.config</TT> and <TT>conf.h</TT>. With many versions of Gopher available on Linux systems, the configuration parameters that these files need have already been set, but you should check the values carefully to prevent problems.</P>

<P>The <TT>Makefile.config</TT> file (used by <TT>Makefile</TT> to build the executables) is a lengthy file, so you should be careful while moving through it to avoid accidental changes. The important areas to examine are the directory definitions and server and client settings. These are dealt with individually in the following sections.</P>

<P>One setting you may wish to alter is the debugging utility, which is enabled by default in most systems. This can help you get the system running properly, but when the operation is correct, you should recompile the source with the debugging features removed to make the process faster and smaller, as well as to reduce debug information overhead. To remove debugging features, comment out the <TT>DEBUGGING</TT> line so it looks like this:</P>

<!-- CODE SNIP //-->

<PRE>

#DEBUGGING = -DDEBUGGING

</PRE>

<!-- END CODE SNIP //-->

<P>By default this line is probably not commented out.

</P>

<P>The directory definitions are usually in a block with five to seven entries, depending on the number of entries for the man pages. A typical directory definition block looks like this:</P>

<!-- CODE SNIP //-->

<PRE>

PREFIX = /usr/local

CLIENTDIR = &#36;(PREFIX)/bin

CLIENTLIB = &#36;(PREFIX)/lib

SERVERDIR = &#36;(PREFIX)/etc



MAN1DIR = &#36;(PREFIX)/man/man1

MAN5DIR = &#36;(PREFIX)/man/man5

MAN8DIR = &#36;(PREFIX)/man/man8

</PRE>

<!-- END CODE SNIP //-->

<P>The primary change to most <TT>Makefile.config</TT> files will be the <TT>PREFIX</TT>, which is used to set the basic directory for Gopher. The default value is usually <TT>/usr/local</TT>, although you can change it to anything you want (such as <TT>/usr/gopher</TT>). The rest of the variables define subdirectories under the primary Gopher directory and are usually acceptable as they are. Each of the subdirectories can be left the way it is or you can change it to suit your own needs. You can place all the files in one directory, if you want. The meaning of each variable appears in the following list:</P>

<CENTER>

<TABLE WIDTH="90%"><TR>

<TD WIDTH="30%"><TT>CLIENTDIR</TT>

<TD WIDTH="70%">Gopher client software

<TR>

<TD><TT>CLIENTLIB</TT>

<TD>Client help file (<TT>gopher.hlp</TT>)

<TR>

<TD><TT>MAN1DIR</TT>

<TD>Man pages for Gopher client

<TR>

<TD><TT>MAN8DIR</TT>

<TD>Man pages for <TT>gopherd</TT>

<TR>

<TD VALIGN="TOP"><TT>SERVERDIR</TT>

<TD>Gopher server (<TT>gopherd</TT>) and configuration file (<TT>gopherd.conf</TT>)

</TABLE>

</CENTER>

<P>For a Gopher client to run properly on your system, you must modify the <TT>CLIENTOPTS</TT> line in the <TT>Makefile.config</TT> file. The two options for the <TT>CLIENTOPTS</TT> line to control its behavior are as follows:</P>

<CENTER>

<TABLE WIDTH="90%"><TR>

<TD WIDTH="30%"><TT>-DNOMAIL</TT>

<TD WIDTH="70%">Forbids remote users from mailing files.

<TR>

<TD VALIGN="TOP">-<TT>DAUTOEXITONU</TT>

<TD>Allows the Gopher client to be exited with the u command as well as q command.

</TABLE>

</CENTER>

<P>To use either or both of these options, add them to the <TT>CLIENTOPS</TT> line like this:</P>

<!-- CODE SNIP //-->

<PRE>

CLIENTOPTS = -DNOMAIL -DAUTOEXITONU

</PRE>

<!-- END CODE SNIP //-->

<P>Four variables relating to the Gopher server must also be set. These specify the host domain name, the port Gopher should use to listen for connections, the location of the data files, and option flags.

</P>

<P>The domain name is set with the <TT>DOMAIN</TT> variable. It should have a leading period in the name, such as:</P>

<!-- CODE SNIP //-->

<PRE>

DOMAIN = .tpci.com

</PRE>

<!-- END CODE SNIP //-->

<P>You do not need to set this variable if the hostname command returns the fully qualified domain name of the server. In this case, leave the value blank.

</P>

<P>The <TT>SERVERPORT</TT> variable defines the port Gopher uses to wait for services and is usually set for TCP port 70. This line usually looks like this:</P>

<!-- CODE SNIP //-->

<PRE>

SERVERPORT = 70

</PRE>

<!-- END CODE SNIP //-->

<P>If you are not allowing general access to your Gopher site by Internet users, you can change this value. However, if you want to allow Internet users (even a very small subset) to gain access, you should leave this as port 70. If you are setting up your Gopher site for a small network only, then choose any port number you want (between 1024 and 9999) and make sure all the Gopher clients use that number, too.

</P>

<P>The <TT>SERVERDATA</TT> variable defines the location of the data your Gopher server offers. Its default setting is usually as follows:</P>

<!-- CODE SNIP //-->

<PRE>

SERVERDATA = /gopher-data

</PRE>

<!-- END CODE SNIP //-->

<P>Set the variable to point to the file location you use for your Gopher items.

</P>

<P>The <TT>SERVEROPTS</TT> variable accepts a number of keywords that change the behavior of the Gopher service. A typical entry looks like this:</P>

<!-- CODE SNIP //-->

<PRE>

SERVEROPTS = -DSETPROCTITLE -DCAPFILES # -DBIO -DDL

</PRE>

<!-- END CODE SNIP //-->

<P>Any keywords after the pound sign are ignored when <TT>Makefile</TT> runs, so you can adjust its location to set the options you want if the order of the variables allows such a simple approach. The following lists the meaning of the different keywords allowed in the <TT>SERVEROPTS</TT> entry:</P>

<CENTER>

<TABLE WIDTH="90%"><TR>

<TD WIDTH="40%"><TT>-DADD_DATE_AND_TIME</TT>

<TD WIDTH="60%">Adds dates and times to titles.

<TR>

<TD VALIGN="TOP"><TT>-DBIO</TT>

<TD>Used only with the WAIS versions developed by Don Gilbert (<TT>wais8b5</TT>).

<TR>

<TD VALIGN="TOP"><TT>-DDL</TT>

<TD>Provides support for the dl database utility (requires the <TT>dl</TT> system in a directory variable called <TT>DLPATH</TT> and the <TT>DLOBJS</TT> line uncommented out to show the files <TT>getdesc.o</TT> and <TT>enddesc.o</TT> locations).

<TR>

<TD><TT>-DCAPFILES</TT>

<TD>Offers backward compatibility with the cap directory.

<TR>

<TD VALIGN="TOP"><TT>-DLOADRESTRICT</TT>

<TD>Restricts user access based on the number of concurrent users (see the following section).

<TR>

<TD VALIGN="TOP"><TT>-DSETPROCTITLE</TT>

<TD>Sets the name displayed by <TT>ps</TT> command (BSD UNIX-based systems only).

</TABLE>

</CENTER>

<P>The <TT>conf.h</TT> file is used during the compilation to set other parameters about the Gopher service. The important settings, at least when setting up a Gopher service, are those that relate to the number of queries and timeout variables. These tend to occur at the end of the <TT>conf.h</TT> file.</P>

<P>The <TT>WAISMAXHITS</TT> variable defines the maximum number of hits a query to a WAIS database can offer, usually set to around 40. This variable is defined like this:</P>

<!-- CODE SNIP //-->

<PRE>

#define WAISMAXHITS 40

</PRE>

<!-- END CODE SNIP //-->

<P>Note that the pound sign is not a comment symbol because this is written in C. The pound sign is an important part of the processor directive and should be left in place. There is no equal sign in the definition, either.

</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="819-821.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="824-826.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?