\documentclass[a4paper,10pt]{book} %% Packages \usepackage{float} \usepackage{graphics} \usepackage{hevea} \usepackage[pdftex,colorlinks,unicode,urlcolor=blue,linkcolor=blue, pdftitle=Ejabberd\ Installation\ and\ Operation\ Guide,pdfauthor=Process-one,pdfsubject=ejabberd,pdfkeywords=ejabberd, pdfpagelabels=false]{hyperref} \usepackage{makeidx} %\usepackage{showidx} % Only for verifying the index entries. \usepackage{verbatim} \usepackage{geometry} \usepackage{fancyhdr} \pagestyle{fancy} %Forces the page to use the fancy template \renewcommand{\chaptermark}[1]{\markboth{\textbf{\thechapter}.\ \emph{#1}}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ \boldmath\textbf{#1}\unboldmath}} \fancyhf{} \fancyhead[LE,RO]{\textbf{\thepage}} %Displays the page number in bold in the header, % to the left on even pages and to the right on odd pages. \fancyhead[RE]{\nouppercase{\leftmark}} %Displays the upper-level (chapter) information--- % as determined above---in non-upper case in the header, to the right on even pages. \fancyhead[LO]{\rightmark} %Displays the lower-level (section) information---as % determined above---in the header, to the left on odd pages. \renewcommand{\headrulewidth}{0.5pt} %Underlines the header. (Set to 0pt if not required). \renewcommand{\footrulewidth}{0.5pt} %Underlines the footer. (Set to 0pt if not required). %% Index \makeindex % Remove the index anchors from the HTML version to save size and bandwith. \newcommand{\ind}[1]{\begin{latexonly}\index{#1}\end{latexonly}} %% Images \newcommand{\logoscale}{0.7} \newcommand{\imgscale}{0.58} \newcommand{\insimg}[1]{\insscaleimg{\imgscale}{#1}} \newcommand{\insscaleimg}[2]{ \imgsrc{#2}{} \begin{latexonly} \scalebox{#1}{\includegraphics{#2}} \end{latexonly} } %% Various \newcommand{\bracehack}{\def\{{\char"7B}\def\}{\char"7D}} \newcommand{\titem}[1]{\item[\bracehack\texttt{#1}]} \newcommand{\ns}[1]{\texttt{#1}} \newcommand{\jid}[1]{\texttt{#1}} \newcommand{\option}[1]{\texttt{#1}} \newcommand{\poption}[1]{{\bracehack\texttt{#1}}} \newcommand{\node}[1]{\texttt{#1}} \newcommand{\term}[1]{\texttt{#1}} \newcommand{\shell}[1]{\texttt{#1}} \newcommand{\ejabberd}{\texttt{ejabberd}} \newcommand{\Jabber}{Jabber} %% Modules \newcommand{\module}[1]{\texttt{#1}} \newcommand{\modadhoc}{\module{mod\_adhoc}} \newcommand{\modannounce}{\module{mod\_announce}} \newcommand{\modconfigure}{\module{mod\_configure}} \newcommand{\moddisco}{\module{mod\_disco}} \newcommand{\modecho}{\module{mod\_echo}} \newcommand{\modirc}{\module{mod\_irc}} \newcommand{\modlast}{\module{mod\_last}} \newcommand{\modlastodbc}{\module{mod\_last\_odbc}} \newcommand{\modmuc}{\module{mod\_muc}} \newcommand{\modmuclog}{\module{mod\_muc\_log}} \newcommand{\modoffline}{\module{mod\_offline}} \newcommand{\modofflineodbc}{\module{mod\_offline\_odbc}} \newcommand{\modprivacy}{\module{mod\_privacy}} \newcommand{\modprivate}{\module{mod\_private}} \newcommand{\modprivateodbc}{\module{mod\_private\_odbc}} \newcommand{\modproxy}{\module{mod\_proxy65}} \newcommand{\modpubsub}{\module{mod\_pubsub}} \newcommand{\modregister}{\module{mod\_register}} \newcommand{\modroster}{\module{mod\_roster}} \newcommand{\modrosterodbc}{\module{mod\_roster\_odbc}} \newcommand{\modservicelog}{\module{mod\_service\_log}} \newcommand{\modsharedroster}{\module{mod\_shared\_roster}} \newcommand{\modstats}{\module{mod\_stats}} \newcommand{\modtime}{\module{mod\_time}} \newcommand{\modvcard}{\module{mod\_vcard}} \newcommand{\modvcardldap}{\module{mod\_vcard\_ldap}} \newcommand{\modvcardodbc}{\module{mod\_vcard\_odbc}} \newcommand{\modversion}{\module{mod\_version}} %% Common options \newcommand{\iqdiscitem}[1]{\titem{iqdisc} \ind{options!iqdisc}This specifies the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).} \newcommand{\hostitem}[1]{ \titem{host} \ind{options!host} This option defines the Jabber ID of the service. If the \texttt{host} option is not specified, the Jabber ID will be the hostname of the virtual host with the prefix `\jid{#1.}'. The keyword "@HOST@" is replaced at start time with the real virtual host name. } %% Title page \include{version} \newlength{\larg} \setlength{\larg}{14.5cm} \title{ {\rule{\larg}{1mm}}\vspace{7mm} \begin{tabular}{r} {\huge {\bf ejabberd \version\ }} \\ \\ {\huge Installation and Operation Guide} \end{tabular}\\ \vspace{2mm} {\rule{\larg}{1mm}} \vspace{2mm} \\ \begin{tabular}{r} {\large \bf \today} \end{tabular}\\ \vspace{5.5cm} } \author{\begin{tabular}{p{13.7cm}} ejabberd Development Team \end{tabular}} \date{} %% Options \newcommand{\marking}[1]{#1} % Marking disabled \newcommand{\quoting}[2][yozhik]{} % Quotes disabled %\newcommand{\new}{\marginpar{\textsc{new}}} % Highlight new features %\newcommand{\improved}{\marginpar{\textsc{improved}}} % Highlight improved features %% To by-pass errors in the HTML version. \newstyle{SPAN}{width:20\%; float:right; text-align:left; margin-left:auto;} %% Footnotes \begin{latexonly} \global\parskip=9pt plus 3pt minus 1pt \global\parindent=0pt \gdef\ahrefurl#1{\href{#1}{\texttt{#1}}} \gdef\footahref#1#2{#2\footnote{\href{#1}{\texttt{#1}}}} \end{latexonly} \newcommand{\txepref}[2]{\footahref{http://www.xmpp.org/extensions/xep-#1.html}{#2}} \newcommand{\xepref}[1]{\txepref{#1}{XEP-#1}} \begin{document} \label{titlepage} \begin{titlepage} \maketitle{} %% Commenting. Breaking clean layout for now: %% \begin{center} %% {\insscaleimg{\logoscale}{logo.png} %% \par %% } %% \end{center} %% \begin{quotation}\textit{I can thoroughly recommend ejabberd for ease of setup --- %% Kevin Smith, Current maintainer of the Psi project}\end{quotation} \end{titlepage} % Set the page counter to 2 so that the titlepage and the second page do not % have the same page number. This fixes the PDFLaTeX warning "destination with % the same identifier". \begin{latexonly} \setcounter{page}{2} \end{latexonly} \tableofcontents{} % Input introduction.tex \input{introduction} \chapter{Installing ejabberd} \section{Installing ejabberd with Graphical Installer} The easiest approach to install an ejabberd Instant Messaging server is to use the graphical installer. The installer is available in ejabberd Process-one \footahref{http://www.process-one.net/en/ejabberd/downloads/}{downloads page}. The installer will deploy and configure a full featured ejabberd server and does not require any extra dependancies. \section{Installing ejabberd with Operating System specific packages} Some Operating Systems provide a specific ejabberd package adapted to your system architecture and libraries, which also checks dependencies and performs basic configuration tasks like creating the initial administrator account. Some examples are Debian and Gentoo. Consult the resources provided by your Operating System for more information. \section{Installing ejabberd with CEAN} \footahref{http://cean.process-one.net/}{CEAN} (Comprehensive Erlang Archive Network) is a repository that hosts binary packages from many Erlang programs, including ejabberd and all its dependencies. The binaries are available for many different system architectures, so this is an alternative to the binary installer and Operating System's ejabberd packages. \section{Installing ejabberd from Source Code} \label{installation} \ind{install} \subsection{Requirements} \label{installreq} \ind{installation!requirements} To compile \ejabberd{} on a `Unix-like' operating system, you need: \begin{itemize} \item GNU Make \item GCC \item libexpat 1.95 or higher \item Erlang/OTP R9C-2 or higher \item OpenSSL 0.9.6 or higher (optional) \item Zlib 1.2.3 or higher (optional) \item GNU Iconv 1.8 or higher (optional, not needed on systems with GNU libc) \end{itemize} \subsection{Download Source Sode} \label{download} \ind{install!download} Released versions of \ejabberd{} can be obtained from \\ \ahrefurl{http://www.process-one.net/en/ejabberd/download.html} \ind{Subversion repository} The latest development version can be retrieved from the Subversion repository using this command: \begin{verbatim} svn co http://svn.process-one.net/ejabberd/trunk ejabberd \end{verbatim} \subsection{Compile} \label{compile} \ind{install!compile} To compile \ejabberd{} execute the commands: \begin{verbatim} ./configure make \end{verbatim} The compilation process may report several warnings related to unusued variables. This is common, and is not a problem. The build configuration script provides several parameters. To get the full list run the command: \begin{verbatim} ./configure --help \end{verbatim} Some options that you may be interested in modifying: \begin{description} \titem{--prefix=/} Specify the path prefix where the files will be copied when running the make install command. \titem{--enable-pam} Enable the PAM authentication method. \titem{--enable-odbc or --enable-mssql} Required if you want to use an external database. See section~\ref{database} for more information. \titem{--enable-full-xml} Enable the use of XML based optimisations. It will for example use CDATA to escape characters in the XMPP stream. Use this option only if you are sure your Jabber clients include a fully compliant XML parser. \titem{--disable-transient-supervisors} Disable the use of Erlang/OTP supervision for transient processes. \end{description} \subsection{Install} \label{install} \ind{install!install} To install ejabberd in the destination directories, run the command: \begin{verbatim} make install \end{verbatim} Note that you may need to have administrative privileges in the system. The files and directories created are, by default: \begin{description} \titem{/etc/ejabberd/} Configuration files: \begin{description} \titem{ejabberd.cfg} ejabberd configuration file \titem{ejabberd.inetrc} Network DNS configuration \titem{ejabberdctl.cfg} Configuration file of the administration script \end{description} \titem{/sbin/ejabberdctl} Administration script \titem{/var/lib/ejabberd/} \begin{description} \titem{.erlang.cookie} Erlang cookie file \titem{db} Database spool files \titem{ebin} Binary Erlang files (*.beam) \titem{priv} \begin{description} \titem{lib} Binary system libraries (*.so) \titem{msgs} Translated strings (*.msgs) \end{description} \end{description} \titem{/var/log/ejabberd/} Log files: \begin{description} \titem{ejabberd.log} Messages reported by ejabberd code \titem{sasl.log} Messages reported by Erlang/OTP \end{description} \end{description} \subsection{Start} \label{start} \ind{install!start} You can use the ejabberdctl command line administration script to start and stop ejabberd. Please refer to the section~\ref{ejabberdctl} for details about ejabberdctl. The command line parameters used by the ejabberdctl administration script when starting the Erlang/OTP virtual machine are: \begin{description} \titem{-pa /var/lib/ejabberd/ebin} Specify the directory where Erlang binary files (*.beam) are located. \titem{-sname ejabberd} The Erlang node will be identified using only the first part of the host name, i.\,e. other Erlang nodes outside this domain cannot contact this node. This is the preferable option in most cases. \titem{-name ejabberd} The Erlang node will be fully identified. This is only useful if you plan to setup an ejabberd cluster with nodes in different networks. \titem{-s ejabberd} This paramaters tells the Erlang machine to start the ejabberd application \titem{-mnesia dir "/var/lib/ejabberd/spool"} Specify the Mnesia database directory. \titem{-ejabberd config "/etc/ejabberd/ejabberd.cfg"} Specify the ejabberd configuration file. \titem{-ejabberd log\_path "/var/log/ejabberd/ejabberd.log"} Specify the directory for the ejabberd.log file. \titem{-sasl sasl\_error\_logger \{file,\"/var/log/ejabberd/sasl.log"\}} Specify the directory for the sasl.log file. \titem{-env ERL\_MAX\_PORTS=32000} Allow up to 32000 connections. The default limit is just 1024. With this value, \ejabberd{} will use more memory (approximately 6 MB more). \titem{-env ERL\_FULLSWEEP\_AFTER=0} May reduce memory usage, but \ejabberd{} may consume more processor. \end{description} Note that some characters need to be escaped when used in shell scripts, for instance \verb|"| and \verb|{}|. You can find other options in the Erlang manual page (\shell{erl -man erl}). \subsection{Specific Notes for BSD} \label{bsd} \ind{install!bsd} The command to compile ejabberd in BSD systems is: \begin{verbatim} gmake \end{verbatim} \subsection{Specific Notes for Microsoft Windows} \label{windows} \ind{install!windows} \subsubsection{Requirements} \label{windowsreq} To compile \ejabberd{} on a Microsoft Windows system, you need: \begin{itemize} \item MS Visual C++ 6.0 Compiler \item \footahref{http://erlang.org/download.html}{Erlang/OTP R9C-2 or higher} \item \footahref{http://sourceforge.net/project/showfiles.php?group\_id=10127\&package\_id=11277}{Expat 1.95.7 or higher} \item \footahref{http://www.gnu.org/software/libiconv/}{GNU Iconv 1.9.1} (optional) \item \footahref{http://www.slproweb.com/products/Win32OpenSSL.html}{Shining Light OpenSSL} (to enable SSL connections) \item \footahref{http://www.zlib.net/}{Zlib 1.2.3 or higher} \end{itemize} \subsubsection{Compilation} \label{windowscom} \begin{enumerate} \item Install Erlang emulator (for example, into \verb|C:\Program Files\erl5.3|). \item Install Expat library into \verb|C:\Program Files\Expat-1.95.7| directory. Copy file \verb|C:\Program Files\Expat-1.95.7\Libs\libexpat.dll| to your Windows system directory (for example, \verb|C:\WINNT| or \verb|C:\WINNT\System32|) \item Build and install the Iconv library into the directory \verb|C:\Program Files\iconv-1.9.1|. Copy file \verb|C:\Program Files\iconv-1.9.1\bin\iconv.dll| to your Windows system directory (more installation instructions can be found in the file README.woe32 in the iconv distribution). Note: instead of copying libexpat.dll and iconv.dll to the Windows directory, you can add the directories \verb|C:\Program Files\Expat-1.95.7\Libs| and \verb|C:\Program Files\iconv-1.9.1\bin| to the \verb|PATH| environment variable. \item While in the directory \verb|ejabberd\src| run: \begin{verbatim} configure.bat nmake -f Makefile.win32 \end{verbatim} \item Edit the file \verb|ejabberd\src\ejabberd.cfg| and run \begin{verbatim} werl -s ejabberd -name ejabberd \end{verbatim} \end{enumerate} %TODO: how to compile database support on windows? \section{Creating an Initial Administrator} \label{initialadmin} Before the web interface can be entered to perform administration tasks, an account with administrator rights is needed on your \ejabberd{} deployment. Instructions to create an initial administrator account: \begin{enumerate} \item Register a Jabber account on your \ejabberd{} server. An account can be created in two ways: \begin{enumerate} \item Using the tool \term{ejabberdctl}\ind{ejabberdctl} (see section~\ref{ejabberdctl}): \begin{verbatim} % ejabberdctl node@host register admin example.org password \end{verbatim} \item Using In-Band Registration (see section~\ref{modregister}): you can use a \Jabber{} client to register an account. \end{enumerate} \item Edit the configuration file to promote the account created in the previous step to an account with administrator rights. Note that if you want to add more administrators, a seperate acl entry is needed for each administrator. \begin{verbatim} {acl, admins, {user, "admin", "example.org"}}. {access, configure, [{allow, admins}]}. \end{verbatim} \item Restart \ejabberd{} to load the new configuration. \item Open the web interface (\verb|http://server:port/admin/|) in your favourite browser. Make sure to enter the \emph{full} JID as username (in this example: \jid{admin@example.org}. The reason that you also need to enter the suffix, is because \ejabberd{}'s virtual hosting support. \end{enumerate} \chapter{Configuring ejabberd} \section{Basic Configuration} \label{basicconfig} \ind{configuration file} The configuration file will be loaded the first time you start \ejabberd{}. The content from this file will be parsed and stored in a database. Subsequently the configuration will be loaded from the database and any commands in the configuration file are appended to the entries in the database. The configuration file contains a sequence of Erlang terms. Lines beginning with a \term{`\%'} sign are ignored. Each term is a tuple of which the first element is the name of an option, and any further elements are that option's values. If the configuration file do not contain for instance the `hosts' option, the old host name(s) stored in the database will be used. You can override the old values stored in the database by adding next lines to the configuration file: \begin{verbatim} override_global. override_local. override_acls. \end{verbatim} With these lines the old global options (shared between all ejabberd nodes in a cluster), local options (which are specific for this particular ejabberd node) and ACLs will be removed before new ones are added. \subsection{Host Names} \label{hostnames} \ind{options!hosts}\ind{host names} The option \option{hosts} defines a list containing one or more domains that \ejabberd{} will serve. Examples: \begin{itemize} \item Serving one domain: \begin{verbatim} {hosts, ["example.org"]}. \end{verbatim} \item Serving one domain, and backwards compatible with older \ejabberd{} versions: \begin{verbatim} {host, "example.org"}. \end{verbatim} \item Serving two domains: \begin{verbatim} {hosts, ["example.net", "example.com"]}. \end{verbatim} \end{itemize} \subsection{Virtual Hosting} \label{virtualhost} \ind{virtual hosting}\ind{virtual hosts}\ind{virtual domains} Options can be defined separately for every virtual host using the \term{host\_config} option.\ind{options!host\_config} It has the following syntax: \begin{verbatim} {host_config, , [