old-www/HOWTO/Postfix-Cyrus-Web-cyradm-HOWTO/install.html

1513 lines
26 KiB
HTML
Raw Permalink Blame History

<HTML
><HEAD
><TITLE
>Getting and installing the software</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Postfix-Cyrus-Web-cyradm-HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Technologies"
HREF="tech.html"><LINK
REL="NEXT"
TITLE="Configuring MySQL"
HREF="mysql-config.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Postfix-Cyrus-Web-cyradm-HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="tech.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="mysql-config.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="INSTALL"
></A
>3. Getting and installing the software</H1
><P
> Most of the software is included in your Linux distribution. I. e. SuSE is shipping Cyrus as
far as I know since 7.1.
Since SuSE 8.1, cyrus-imap 2.1 and sasl2 is included, and works. It is still recommended to compile
Cyrus by yourself. SuSE does not ship a MySQL enabled Postfix.
</P
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Deprecated packages for Debian stable and testing</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Debian users probably want to install packages provided by Debian. Unfortunately Debian stable (Woody) and testing (sarge) are using the deprecated version of the software used in this HOWTO. I tested the respective packages from Debian unstable (sid) and the are working. Please note, that the maintainers at Debian are very conservative. The software packages <20>postfix-mysql<71>, <20>libsasl2<6C> and <20>cyrus21-imapd<70> are stable, even if they are only available in the <20>unstable<6C> tree.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="MYSQL-INSTALL"
></A
>3.1. Getting and installing MySQL</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN267"
></A
>3.1.1. Download</H3
><P
> Origin-Site: <A
HREF="http://www.mysql.com/downloads/"
TARGET="_top"
>http://www.mysql.com/downloads/</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN271"
></A
>3.1.2. Building and installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local
tar -xvzf mysql-4.0.18.tar.gz
cd mysql-4.0.18
./configure \
--prefix=/usr/local/mysql \
--enable-assembler \
--with-innodb \
--without-debug
make
make install
/usr/local/mysql/bin/mysql_install_db
echo /usr/local/mysql/lib/mysql &#62;&#62; /etc/ld.so.conf
ldconfig
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql</PRE
></FONT
></TD
></TR
></TABLE
><P
>To improve security, add a mysql-user on your system i.e. <20>mysql<71>, then</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>chown -R mysql /usr/local/mysql/var</PRE
></FONT
></TD
></TR
></TABLE
><P
> If you want to start MySQL automatically at boottime, copy
<TT
CLASS="FILENAME"
>/usr/local/mysql/share/mysql/mysql.server</TT
> to <TT
CLASS="FILENAME"
>/etc/init.d/</TT
>
for SuSE, for Redhat it is <TT
CLASS="FILENAME"
>/etc/rc.d/init.d</TT
> instead of <TT
CLASS="FILENAME"
>/etc/init.d/</TT
>.
Further you need to add symbolic links to <TT
CLASS="FILENAME"
>/etc/init.d/rc3.d</TT
>
for SuSE and <TT
CLASS="FILENAME"
>/etc/rc.d/rc3.d</TT
> for Redhat.
</P
><P
> The following example is for SuSE Linux and should be easily changed for Redhat and other Linux
distributions and commercial Unix systems.
</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/
ln -s /etc/init.d/mysql.server /etc/init.d/rc3.d/S20mysql
ln -s /etc/init.d/mysql.server /etc/init.d/rc3.d/k08mysql</PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="BERKELEY-DB"
></A
>3.2. Getting and installing Berkeley DB</H2
><P
> The Berkeley DB is a requirement for building Cyrus-SASL and Cyrus-IMAP. Some Systems comes with
recent versions but without the header files installed. Please see your distributors CD/DVD
to see if you can install the header files from a package. Usually this package is called bdb-devel.
</P
><P
>The version that comes with GNU/Debian Linux is out of date, you will need to compile the most
recent version instead. If you already installed Berkeley DB on your Debian Box, please
uninstall it to prevent conflicts.
</P
><P
>It is also very important, that Cyrus-SASL and Cyrus-IMAP is compiled with the same version of
Berkeley DB or else you can run into problems.</P
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Berkeley DB versions</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>I only tested version 4.0.x versions of bdb. Please let me know if you are successful with newer versions.</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN293"
></A
>3.2.1. Download Berkeley DB</H3
><P
> Origin-Site: <A
HREF="http://www.sleepycat.com/update/snapshot/db-4.0.14.tar.gz"
TARGET="_top"
> http://www.sleepycat.com/update/snapshot/db-4.0.14.tar.gz</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN297"
></A
>3.2.2. Building and installing Berkeley DB</H3
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd dist
./configure --prefix=/usr/local/bdb
make
make install
echo /usr/local/bdb/lib &#62;&#62; /etc/ld.so.conf
ldconfig</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN301"
></A
>3.3. Getting and installing OpenSSL</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN303"
></A
>3.3.1. Download OpenSSL</H3
><P
>Origin-Site
<A
HREF="http://www.openssl.org"
TARGET="_top"
>http://www.openssl.org</A
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN307"
></A
>3.3.2. Building and installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local
tar -xvzf openssl-0.9.7d.tar.gz
cd openssl-0.9.7d
./config shared
make
make test
make install
echo "/usr/local/ssl/lib" &#62;&#62; /etc/ld.so.conf
ldconfig</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Select your CPU to improve speed</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>By default the Makefile generates code for the i486 CPU. You can change this by editing the
<TT
CLASS="FILENAME"
>Makefile</TT
> after running <B
CLASS="COMMAND"
>config </B
><TT
CLASS="OPTION"
>shared</TT
>.
Search for <TT
CLASS="OPTION"
>-m486</TT
> and replace it i.e with <TT
CLASS="OPTION"
>-march=athlon</TT
></P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="CYRUS-INSTALL"
></A
>3.4. Getting and installing Cyrus SASL and IMAP</H2
><P
> Building Cyrus SASL and IMAP from source is not a easy task. There are some prerequisites to be
fulfilled, and lots of difficult authentication related stuff to be considered.
</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN321"
></A
>3.4.1. Download Cyrus SASL and Cyrus IMAP</H3
><P
> Origin-Site: <A
HREF="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.18.tar.gz"
TARGET="_top"
> ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.18.tar.gz</A
>
</P
><P
>Origin-Site: <A
HREF="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-imapd-2.2.3.tar.gz"
TARGET="_top"
> ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-imapd-2.2.3.tar.gz</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN327"
></A
>3.4.2. Create the cyrus user</H3
><P
>On most systems there is no cyrus user and mailgroup by default. Check for a free UID, usually daemons are running with UIDs less that 100.
As example I am using UID 96 which is what SuSE has in the default <TT
CLASS="FILENAME"
>/etc/passwd</TT
>.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>groupadd mail
useradd -u 96 -d /usr/cyrus -g mail cyrus
passwd cyrus</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN332"
></A
>3.4.3. Building and installing Cyrus SASL</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>tar -xvzf cyrus-sasl-2.1.18.tar.gz
cd cyrus-sasl-2.1.18
./configure \
--enable-anon \
--enable-plain \
--enable-login \
--disable-krb4 \
--disable-otp \
--disable-cram \
--disable-digest \
--with-saslauthd=/var/run/saslauthd \
--with-pam=/lib/security \
--with-dblib=berkeley \
--with-bdb-libdir=/usr/local/bdb/lib \
--with-bdb-incdir=/usr/local/bdb/include \
--with-openssl=/usr/local/ssl \
--with-plugindir=/usr/local/lib/sasl2
make
make install
mkdir -p /var/run/saslauthd
cd saslauthd
make testsaslauthd
cp testsaslauthd /usr/local/bin
echo /usr/local/lib/sasl2 &#62;&#62; /etc/ld.so.conf
ldconfig</PRE
></FONT
></TD
></TR
></TABLE
><P
>The SASL library is installed in <TT
CLASS="FILENAME"
>/usr/local/lib/sasl2</TT
> but some programs are expecting SASL in
<TT
CLASS="FILENAME"
>/usr/lib/sasl2</TT
>. So it is a good idea to create a symbolic link:
<B
CLASS="COMMAND"
>ln -s /usr/local/lib/sasl2 /usr/lib/sasl2</B
>.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN339"
></A
>3.4.4. Building Cyrus-IMAP</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>tar -xvzf cyrus-imapd-2.2.3.tar.gz
cd cyrus-imapd-2.2.3
export CPPFLAGS="-I/usr/include/et"
./configure \
--with-sasl=/usr/local/lib \
--with-perl \
--with-auth=unix \
--with-dbdir=/usr/local/bdb \
--with-bdb-libdir=/usr/local/bdb/lib \
--with-bdb-incdir=/usr/local/bdb/include \
--with-openssl=/usr/local/ssl \
--without-ucdsnmp \
make depend
make
make install</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="STARTUPSCRIPT"
></A
>3.4.5. Automatic startup script</H3
><P
>If you wish to start the Cyrus IMAP daemon automatically after booting, you need a startup script.
Place the following script in <TT
CLASS="FILENAME"
>/etc/init.d/</TT
>. For Redhat, it is
<TT
CLASS="FILENAME"
>/etc/rc.d/init.d</TT
> instead of <TT
CLASS="FILENAME"
>/etc/init.d/</TT
>.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>#!/bin/bash
#
# Cyrus startup script
case "$1" in
start)
# Starting SASL saslauthdaemon
/usr/local/sbin/saslauthd -c -a pam&#38;
# Starting Cyrus IMAP Server
/usr/cyrus/bin/master &#38;
;;
stop)
# Stopping SASL saslauthdaemon
killall saslauthd
# Stopping Cyrus IMAP Server
killall /usr/cyrus/bin/master
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac</PRE
></FONT
></TD
></TR
></TABLE
><P
>If I get the time, I will provide a more sophisticated script, but this script works.</P
><P
>Now create the Symlinks in the runlevel directory (SuSE):</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>ln -s /etc/init.d/cyrus /etc/init.d/rc3.d/S20
ln -s /etc/init.d/cyrus /etc/init.d/rc3.d/K10</PRE
></FONT
></TD
></TR
></TABLE
><P
>For Redhat:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>ln -s /etc/rc.d/init.d/cyrus /etc/rc.d/rc3.d/S20cyrus
ln -s /etc/rc.d/init.d/cyrus /etc/rc.d/rc3.d/K10cyrus</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="UPDATE-CYRUS"
></A
>3.4.6. Update Cyrus IMAPd</H3
><P
>This section describes HOWTO update the IMAPd from version 2.1.x to 2.2.x</P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Update is critical and can mean complete data loss</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Please test this procedure on a test/pre-production server first. Also have close look to <TT
CLASS="FILENAME"
>install-upgrade.html</TT
> that comes with the cyrus-imapd distribution. Please note, that you shoud plan a downtime for the production server to have the time to solve problems. Also note, that nobody I cannot take responsibility for the update procedure provided here</P
></TD
></TR
></TABLE
></DIV
><P
>Cyrus changed the format of the dbd databases used for internal storage of mailboxlist flags etc.</P
><P
>A convert script comes with the distribution. The most important database is <TT
CLASS="FILENAME"
>/var/imap/mailboxes.db</TT
>. Without that database cyrus-imapd will NOT run. This requires a backup. Lets do a dump and a backup of the database.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>&#13;/etc/init.d/cyrus stop # be sure no cyrus process is running
lsof /var/imap/mailboxes.db # be sure NO process is accessing the mailbox file
su - cyrus
/usr/cyrus/bin/ctl_mboxlist -d &#62; /tmp/mailbox.db.dump
cp /var/imap/mailboxes.db /var/imap/mailboxes.db.old</PRE
></FONT
></TD
></TR
></TABLE
><P
>Convert the <TT
CLASS="FILENAME"
>/var/imap/mailboxes.db</TT
>
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>/usr/cyrus/bin/cvt_cyrusdb /var/imap/mailboxes.db berkeley /var/imap/mailboxes.db.new skiplist
mv /var/imap/mailboxes.db.new /var/imap/mailboxes.db</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
><P
>Convert all the <20>seen<65> databases:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>find /var/imap/user -name \*.seen -exec /usr/cyrus/bin/cvt_cyrusdb \{\} flat \{\}.new skiplist \; -exec mv \{\}.new \{\} \;</PRE
></FONT
></TD
></TR
></TABLE
><P
>Converting the sieve scripts</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>/usr/local/cyrus-imapd-2.2.3/tools/masssievec /usr/cyrus/bin/sievec</PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="POSTFIX-INSTALL"
></A
>3.5. Getting and installing Postfix</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN374"
></A
>3.5.1. Download</H3
><P
> Origin-Site: <A
HREF="http://www.postfix.org/ftp-sites.html"
TARGET="_top"
>http://www.postfix.org/ftp-sites.html</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN378"
></A
>3.5.2. Creating a User-ID (UID) and Group-ID (GID) for postfix</H3
><P
> Before you build and install postfix, be sure to create a <20>postfix<69> and a <20>postdrop<6F> user and group if they do not exist on the system.
First check for the groups. You can check this by <B
CLASS="COMMAND"
>grep postfix /etc/group</B
> and
<B
CLASS="COMMAND"
>grep maildrop /etc/group</B
>
</P
><P
> If there are no such groups and users, you just create them. Search for a free numeric UID and GID. In the
following example I will use UID and GID 33333 for Postfix and 33335 for the maildrop UID and GID. These ID's
correspond to other documents.
</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>groupadd -g 33333 postfix
groupadd -g 33335 postdrop
useradd -u 33333 -g 33333 -d /dev/null -s /bin/false postfix</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN385"
></A
>3.5.3. Building and installing</H3
><P
> The following section shows what you have to do if you installed MySQL from source as described above.
If you installed MySQL from a binary package such as rpm or deb, then you have to change the
include and library-flags to -I/usr/include/mysql and -L/usr/lib/mysql.
</P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Old MTA needs to be uninstalled</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>It is important that you uninstall any sendmail version from RPM based systems.
I suggest that you remove sendmail, and install Postfix instead. At least SuSE RPMs need a MTA.
After installing the Postfix-RPM, just install Postfix over the RPM installation by following the HOWTO.</P
></TD
></TR
></TABLE
></DIV
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>tar -xvzf postfix-2.0.19.tar.gz
cd postfix-2.0.19
make makefiles 'CCARGS=-DHAS_MYSQL \
-I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH \
-I/usr/local/include/sasl -I/usr/local/bdb/include' \
'AUXLIBS=-L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm -L/usr/local/lib -lsasl2 -L/usr/local/bdb/lib'
make
make install</PRE
></FONT
></TD
></TR
></TABLE
><P
>During <B
CLASS="COMMAND"
>make install</B
> a few question are asked. Just pressing
<B
CLASS="KEYCAP"
>Enter</B
> should match your needs. For Redhat users it could be useful to
enter <TT
CLASS="FILENAME"
>/usr/local/share/man</TT
></P
><P
>Now you need to create some symbolic links to start Postfix automatically on system startup. The sample is
for SuSE Linux, please consult your vendors manual for other distributions.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>ln -s /usr/sbin/postfix /etc/init.d/rc3.d/S14postfix
ln -s /usr/sbin/postfix /etc/init.d/rc3.d/K07postfix</PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PAM-INSTALL"
></A
>3.6. Getting and installing PAM</H2
><P
>PAM is installed by default on almost all Linux distributions. I am not describing how to compile PAM
by yourself, because it could break your system. Instead, I will describe how to install the package.
</P
><P
>&#13; </P
><P
>Users of a RPM based distribution can issue the following command:</P
><P
>&#13;<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>rpm -i pam-devel.rpm</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
><P
>Debian users can install the devel package with the following command:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>apt-get install libpam0g-dev</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PAM-MYSQL-INSTALL"
></A
>3.7. Getting and installing pam_mysql</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN409"
></A
>3.7.1. Download</H3
><P
>Origin-Site: <A
HREF="http://sourceforge.net/projects/pam-mysql/"
TARGET="_top"
> http://sourceforge.net/projects/pam-mysql/</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN413"
></A
>3.7.2. Installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>tar -xvzf pam_mysql-0.5.tar.gz
cd pam_mysql</PRE
></FONT
></TD
></TR
></TABLE
><P
>If you have compiled mysql by yourself,
check the <TT
CLASS="FILENAME"
>Makefile</TT
> and enter the correct path to your mysql libs and add the
compiler flag <TT
CLASS="VARNAME"
>CFLAGS</TT
> <TT
CLASS="OPTION"
>-I/path/to/mysql/include</TT
>.
</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>ifndef FULL_LINUX_PAM_SOURCE_TREE
export DYNAMIC=-DPAM_DYNAMIC
export CC=gcc
export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-Wshadow -pedantic -fPIC -I/usr/local/mysql/include
export MKDIR=mkdir -p
export LD_D=gcc -shared -Xlinker -x -L/usr/local/mysql/lib/mysql -lz
endif</PRE
></FONT
></TD
></TR
></TABLE
><P
>After customizing that file you an go ahead with the pam_mysql compile.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>make
cp pam_mysql.so /lib/security
[[ ! -d /var/lib/mysql ]] &#38;&#38; mkdir /var/lib/mysql
ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock</PRE
></FONT
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="WEB-CYRADM-INSTALL"
></A
>3.8. Getting and installing Web-cyradm</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN425"
></A
>3.8.1. Download</H3
><P
> Origin-Site: <A
HREF="http://www.web-cyradm.org"
TARGET="_top"
>http://www.web-cyradm.org</A
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN429"
></A
>3.8.2. Installing</H3
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>cd /usr/local/apache/htdocs
tar -xvzf web-cyradm-0.5.4.tar.gz
touch /var/log/web-cyradm.log
chown nobody /var/log/web-cyradm.log</PRE
></FONT
></TD
></TR
></TABLE
><P
>After unpacking web-cyradm, move it to a place in your webserver's documentroot.</P
><P
>Thats all. Now you need to configure the whole bunch of software.</P
><P
>Web-cyradm 0.5.4 is considered stable, and was released on 2003-12-05</P
><P
>Since web-cyradm uses PEAR for its database abstraction layer, you also need a recent
copy of PEAR. This is included in recent PHP Versions. I strongly suggest to update PHP
to 4.3.4, because a lot of important bugs have been fixed.
</P
><P
>A frequent mistake is to forget to touch the logfile and change the owner to the
Apache UID. This is usually <20>nobody<64> or <20>wwwrun<75>.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="MYSQL-CREATE-DB"
></A
>3.8.3. Create the databases and tables</H3
><P
>Now we need to create the database and tables for Postfix and Web-cyradm and add a user to the
database.</P
><P
> Web-cyradm comes with several MySQL scripts: <TT
CLASS="FILENAME"
>insertuser_mysql.sql</TT
> and
<TT
CLASS="FILENAME"
>create_mysql.sql</TT
>.
The first inserts the Database user to the database <20>mysql<71> and creates the database <20>mail<69>. The
second creates the required tables and populates the database with an initial admin-user and the
cyrus user.</P
><P
>The other scripts are used for incremental upgrading from older releases.</P
><P
>The password for the database user <20>mail<69> in this example is <20>secret<65>. Please insert whatever
user and password you like.</P
><P
>The username for the initial superuser is <20>admin<69> with the password <20>test<73>.</P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Change the default password!</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>If a malicious user wants to gain unauthorized access to a system, the first attempt is always
the default username and password supplied by the vendor. It is IMPORTANT that you change them
in the scripts before applying them.</P
></TD
></TR
></TABLE
></DIV
><P
>After customizing the username and password, apply the scripts:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>/usr/local/mysql/bin/mysql -u root -p &#60; \
/usr/local/apache/htdocs/web-cyradm/scripts/insertuser_mysql.sql
/usr/local/mysql/bin/mysql mail -u mail -p &#60; \
/usr/local/apache/htdocs/web-cyradm/scripts/create_mysql.sql</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="WEB-CYRADM-UPDATE"
></A
>3.8.4. Upgrading from 0.5.3 to 0.5.4</H3
><P
>In version 0.5.4 there is a small database enhancement. You can upgrade your database by
issuing the MySQL script that comes with the distribution.</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>mysql mail -u mail -p &#60; \
scripts/upgrade-0.5.3-to-0.5.4_mysql.sql</PRE
></FONT
></TD
></TR
></TABLE
><P
>Since Version 0.5.3 web-cyradm has full support for DES crypted passwords. You can use the php-script
<TT
CLASS="FILENAME"
>migrate.php</TT
> to convert the users passwords from plain text to unix compatible crypt (DES).</P
><DIV
CLASS="CAUTION"
><P
></P
><TABLE
CLASS="CAUTION"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/caution.gif"
HSPACE="5"
ALT="Caution"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Migration from plain to crypt cannot be undone</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>Be sure to have a recent backup of your database before doing anything with the migration script.</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="tech.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="mysql-config.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Technologies</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Configuring MySQL</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>