⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch50.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 4 页
字号:


looks like this:</P>



<PRE><FONT COLOR="#0066FF">PREFIX = /usr/local



CLIENTDIR = $(PREFIX)/bin



CLIENTLIB = $(PREFIX)/lib



SERVERDIR = $(PREFIX)/etc







MAN1DIR = $(PREFIX)/man/man1



MAN5DIR = $(PREFIX)/man/man5







MAN8DIR = $(PREFIX)/man/man8



</FONT></PRE>



<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 as



is, or you can change it to suit your needs. You can place all the files in one directory,



if you want. The meaning of each variable appears in the following list: <TT>CLIENTDIR</TT>



Gopher client software</P>



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



<P><TT>MAN1DIR</TT> Man pages for gopher client</P>



<P><TT>MAN8DIR</TT> Man pages for <TT>gopherd</TT>











<BLOCKQUOTE>



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







</BLOCKQUOTE>







<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 shown here: <TT>-DNOMAIL</TT> Prevents remote



users from mailing files.











<BLOCKQUOTE>



	<P><TT>-DAUTOEXITONU</TT> Allows the Gopher client to be exited with the <TT>u</TT>



	command as well as the <TT>q</TT> command.







</BLOCKQUOTE>







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



like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">CLIENTOPTS = -DNOMAIL -DAUTOEXITONU



</FONT></PRE>



<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 this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">DOMAIN = .tpci.com



</FONT></PRE>



<P>You do not need to set this variable if the hostname command returns the fully



qualified domain name of the server. In that 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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">SERVERPORT = 70



</FONT></PRE>



<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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">SERVERDATA = /gopher-data



</FONT></PRE>



<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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">SERVEROPTS = -DSETPROCTITLE -DCAPFILES # -DBIO -DDL



</FONT></PRE>



<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: <TT>-DADD_DATE_AND_TIME</TT> Adds dates



and times to titles.</P>



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



<P><TT>-DDL</TT> Provides support for the <TT>dl</TT> 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).</P>



<P><TT>-DCAPFILES</TT> Offers backwards compatibility with the <TT>cap</TT> directory.</P>



<P><TT>-DLOADRESTRICT</TT> Restricts user access based on the number of concurrent



users (see the following section).











<BLOCKQUOTE>



	<P><TT>-DSETPROCTITLE</TT> Sets the name displayed by <TT>ps</TT> command (BSD UNIX-based



	systems only).







</BLOCKQUOTE>







<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:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">#define WAISMAXHITS 40



</FONT></PRE>



<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>The <TT>MAXLOAD</TT> variable is used if the <TT>-DLOADRESTRICT</TT> keyword was



used in the <TT>SERVEROPTS</TT> variable of <TT>Makefile.config</TT>. The <TT>MAXLOAD</TT>



defines the maximum load average the Gopher service will respond to requests under



(this value can be overridden on the command line). The usual definition is like



this:</P>



<PRE><FONT COLOR="#0066FF">#define MAXLOAD 10.0



</FONT></PRE>



<P>The <TT>READTIMEOUT</TT> and <TT>WRITETIMEOUT</TT> variables set the amount of



time a service waits for a network read or write operation before timing out. The



default settings are usually adequate. These lines look like the following:</P>



<PRE><FONT COLOR="#0066FF">#define READTIMEOUT (1*60)







#define WRITETIMEOUT (3*60)



</FONT></PRE>



<P>The Gopher clients configuration is straight-forward. Begin by defining the Gopher



servers the local machine connects to with the <TT>CLIENT1_HOST</TT> and <TT>CLIENT2_HOST</TT>



entries. The Gopher client chooses one of the two (if both are defined) when it is



started. The entries look like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">#define CLIENT1_HOST &quot;gopher_serv.tpci.com&quot;







#define CLIENT2_HOST &quot;other_gopher_serv.tpci.com&quot;



</FONT></PRE>



<P>The ports to be used to connect to the hosts are defined with these options:<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">#define CLIENT1_PORT 70



</FONT></PRE>







<PRE><FONT COLOR="#0066FF">#define CLIENT2_PORT 70



</FONT></PRE>



<P>If you have a local service and don't want to use port 70 (to prevent access from



the Internet, for example), set the proper port values. If only one Gopher server



is used, set the second value to <TT>0</TT>.</P>



<P>Define the language the Gopher client will use by choosing one value out of a



number of options. The default is American English, set by this command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">#define DEFAULT_LANG &quot;En_US&quot;



</FONT></PRE>



<P>Other language defines are commented out below this one. If you want to change



the default language, comment the American English setting and uncomment the one



you want.</P>



<P>When all the configuration changes have been made, you can invoke the compilation



process for the client and server with these commands:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">make client



</FONT></PRE>







<PRE><FONT COLOR="#0066FF">make server



</FONT></PRE>



<P>Or you can do both client and server systems at once by using the <TT>make</TT>



command with no argument. The programs and data files must be installed, too, using



the following command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">make install



</FONT></PRE>



<H4 ALIGN="CENTER"><A NAME="Heading9<FONT COLOR="#000077">WAIS and Gopher</FONT></H4>



<P>Gopher clients have the ability to use WAIS indexes to search for documents, but



the system must be configured to allow this. We looked at WAIS in Chapter 49, &quot;Configuring



a WAIS Site,&quot; so for the sake of providing WAIS index access to Gopher, we will



assume you have installed WAIS properly and have WAIS indexes ready for Gopher.</P>



<P>To provide WAIS services through Gopher, you may have to make a change in the



WAIS source code. Examine the WAIS source code for a line that looks like this:<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">if (gLastAnd) printf(&quot;search_word: boolean `and' scored/n:);



</FONT></PRE>



<P>This line should be commented out to provide Gopher services, so if it is not,



add C comment symbols before and after the line, like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">/* if (gLastAnd) printf(&quot;search_word: boolean `and' scored/n:); */



</FONT></PRE>



<P>If the line was already commented out (or didn't exist) then you need not make



any change. If you changed the line, though, you have to recompile WAIS by changing



into the WAIS top directory and running the <TT>makefile</TT> (type the command <TT>make</TT>).</P>



<P>Next, examine the Gopher <TT>Makefile.config</TT> file and look for the <TT>WAISTYPE</TT>



variable. It should be defined on a line like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">WAISTYPE = #-DFREEWAIS_0_4



</FONT></PRE>



<P>Then, you have to link the Gopher and WAIS services. Suppose your Gopher source



directory is <TT>/usr/gopher/source</TT> and the WAIS source directory is <TT>/usr/wais/source</TT>.



You can link these services by entering the following commands:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">cd /usr/gopher/source



ln -s /usr/wais/source/include ./ir



ln -s /usr/wais/source/client/ui .



ln -s /usr/wais/source/bin .



</FONT></PRE>



<P>When Gopher is recompiled, it will make the links between Gopher and freeWAIS



and allow the two services to interwork.



<H3 ALIGN="CENTER"><A NAME="Heading10<FONT COLOR="#000077">Setting Up Your



Gopher Directories</FONT></H3>



<P>Gopher directories and files are quite simple to set up, and they follow standard



naming conventions for the most part. Before you begin, though, you should know which



documents and files are to be provided through Gopher to other users, and you should



be able to write a short description of each. (If you don't know the contents of



a file, either read it or get the author to summarize the file for you.) To begin,



we'll assume you will use only a single directory for all your Gopher documents.</P>



<P>Begin by changing to the top directory you use for your Gopher directories (which



you may have to create if you haven't already done so). This directory should not



be where the Gopher source and configuration files are located, for convenience.



Simply choose a useful name and create the directory. For example, to create the



Gopher home directory <TT>/usr/gopher/data</TT>, you would issue a standard <TT>mkdir</TT>



command:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">mkdir /usr/gopher/data



</FONT></PRE>



<P>Change into your Gopher directory and copy the files you want to make available



into it. When you have done that, you can create a descriptive filename for each



file (instead of the more obtuse filenames usually used) up to 80 characters long.



For example, if you have a filename called <TT>q1.sales</TT> you may want to rename



it to <TT>Company_Sales_1997_Q1</TT> to help users identify the contents a little



more easily.</P>



<P>The process for providing better filenames is to first create a <TT>.cap</TT>



directory under your Gopher main directory (such as <TT>/usr/gopher/data/.cap</TT>).



For each file in the main directory, you want to create a file in the <TT>.cap</TT>



directory with the same name, but with a name and number. For example, suppose you



have a file called <TT>q1.sales</TT> in <TT>/usr/gopher/data</TT>. In <TT>/usr/gopher/data/.cap</TT>



you would create a file with the same name, <TT>q1.sales</TT>, which has the following



contents:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">Name=Company Sales for the First Quarter, 1997



Numb=1



</FONT></PRE>

⌨️ 快捷键说明

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