\documentclass[a4paper,10pt]{article} %% Packages \usepackage{float} \usepackage{graphics} \usepackage{hevea} \usepackage[pdftex,colorlinks,unicode,urlcolor=blue,linkcolor=blue, pdftitle=Ejabberd\ Installation\ and\ Operation\ Guide,pdfauthor=Alexey\ Shchepin,pdfsubject=ejabberd,pdfkeywords=ejabberd, pdfpagelabels=false]{hyperref} \usepackage{makeidx} %\usepackage{showidx} % Only for verifying the index entries. \usepackage{verbatim} \usepackage{geometry} %% 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{\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{sec:modiqdiscoption}).} \newcommand{\hostitem}[1]{ \titem{hosts} \ind{options!hosts} This option defines the hostnames of the service (see section~\ref{sec:modhostsoption}). If neither \texttt{hosts} nor the old \texttt{host} is present, the prefix `\jid{#1.}' is added to all \ejabberd{} hostnames. } %\newcommand{\quoting}[2][yozhik]{\begin{quotation}\textcolor{#1}{\textit{#2}}\end{quotation}} % Quotes enabled %\renewcommand{command}[args][default]{def} %\renewcommand{\headrule}{{\color{ejblue}% %\hrule width\headwidth height\headrulewidth \vskip-\headrulewidth}} %% Title page \include{version} \title{Ejabberd \version\ Installation and Operation Guide} \author{Alexey Shchepin \\ \ahrefurl{mailto:alexey@sevcom.net} \\ \ahrefurl{xmpp:aleksey@jabber.ru}} %% 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{\tjepref}[2]{\footahref{http://www.jabber.org/jeps/jep-#1.html}{#2}} \newcommand{\jepref}[1]{\tjepref{#1}{JEP-#1}} \begin{document} \label{titlepage} \begin{titlepage} \maketitle{} \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} \section{\aname{installsource}{Installation from Source}} \label{sec:installsource} \ind{installation} \subsection{\aname{installreq}{Installation Requirements}} \label{sec:installreq} \ind{installation!requirements} \subsubsection{\aname{installrequnix}{`Unix-like' operating systems}} \label{sec:installrequnix} 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} \subsubsection{\aname{installreqwin}{Windows}} \label{sec:installreqwin} To compile \ejabberd{} on a Windows flavour, 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} \subsection{\aname{obtaining}{Obtaining \ejabberd{}}} \label{sec:obtaining} \ind{download} Released versions of \ejabberd{} can be obtained from \\ \ahrefurl{http://www.process-one.net/en/projects/ejabberd/download.html}. \ind{Subversion repository} The latest development version can be retrieved from the Subversion repository\@. \begin{verbatim} svn co http://svn.process-one.net/ejabberd/trunk ejabberd \end{verbatim} \subsection{\aname{compile}{Compilation}} \label{sec:compile} \ind{installation!compilation} \subsubsection{\aname{compileunix}{`Unix-like' operating systems}} \label{sec:compileunix} Compile \ejabberd{} on a `Unix-like' operating system by executing: \begin{verbatim} ./configure make su make install \end{verbatim} These commands will: \begin{itemize} \item install \ejabberd{} into the directory \verb|/var/lib/ejabberd|, \item install the configuration file into \verb|/etc/ejabberd|, \item create a directory called \verb|/var/log/ejabberd| to store log files. \end{itemize} Note: if you want to use an external database, you need to execute the configure script with the option(s) \term{--enable-odbc} or \term{--enable-odbc --enable-mssql}. See section~\ref{sec:database} for more information. \subsubsection{\aname{compilewin}{Windows}} \label{sec:compilewin} \begin{itemize} \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{itemize} %TODO: how to compile database support on windows? \subsection{\aname{start}{Starting}} \label{sec:start} \ind{starting} %TODO: update when the ejabberdctl script is made more userfriendly Execute the following command to start \ejabberd{}: \begin{verbatim} erl -pa /var/lib/ejabberd/ebin -name ejabberd -s ejabberd \end{verbatim} or \begin{verbatim} erl -pa /var/lib/ejabberd/ebin -sname ejabberd -s ejabberd \end{verbatim} In the latter case 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. Note that when using the above command, \ejabberd{} will search for the configuration file in the current directory and will use the current directory for storing its user database and for logging. To specify the path to the configuration file, the log files and the Mnesia database directory, you may use the following command: \begin{verbatim} erl -pa /var/lib/ejabberd/ebin \ -sname ejabberd \ -s ejabberd \ -ejabberd config \"/etc/ejabberd/ejabberd.cfg\" \ log_path \"/var/log/ejabberd/ejabberd.log\" \ -sasl sasl_error_logger \{file,\"/var/log/ejabberd/sasl.log\"\} \ -mnesia dir \"/var/lib/ejabberd/spool\" \end{verbatim} You can find other useful options in the Erlang manual page (\shell{erl -man erl}). To use more than 1024 connections, you should set the environment variable \verb|ERL_MAX_PORTS|: \begin{verbatim} export ERL_MAX_PORTS=32000 \end{verbatim} Note that with this value, \ejabberd{} will use more memory (approximately 6\,MB more). To reduce memory usage, you may set the environment variable \verb|ERL_FULLSWEEP_AFTER|: \begin{verbatim} export ERL_FULLSWEEP_AFTER=0 \end{verbatim} But in this case \ejabberd{} can start to work slower. \section{\aname{basicconfig}{Basic Configuration}} \label{sec: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, local options and ACLs will be removed before new ones are added. \subsection{\aname{hostnames}{Host Names}} \label{sec: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{\aname{virtualhost}{Virtual Hosting}} \label{sec: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, , [