?? x828.htm
字號(hào):
></A
><P
><B
>Running From Build Environment?</B
></P
><P
>You may be wondering where the <B
CLASS="COMMAND"
>make install</B
> step is: there
isn't one—
the Jabber Server is run from within its build environment. One of the reasons
for this is that additional components, such as transports, which may
be installed at any time after the basic server installation, must be compiled
with reference to various Jabber Server header file information. One of
the simplest ways of making this happen is to have the source for those
components unpacked in a subdirectory within the
<TT
CLASS="FILENAME"
>jabber-1.4.1</TT
> directory tree, and at compilation time
component-level references to header files at the Jabber server level can
be made using relative directory names that point back up the directory
hierarchy.</P
></DIV
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-3-SECT-3.1.3"
>Configuring The Jabber Server</A
></H2
><P
>The nature and behavior of a Jabber Server is controlled by the contents
of a configuration file (with a default name of
<TT
CLASS="FILENAME"
>jabber.xml</TT
>)
which you will find in the <TT
CLASS="FILENAME"
>jabber-1.4.1</TT
> directory.
As you can probably guess from the filename's extension, the configuration
is formatted in XML, and affords a very powerful way of expressing the
nature and features of your Jabber Server and associated services and
components. </P
><P
>Details on how to navigate, interpret, and edit this configuration file
are given in the next chapter; here we will just look at the basic
settings that can be modified before you start up the Jabber Server.</P
><P
>For an experimental Jabber Server (such as for the purposes of this book) there
isn't actually anything you <I
CLASS="EMPHASIS"
>need</I
> to change in the
configuration. The
out-of-the-box configuration settings are pretty much what we need to
experiment with our recipes later in the book; nevertheless, let's
look at some of the settings which you may wish to change right now.</P
><P
></P
><UL
><LI
><P
><I
CLASS="EMPHASIS"
>Server Hostname</I
></P
><P
>The <TT
CLASS="LITERAL"
><host/></TT
>
parameter specifies the
Jabber Server's hostname. As delivered, the <TT
CLASS="FILENAME"
>jabber.xml</TT
>
configuration has this set to <TT
CLASS="FILENAME"
>localhost</TT
>:</P
><P
><PRE
CLASS="SCREEN"
><host><jabberd:cmdline flag="h">localhost</jabberd:cmdline></host></PRE
></P
><P
>You can change this to the name of your server hostname - in the case
of our examples this would be <TT
CLASS="FILENAME"
>yak</TT
>. </P
><P
>The <TT
CLASS="FILENAME"
>localhost</TT
> setting occurs elsewhere in the
configuration too - as a literal in the welcome message
that is sent to users after a successful registration with the server. You
may wish to replace this occurrence of <TT
CLASS="FILENAME"
>localhost</TT
>;
furthermore, you will find other occurrences but they are within sections
of the configuration that are commented out in the standard delivered version
of <TT
CLASS="FILENAME"
>jabber.xml</TT
> (specifically administration JIDs,
and definitions for various add-on agents and transports; we will
cover these in the next chapter). </P
><P
>One other place that <TT
CLASS="FILENAME"
>localhost</TT
> occurs is in the
<TT
CLASS="LITERAL"
><update/></TT
> section, which is
explained next.</P
></LI
><LI
><P
><I
CLASS="EMPHASIS"
>Server Software Update Notification Mechanism</I
></P
><P
>The Jabber Server development team offer a facility for servers to
check for updated versions of the Jabber Server software. The facility
is addressed with this configuration setting:</P
><P
><PRE
CLASS="SCREEN"
><update><jabberd:cmdline flag="h">localhost</jabberd:cmdline></update></PRE
></P
><P
>which causes a versioning module (<TT
CLASS="FILENAME"
>mod_version</TT
>) to
send a <TT
CLASS="LITERAL"
><presence/></TT
> packet
(which carries the server version—in our case 1.4.1)
from the server to the Jabber ID
<TT
CLASS="LITERAL"
>jsm@update.jabber.org</TT
> when the Jabber
Server starts up.</P
><P
>If your server is purely internal, and / or behind a firewall, it makes
no sense to have this facility switched on (you can check for updates
to the server on the
<A
HREF="http://www.jabber.org"
TARGET="_top"
>http://www.jabber.org</A
> website)
as the <TT
CLASS="LITERAL"
><presence/></TT
> packet will
never reach its intended destination. You can comment it out like this:</P
><P
><PRE
CLASS="SCREEN"
><!--
<update><jabberd:cmdline flag="h">localhost</jabberd:cmdline></update>
--></PRE
></P
></LI
><LI
><P
><I
CLASS="EMPHASIS"
>Automatic User Directory Update</I
></P
><P
>The configuration as delivered contains a directive:</P
><P
><PRE
CLASS="SCREEN"
><vcard2jud/></PRE
></P
><P
>which means that any vCard data that is maintained
by a Jabber client will be automatically passed on to the central user
directory (the "JUD" - Jabber User Directory), defined elsewhere in the
<TT
CLASS="FILENAME"
>jabber.xml</TT
> as the one at <TT
CLASS="LITERAL"
>jabber.org</TT
>, <TT
CLASS="LITERAL"
>users.jabber.org</TT
>.
<A
NAME="JABTDG-CH-3-FOOTNOTE-3"
HREF="#FTN.JABTDG-CH-3-FOOTNOTE-3"
>[2]</A
> </P
><P
>If you've commented out the update notification mechanism because you're
not going to be able to (or want to) reach the servers at <TT
CLASS="LITERAL"
>jabber.org</TT
>, then you might as well comment this out
to avoid error messages being sent to Jabber clients when vCard data is
modified:
<A
NAME="AEN1016"
HREF="#FTN.AEN1016"
>[3]</A
> </P
><P
><PRE
CLASS="SCREEN"
><!--
<vcard2jud/>
--></PRE
></P
><P
>Alternatively, instead of commenting out the
<TT
CLASS="LITERAL"
><vcard2jud/></TT
>,
you could of course comment out the definition of the
JUD service in the <TT
CLASS="LITERAL"
><browse/></TT
>
section:</P
><P
><PRE
CLASS="SCREEN"
><!--
<service type="jud" jid="users.jabber.org" name="Jabber User Directory">
<ns>jabber:iq:search</ns>
<ns>jabber:iq:register</ns>
</service>
--></PRE
></P
><P
>because the mechanism looks in the
<TT
CLASS="LITERAL"
><browse/></TT
>
section for a reference to a JUD service; if there isn't one there, no
vCard update will be sent.</P
></LI
></UL
><P
>You may have noticed that the values for each of these two settings
(<TT
CLASS="LITERAL"
><host/></TT
> and
<TT
CLASS="LITERAL"
><update/></TT
>)
were wrapped in another tag:</P
><P
><PRE
CLASS="SCREEN"
><jabberd:cmdline flag="h">...</jabberd:cmdline></PRE
></P
><P
>This means that you can override the setting with a command-line switch
(or 'flag'), in this case <TT
CLASS="OPTION"
>-h</TT
>. So in fact, you don't
even need to modify the <TT
CLASS="FILENAME"
>jabber.xml</TT
> configuration
at all, if you specify your hostname when you start the server up (the
welcome message will not be changed, of course). </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-3-SECT-3.1.4"
>Starting and Stopping the Jabber Server</A
></H2
><P
>At this stage, we have a Jabber server with enough basic configuration
to be able to start it up and have it do something useful (like accept
client connections). If you're curious about the rest of the configuration
you encountered while editing the <TT
CLASS="FILENAME"
>jabber.xml</TT
> file,
you can jump to <A
HREF="c1223.htm"
>Chapter 4</A
>. Otherwise, let's start
it up!</P
><P
><I
CLASS="EMPHASIS"
>Starting the Server</I
></P
><P
>The basic invocation looks like this:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./jabberd/jabberd</B
></TT
></PRE
></P
><P
>but if you haven't bothered to change <TT
CLASS="FILENAME"
>localhost</TT
> anywhere
in the configuration (as described earlier) you can use the <TT
CLASS="OPTION"
>-h</TT
>
switch to specify the hostname:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./jabberd/jabberd -h yak</B
></TT
></PRE
></P
><P
>As it stands, there's a directive in the standard
<TT
CLASS="FILENAME"
>jabber.xml</TT
> configuration file that specifies that
any server error messages are to be written out to STDERR:</P
><P
><PRE
CLASS="SCREEN"
><log id='elogger'>
<host/>
<logtype/>
<format>%d: [%t] (%h): %s</format>
<file>error.log</file>
<TT
CLASS="USERINPUT"
><B
><stderr/></B
></TT
>
</log></PRE
></P
><P
>So either comment the directive out:</P
><P
><PRE
CLASS="SCREEN"
><!--
<stderr/>
--></PRE
>
Or redirect STDERR to <TT
CLASS="FILENAME"
>/dev/null</TT
>:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./jabberd/jabberd -h yak 2>/dev/null</B
></TT
></PRE
></P
><P
>You won't lose the error messages - as you can see they're also written to the
<TT
CLASS="FILENAME"
>error.log</TT
> file.</P
><P
>Assuming you wish to free up the terminal session after starting the server,
you can send it to the background:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./jabberd/jabberd -h yak 2>/dev/null &</B
></TT
></PRE
></P
><P
><I
CLASS="EMPHASIS"
>Stopping the Server</I
></P
><P
>To stop the server, just kill the processes, and it will shut down gracefully:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>killall jabberd</B
></TT
></PRE
></P
><P
>or:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>kill `cat jabber.pid`</B
></TT
></PRE
></P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="JABTDG-CH-3-SECT-3.1.4.1"
><TT
CLASS="FILENAME"
>jabberd</TT
> Command Line Switches</A
></H3
><P
>We've seen the <TT
CLASS="OPTION"
>-h</TT
> switch to specify the host when starting
the server up; there are other switches available on the command line too;
here is a list:</P
><DIV
CLASS="TABLE"
><A
NAME="JABTDG-CH-3-TABLE-1"
></A
><P
><B
>Table 3-1. Command Line Switches</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Switch</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Relating to</TH
><TH
ALIGN="LEFT"
VALIGN="TOP"
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="OPTION"
>-c</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Alternate configuration</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Use this to specify an alternative configuration file
if you don't want to use <TT
CLASS="FILENAME"
>jabber.xml</TT
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="OPTION"
>-D</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Debugging info</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Specifying this switch will cause (a large amount of) debugging
information to be sent to STDERR.</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="OPTION"
>-h</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Hostname</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>The hostname of the Jabber Server</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="OPTION"
>-H</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>Home folder</TD
><TD
ALIGN="LEFT"
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -