?? x828.htm
字號:
<HTML
><HEAD
><TITLE
>The Jabber Server</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="Programming Jabber"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Installing the Jabber Server"
HREF="c813.htm"><LINK
REL="PREVIOUS"
TITLE="Installing the Jabber Server"
HREF="c813.htm"><LINK
REL="NEXT"
TITLE="Server Architecture and Configuration"
HREF="c1223.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Programming Jabber</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c813.htm"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Installing the Jabber Server</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c1223.htm"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="JABTDG-CH-3-SECT-3.1"
>The Jabber Server</A
></H1
><P
>The incarnation of the Jabber Server at the time of writing is version 1.4,
more specifically 1.4.1. Version 1.4 represents a major step towards the
2.0 release and brings stabilisation
of the server code and increases in performance and reliability over earlier
versions. 1.4.1 is the version of the Jabber Server we will obtain and install
here, and this will be used as the server for the recipes in the rest of this
book.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-3-SECT-3.1.1"
>Getting It</A
></H2
><P
>The Jabber Server package can be obtained from the Jabber project site -
<A
HREF="http://www.jabber.org"
TARGET="_top"
>http://www.jabber.org</A
>; the
1.4.1 version is available in the downloads area:</P
><P
><A
HREF="http://download.jabber.org/dists/1.4/final/jabber-1.4.1.tar.gz"
TARGET="_top"
>http://download.jabber.org/dists/1.4/final/jabber-1.4.1.tar.gz</A
></P
><P
>The tarball <TT
CLASS="FILENAME"
>jabber-1.4.1.tar.gz</TT
> contains everything
that you need to get a Jabber Server up and running.
<A
NAME="JABTDG-CH-3-FOOTNOTE-2"
HREF="#FTN.JABTDG-CH-3-FOOTNOTE-2"
>[1]</A
>
Previous versions of the Jabber server came in multiple
packages - it was necessary to separately obtain and install GNU's portable
threads library (<B
CLASS="COMMAND"
>pth</B
>) and the asynchronous DNS package
(<B
CLASS="COMMAND"
>ADNS</B
>), as well as obtaining and installing various
Jabber-specific libraries such as <B
CLASS="COMMAND"
>libxode</B
>,
<B
CLASS="COMMAND"
>libjabber</B
> and <B
CLASS="COMMAND"
>libetherx</B
>. Now some
of these libraries and packages have become obsolete as far as the Jabber
Server is concerned (<B
CLASS="COMMAND"
>ADNS</B
> and <B
CLASS="COMMAND"
>libetherx</B
>)
and others have been combined into the main Jabber Server tarball.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="JABTDG-CH-3-SECT-3.1.2"
>Installing It</A
></H2
><P
>Once you have downloaded the Jabber Server tarball, you need to unpack,
configure the build environment, and compile it. The general idea is
that the Jabber server will be compiled and run from wherever you decide
to unpack it; that is, there is no separate 'install' step.</P
><P
>For this reason, and because it's also often useful to be able to install
and start up a different version of the Jabber Server for testing and
comparisons, create a generic 'jabber' directory somewhere central but
local, for example in <TT
CLASS="FILENAME"
>/usr/local/</TT
>:</P
><P
><PRE
CLASS="SCREEN"
>yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>mkdir jabber</B
></TT
></PRE
></P
><P
>The Jabber Server does not and should not be run as <TT
CLASS="LITERAL"
>root</TT
>;
so create a new user <TT
CLASS="LITERAL"
>jabber</TT
>
(group <TT
CLASS="LITERAL"
>jabber</TT
>) to be used as the Jabber Server administrator
and make that user the owner of the generic Jabber Server directory:</P
><P
><PRE
CLASS="SCREEN"
>yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>groupadd jabber</B
></TT
>
yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>useradd -g jabber -d /usr/local/jabber jabber</B
></TT
>
yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>passwd jabber</B
></TT
>
Changing password for jabber
Enter the new password (minimum of 5, maximum of 127 characters)
Please use a combination of upper and lower case letters and numbers.
New password: <TT
CLASS="USERINPUT"
><B
>********</B
></TT
>
Re-enter new password: <TT
CLASS="USERINPUT"
><B
>********</B
></TT
>
Password changed.
yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>chown jabber:jabber jabber</B
></TT
>
yak:/usr/local#</PRE
></P
><P
>Once you've created the generic Jabber Server directory, switch to the new
Jabber Server administration user <TT
CLASS="LITERAL"
>jabber</TT
>,
unpack the tarball you downloaded and enter the resulting directory:</P
><P
><PRE
CLASS="SCREEN"
>yak:/usr/local# <TT
CLASS="USERINPUT"
><B
>su - jabber</B
></TT
>
yak:~$ <TT
CLASS="USERINPUT"
><B
>tar xzf jabber-1.4.1.tar.gz</B
></TT
>
yak:~$ <TT
CLASS="USERINPUT"
><B
>cd jabber-1.4.1/</B
></TT
>
yak:~/jabber-1.4.1$ </PRE
></P
><P
><I
CLASS="EMPHASIS"
><B
CLASS="COMMAND"
>configure</B
></I
></P
><P
>Examining the contents of the <TT
CLASS="FILENAME"
>jabber-1.4.1</TT
> directory,
we see the following files:</P
><P
></P
><UL
><LI
><P
><TT
CLASS="LITERAL"
>configure</TT
> (the configuration script)</P
></LI
><LI
><P
><TT
CLASS="LITERAL"
>jabber.xml</TT
> (the server configuration file)</P
></LI
><LI
><P
><TT
CLASS="LITERAL"
>Makefile</TT
> (the Makefile for the Jabber server)</P
></LI
><LI
><P
><TT
CLASS="LITERAL"
>README</TT
> (some basic instructions)</P
></LI
><LI
><P
><TT
CLASS="LITERAL"
>UPGRADE</TT
> (information on upgrading from an earlier server version)</P
></LI
></UL
><P
>as well as a number of directories that contain the source code.</P
><P
>The first step is to run the <B
CLASS="COMMAND"
>configure</B
> script:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./configure</B
></TT
></PRE
></P
><P
>to determine your platform's compiler settings.</P
><P
>If you want SSL support in the Jabber Server, run the script with the
<TT
CLASS="OPTION"
>--enable-ssl</TT
> switch:</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>./configure --enable-ssl</B
></TT
></PRE
></P
><P
>If you specified the <TT
CLASS="OPTION"
>--enable-ssl</TT
> switch, the
<B
CLASS="COMMAND"
>configure</B
> script will look for your SSL installation
and add the
appropriate compiler flags. If it doesn't find your SSL installation, it will
say so and your Jabber Server will be compiled <I
CLASS="EMPHASIS"
>without</I
>
SSL support.</P
><P
>Next, it will try to determine whether you have <B
CLASS="COMMAND"
>pth</B
>
installed, and if so will use the <B
CLASS="COMMAND"
>pth-config</B
> command
to glean the extra compiler options for building the Jabber Server.
<B
CLASS="COMMAND"
>pth</B
> is required, so if it <I
CLASS="EMPHASIS"
>isn't</I
>
already installed, it
will be set up within your current <TT
CLASS="FILENAME"
>jabber-1.4.1</TT
> directory
tree (as <B
CLASS="COMMAND"
>pth</B
> is included in the
<TT
CLASS="FILENAME"
>jabber-1.4.1.tar.gz</TT
> tarball) and the appropriate compiler
options added.</P
><P
>(If <B
CLASS="COMMAND"
>pth</B
> is set up during the course of
running <B
CLASS="COMMAND"
>configure</B
>, you may see a message:
"<TT
CLASS="LITERAL"
>Now please type 'make' to compile. Good luck.</TT
>"
which comes at the end of the <B
CLASS="COMMAND"
>pth</B
> configure procedure;
you can ignore this because there is <I
CLASS="EMPHASIS"
>only one</I
>
<B
CLASS="COMMAND"
>make</B
> step,
for the Jabber Server, that must be carried out as we are merely preparing
the <B
CLASS="COMMAND"
>pth</B
> build environment for binding into the Jabber
Server build.)</P
><P
>Finally, after extra platform specific compiler settings are determined,
a shell script to set the build environment variables is created with the
name <TT
CLASS="FILENAME"
>platform-settings</TT
>. This is used in the next step.</P
><P
><A
HREF="x828.htm#JABTDG-CH-3-EX-1"
>Example 3-1</A
> shows typical output from the
<B
CLASS="COMMAND"
>configure</B
> script.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-3-EX-1"
></A
><P
><B
>Example 3-1. Typical output from <B
CLASS="COMMAND"
>configure</B
></B
></P
><P
><PRE
CLASS="SCREEN"
>Running Jabber Configure
========================
Getting pth settings... Done.
Setting Build Parameters... Done.
Generating Settings Script... Done.
You may now type 'make' to build your new Jabber system. </PRE
></P
></DIV
><P
><I
CLASS="EMPHASIS"
><B
CLASS="COMMAND"
>make</B
></I
></P
><P
>Once the platform settings have been determined by the <B
CLASS="COMMAND"
>configure</B
> script, we are ready to build the Jabber Server with <B
CLASS="COMMAND"
>make</B
>.</P
><P
><PRE
CLASS="SCREEN"
>yak:~/jabber-1.4.1$ <TT
CLASS="USERINPUT"
><B
>make</B
></TT
></PRE
></P
><P
><A
HREF="x828.htm#JABTDG-CH-3-EX-2"
>Example 3-2</A
> shows abbreviated typical output from the
<B
CLASS="COMMAND"
>make</B
> command.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="JABTDG-CH-3-EX-2"
></A
><P
><B
>Example 3-2. Typical output from <B
CLASS="COMMAND"
>make</B
></B
></P
><P
><PRE
CLASS="SCREEN"
>Making all in pthsock
make[1]: Entering directory `/usr/local/jabber/jabber-1.4.1/pthsock'
gcc -g -Wall -fPIC -I. -I.. -I/usr/local/include -I../jabberd/ -c client.c -o
client.o
gcc -g -Wall -fPIC -I. -I.. -I/usr/local/include -I../jabberd/ -shared -o pthsoc
k_client.so client.o -L/usr/local/lib -lpth -ldl -lresolv
make[1]: Leaving directory `/usr/local/jabber/jabber-1.4.1/pthsock'
Making all in xdb_file
make[1]: Entering directory `/usr/local/jabber/jabber-1.4.1/xdb_file'
gcc -g -Wall -fPIC -I. -I.. -I/usr/local/include -I../jabberd -c xdb_file.c -o
xdb_file.o
...
gcc -g -Wall -fPIC -I. -I.. -I/usr/local/include -DHOME="\"/usr/local/jabber/jab
ber-1.4.1\"" -DCONFIGXML="\"jabber.xml\"" -o jabberd config.o mio.o mio_raw.o mi
o_xml.o mio_ssl.o deliver.o heartbeat.o jabberd.o load.o xdb.o mtq.o static.o lo
g.o lib/expat.o lib/genhash.o lib/hashtable.o lib/jid.o lib/jpacket.o lib/jutil.
o lib/karma.o lib/pool.o lib/pproxy.o lib/rate.o lib/sha.o lib/snprintf.o lib/so
cket.o lib/str.o lib/xmlnode.o lib/xmlparse.o lib/xmlrole.o lib/xmltok.o lib/xst
ream.o lib/xhash.o base/base_connect.o base/base_dynamic.o base/base_exec.o base
/base_stdout.o base/base_accept.o base/base_file.o base/base_format.o base/base_
stderr.o base/base_to.o -Wl,--export-dynamic -L/usr/local/lib -lpth -ldl -lresol
v
make[2]: Leaving directory `/usr/local/jabber/jabber-1.4.1/jabberd'
make[1]: Leaving directory `/usr/local/jabber/jabber-1.4.1/jabberd'
make[1]: Entering directory `/usr/local/jabber/jabber-1.4.1'
make[1]: Nothing to be done for `all-local'.
make[1]: Leaving directory `/usr/local/jabber/jabber-1.4.1'</PRE
></P
></DIV
><TABLE
CLASS="SIDEBAR"
BORDER="1"
CELLPADDING="5"
><TR
><TD
><DIV
CLASS="SIDEBAR"
><A
NAME="AEN955"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -