\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{\modcaps}{\module{mod\_caps}} \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{\modprivacyodbc}{\module{mod\_privacy\_odbc}} \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}} %% Contributed modules \usepackage{ifthen} \newboolean{modhttpbind} \newcommand{\modhttpbind}{\module{mod\_http\_bind}} \newboolean{modhttpfileserver} \newcommand{\modhttpfileserver}{\module{mod\_http\_fileserver}} \include{contributed_modules} %% 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 Binary Installer} Probably the easiest way to install an \ejabberd{} instant messaging server is using the binary installer published by Process-one. The binary installers of released \ejabberd{} versions are available in the Process-one \ejabberd{} downloads page: \ahrefurl{http://www.process-one.net/en/ejabberd/downloads} The installer will deploy and configure a full featured \ejabberd{} server and does not require any extra dependencies. In *nix systems, remember to set executable the binary installer before starting it. For example: \begin{verbatim} chmod +x ejabberd-2.0.0_1-linux-x86-installer.bin ./ejabberd-2.0.0_1-linux-x86-installer.bin \end{verbatim} The installer generates desktop shortcuts to start and stop ejabberd. The Windows installer also adds ejabberd as a system service, and a shortcut to a debug console for experienced administrators. You can start ejabberd using the shortcut or the Windows service. Note that the Windows service is a feature still in development, and for example it doesn't keep track of changes made manually in ejabberdctl.cfg. If you want ejabberd to be started automatically at boot time, go to the Windows service settings and set ejabberd to be automatic started. On a Linux system, if you want ejabberd to start as daemon at boot time, copy \term{ejabberd.init} from the bin directory to something like \term{/etc/init.d/ejabberd} (depending on your distribution) and call \term{/etc/inid.d/ejabberd start} to start it. The \term{ejabberdctl} administration script is included in the \term{bin} directory. Please refer to the section~\ref{ejabberdctl} for details about \term{ejabberdctl}, and configurable options to fine tune the Erlang runtime system. \section{Installing \ejabberd{} with Operating System specific packages} Some Operating Systems provide a specific \ejabberd{} package adapted to the system architecture and libraries. It usually 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. Usually those packages create a script like \term{/etc/init.d/ejabberd} to start and stop \ejabberd{} as a service at boot time. \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. You will have to create your own \ejabberd{} start script depending of how you handle your CEAN installation. The default \term{ejabberdctl} script is located into \ejabberd{}'s priv directory and can be used as an example. \section{Installing \ejabberd{} from Source Code} \label{installation} \ind{install} The canonical form for distribution of \ejabberd{} stable releases is the source code package. Compiling \ejabberd{} from source code is quite easy in *nix systems, as long as your system have all the dependencies. \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 R10B-9 up to R11B-5. Erlang R12 releases are not yet officially supported, and are not recommended for production servers. \item OpenSSL 0.9.6 or higher, for STARTTLS, SASL and SSL encryption. Optional, highly recommended. \item Zlib 1.2.3 or higher, for Stream Compression support (XEP-0138). Optional. \item GNU Iconv 1.8 or higher, for the IRC Transport (mod\_irc). Optional. Not needed on systems with GNU Libc. \end{itemize} \subsection{Download Source Code} \label{download} \ind{install!download} Released versions of \ejabberd{} are available in the Process-one \ejabberd{} downloads page: \ahrefurl{http://www.process-one.net/en/ejabberd/downloads} \ind{Subversion repository} Alternatively, 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 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{ejabberdctl.cfg} Configuration file of the administration script \titem{inetrc} Network DNS configuration \end{description} \titem{/sbin/ejabberdctl} Administration script \titem{/var/lib/ejabberd/} \begin{description} \titem{.erlang.cookie} Erlang cookie file \titem{db} Mnesia 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 (see section~\ref{logfiles}): \begin{description} \titem{ejabberd.log} ejabberd service log \titem{sasl.log} Erlang/OTP system log \end{description} \end{description} \subsection{Start} \label{start} \ind{install!start} You can use the \term{ejabberdctl} command line administration script to start and stop \ejabberd{}. Usage example: \begin{verbatim} $ ejabberdctl start $ ejabberdctl status Node ejabberd@localhost is started. Status: started ejabberd is running $ ejabberdctl stop \end{verbatim} Please refer to the section~\ref{ejabberdctl} for details about \term{ejabberdctl}, and configurable options to fine tune the Erlang runtime system. \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 R11B-5 or higher} \item \footahref{http://sourceforge.net/project/showfiles.php?group\_id=10127\&package\_id=11277}{Expat 2.0.0 or higher} \item \footahref{http://www.gnu.org/software/libiconv/}{GNU Iconv 1.9.2} (optional) \item \footahref{http://www.slproweb.com/products/Win32OpenSSL.html}{Shining Light OpenSSL 0.9.8d or higher} (to enable SSL connections) \item \footahref{http://www.zlib.net/}{Zlib 1.2.3 or higher} \end{itemize} \subsubsection{Compilation} \label{windowscom} We assume that we will try to put as much library as possible into \verb|C:\sdk\| to make it easier to track what is install for \ejabberd{}. \begin{enumerate} \item Install Erlang emulator (for example, into \verb|C:\sdk\erl5.5.5|). \item Install Expat library into \verb|C:\sdk\Expat-2.0.0| directory. Copy file \verb|C:\sdk\Expat-2.0.0\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:\sdk\GnuWin32|. Copy file \verb|C:\sdk\GnuWin32\bin\lib*.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:\sdk\Expat-2.0.0\Libs| and \verb|C:\sdk\GnuWin32\bin| to the \verb|PATH| environment variable. \item Install OpenSSL in \verb|C:\sdk\OpenSSL| and add \verb|C:\sdk\OpenSSL\lib\VC| to your path or copy the binaries to your system directory. \item Install ZLib in \verb|C:\sdk\gnuWin32|. Copy \verb|C:\sdk\GnuWin32\bin\zlib1.dll| to your system directory. If you change your path it should already be set after libiconv install. \item Make sure the you can access Erlang binaries from your path. For example: \verb|set PATH=%PATH%;"C:\sdk\erl5.5.5\bin"| \item Depending on how you end up actually installing the library you might need to check and tweak the paths in the file configure.erl. \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{Create a Jabber Account for Administration} \label{initialadmin} You need a Jabber account and grant him administrative privileges to enter the \ejabberd{} Web Admin: \begin{enumerate} \item Register a Jabber account on your \ejabberd{} server, for example \term{admin1@example.org}. There are two ways to register a Jabber account: \begin{enumerate} \item Using \term{ejabberdctl}\ind{ejabberdctl} (see section~\ref{ejabberdctl}): \begin{verbatim} % ejabberdctl register admin1 example.org FgT5bk3 \end{verbatim} \item Using a Jabber client and In-Band Registration (see section~\ref{modregister}). \end{enumerate} \item Edit the \ejabberd{} configuration file to give administration rights to the Jabber account you created: \begin{verbatim} {acl, admins, {user, "admin1", "example.org"}}. {access, configure, [{allow, admins}]}. \end{verbatim} You can grant administrative privileges to many Jabber accounts, and also to accounts in other Jabber servers. \item Restart \ejabberd{} to load the new configuration. \item Open the Web Admin (\verb|http://server:port/admin/|) in your favourite browser. Make sure to enter the \emph{full} JID as username (in this example: \jid{admin1@example.org}. The reason that you also need to enter the suffix, is because \ejabberd{}'s virtual hosting support. \end{enumerate} \section{Upgrading \ejabberd{}} To upgrade an ejabberd installation to a new version, simply uninstall the old version, and then install the new one. Of course, it is important that the configuration file and Mnesia database spool directory are not removed. \ejabberd{} automatically updates the Mnesia table definitions at startup when needed. If you also use an external database for storage of some modules, check if the release notes of the new ejabberd version indicates you need to also update those tables. \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 the internal \ejabberd{} 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. Note that \ejabberd{} never edits the configuration file. So, the configuration changes done using the Web Admin are stored in the database, but are not reflected in the configuration file. If you want those changes to be use after \ejabberd{} restart, you can either edit the configuration file, or remove all its content. 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, , [