\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{Installation from Source} \label{installsource} \ind{installation} \subsection{Installation Requirements} \label{installreq} \ind{installation!requirements} \subsubsection{`Unix-like' operating systems} \label{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{Windows} \label{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{Obtaining \ejabberd{}} \label{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{Compilation} \label{compile} \ind{installation!compilation} \subsubsection{`Unix-like' operating systems} \label{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} \subsubsection{Compilation options} 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{database} for more information. \subsubsection{Windows} \label{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{Starting} \label{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{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 an account on your \ejabberd{} deployment. 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, , [