tummy.com: we do linux

vPostMaster Generic Linux Installation

These instructions are for an ftp download of vPostMaster and a manual install.

If you're installing vPostMaster on one of the Linux Distributions which we have packages for, please follow those instructions, not the generic install instructions. This is the hard way.

Note

These instructions give a basic overview of the installation process, but there has been very little demand for doing manual installations. Almost all users do a packaged installation. The authoritative steps required to do the installation can be found in the "setup-fc3" or "setup-debian" scripts and the "vpostmaster.spec" or "debian/*" files.

Instructions

vPostMaster Installation Instructions
(c) 2005 tummy.com, ltd.
http://www.tummy.com/
http://www.vpostmaster.com/
info@tummy.com

INTRODUCTION

   vPostMaster is a full featured email server with an easy to use web
   interface for administering domains, email users and filtering rules.

   It is free for non-commercial use. Commercial use licenses are
   available. 
   
   The Generic Installation instructions assume you have or can:
      a recent Linux system installed with SELinux disabled
      login as root 
      install packages using rpm or apt-get
      edit a text file
      run a script as root
      use a web browser
      start and stop services
      load and configure a Postgres database

PACKAGES

   vPostMaster is the consolidation of many different open source and
   freely available tools and programs, into a well-integrated environment.
   It relies on many different programs, however modern Linux packaging
   techniques can make the end result very easy to install.  Combined with
   automated setup scripts, vPostMaster can be incredibly easy to install.

   Instructions are included below for installation over the network using
   package repositories, as well as manual installation instructions for
   systems which we have not created packages for.  Check the vPostMaster
   web site (http://www.tummy.com/Products/vpostmaster/) for the latest
   information on distributions we provide pre-packaged releases for.

   We will try to support the more common systems with pre-built packages.
   However, there are only so many test systems we can have available.
   Therefore, paying customers have an advantage here.  If you are ready to
   purchase and would like support for your favorite distribution, please
   contact us via the above web site for more information.

BEFORE YOU BEGIN

   It is highly recommended that you not install vPostMaster, or any
   mail-related software, on a production system.  Conflicts between
   existing and new mail software may result in lost or corrupted data or
   system settings and more.  Please also ensure that you have a backup of
   any important data on the system before you being.

GENERIC INSTALL

   Required Packages:

      vPostMaster requires the following packages (and their associated
      dependencies) to be successfully installed:

         Apache
         Dovecot (POP/IMAP server)
         PHP (built with PostgreSQL enabled)
         Postfix (built with PostgreSQL enabled)
         PostgreSQL
         Psycopg
         PyDNS
         PySPF
         Python
         SpamAssassin
         SquirrelMail
         sudo
         Cyrus SASL

   Installing vPostMaster:

      The packages assume installation in /usr/lib instead of /usr/local.
      Search the distribution files for "/usr" for places to change if you
      put them elsewhere.

      These instructions assume the following directories are being used
      for the installation.  Please change the locations below if this is
      not the case:

         /usr/lib/vpostmaster -- Programs and data files.
         /var/spool/vpostmaster -- E-mail storage.
         /var/www/html/vpostmaster -- Web management console (should be
               under the Apache document root).

      Create a vpostmaster user:  useradd -r vpostmaster

      Create the directory structure:

         mkdir -p /usr/lib/vpostmaster/bin
         mkdir -p /usr/lib/vpostmaster/lib
         mkdir -p /usr/lib/vpostmaster/etc
         mkdir -p /usr/lib/vpostmaster/postfix
         mkdir -p /var/spool/vpostmaster/domains

      Install the vPostMaster software:

         install -m 755 vpm-pfpolicy vpm-pftransport vpm-pgmaintain vpmsupp.py \
               /usr/lib/vpostmaster/lib/
         install -m 755 vpm-wwwhelper /usr/lib/vpostmaster/bin/
         install -m 640 wwwdb.conf-dist /usr/lib/vpostmaster/etc/wwwdb.conf
         install -m 644 vpostmaster-www/*.php /var/www/html/vpostmaster/
         install -m 644 vpostmaster-www/*.png /var/www/html/vpostmaster/
         install -m 644 vpostmaster-www/*.ico /var/www/html/vpostmaster/

      Generate passwords for several PostgreSQL users (these will only be
      used by the software internally, so there's no reason not to make
      them long and strong), and the encrypted password for your web
      management session.  Fill them in as environment variables here:

         PASSWORD_POSTFIX=
         PASSWORD_VPOSTMASTER=
         PASSWORD_VPOSTMASTERWWW=
         PASSWORD_IMAPSERVER=

      The supervisor password needs to be encrypted.  "htpasswd" is a good
      way to do this:

         guin:vpostmaster$ htpasswd -c /dev/tty root
         New password: 
         Re-type new password: 
         Adding password for user root
         root:Jz/bBjocdazNs
         guin:vpostmaster$ CRYPTED_SUPERUSER=Jz/bBjocdazNs

      Notice that only the last part after "root:" is used as the crypted
      password.

      Additionally, you will need to know the UID and GID assigned to the
      vpostmaster user:

         guin:vpostmaster$ grep vpostmaster /etc/passwd
         vpostmaster:x:100:101::/home/vpostmaster:/bin/bash
         guin:vpostmaster$ VPOSTMASTER_UID=100
         guin:vpostmaster$ VPOSTMASTER_GID=101

      Set up the PostgreSQL database.  On default Red Hat and similar
      installs, only the "postgres" user has the ability to do these tasks,
      so you will probably have to "su postgres" (or similar) before
      running the "psql" commands.

         Make sure PostgreSQL is running.

         Make sure the "tcpip_socket" value in
         "/var/lib/pgsql/data/postgresql.conf is set to "true" and is
         uncommented.

         Ensure that local TCP/IP connections can authenticate using
         passwords by adding the following line to
         "/var/lib/pgsql/data/pg_hba.conf":

            host all all 127.0.0.1 255.255.255.255 password

         Re-start the PostgreSQL daemon.

         Create the PostgreSQL users in the database.  This may need to be
         run as the "postgres" user:

            createdb vpostmaster
            psql -d vpostmaster -c "CREATE USER postfix WITH PASSWORD
                  '${PASSWORD_POSTFIX}' NOCREATEDB NOCREATEUSER;"
            psql -d vpostmaster -c "CREATE USER vpostmaster WITH PASSWORD
                  '${PASSWORD_VPOSTMASTER}' NOCREATEDB NOCREATEUSER;"
            psql -d vpostmaster -c "CREATE USER vpostmasterwww WITH PASSWORD
                  '${PASSWORD_VPOSTMASTERWWW}' NOCREATEDB NOCREATEUSER;"
            psql -d vpostmaster -c "CREATE USER imapserver WITH PASSWORD
                  '${PASSWORD_IMAPSERVER}' NOCREATEDB NOCREATEUSER;"
            #  run shell script which loads the schema
            /path/to/vpostmaster/sources/schema.sql
            psql -d vpostmaster -c "INSERT INTO adminusers ( name,
                  issuperuser, cryptedpasswd ) VALUES ( 'superuser', 't',
                  '$CRYPTED_SUPERUSER' );"

      Set up the passwords in their appropriate configuration files:

         Create /usr/lib/vpostmaster/etc/wwwdb.conf, and change it to have
         group read permission by the Apache server.  You can find the
         group which the web server runs as by looking for the "Group"
         line in the Apache config file.

            echo "dbname=vpostmaster host=127.0.0.1 user=vpostmasterwww " \
               "password=${PASSWORD_VPOSTMASTERWWW}" \
               >/usr/lib/vpostmaster/etc/wwwdb.conf
            chown root:apache /usr/lib/vpostmaster/etc/wwwdb.conf
            chmod 440 /usr/lib/vpostmaster/etc/wwwdb.conf

         Place the following in the Dovecot SQL file
         "/etc/dovecot-pgsql.conf" (with $ variables expanded to the
         appropriate value):

            connect = host=localhost dbname=vpostmaster user=imapserver password=$PASSWORD_IMAPSERVER
            default_pass_scheme = CRYPT
            password_query = SELECT users.cryptedpasswd AS password FROM users WHERE users.name = '%n' AND users.domainsname = '%d'
            user_query = SELECT userdir AS home, $VPOSTMASTER_UID AS uid, $VPOSTMASTER_GID AS gid FROM users WHERE users.name = '%n' AND users.domainsname = '%d'
         Long lines must not be broken up.  Now, change the permissions on
         it:

            chown root /etc/dovecot-pgsql.conf
            chmod 400 /etc/dovecot-pgsql.conf

         Write the Postfix PostgreSQL file, "/etc/postfix/vpm-domains",
         again substituting the appropriate $ variables:

            user=postfix
            password=${PASSWORD_POSTFIX}
            hosts=localhost
            dbname=vpostmaster
            table=domains
            select_field='X'"
            where_field=name"
            additional_conditions = and active = 't'

         And change the permissions:

            chown root /etc/postfix/vpm-domains
            chmod 400 /etc/postfix/vpm-domains

      Re-start Apache.

      Web helper:

         Set up sudo to allow the Apache user to run the vPostMaster helper
         as the "vpostmaster" user.  The "apache" string must be the actual
         user name which your web server runs as.  See the "User" line
         in your Apache configuration file for the exact value.  Then run
         "visudo" and add the following lines to the file:

            #  vpostmaster helper, allow Apache to run it as vpostmaster
            apache   ALL=(vpostmaster) NOPASSWD: /usr/lib/vpostmaster/bin/vpm-wwwhelper

         This helper allows the vPostMaster web control panel to create
         new users home directories.  Without this, an error will be
         displayed during user creation, and the user will not be able to
         log in via POP or IMAP until they receive an incoming message.
         In the future this helper may also be used to display current
         quota information.

      Set up Postfix:

         The following lines must be added to the "/etc/postfix/main.cf"
         file:

            #  vPostMaster setup
            inet_interfaces = all
            virtual_transport = vpm-pftransport
            virtual_mailbox_domains = pgsql:/etc/postfix/vpm-domains
            smtpd_sasl_auth_enable = yes
            smtpd_sasl_application_name = smtpd
            broken_sasl_auth_clients = yes
            #always_bcc = archive_address@example.com

            smtpd_recipient_restrictions =
               permit_sasl_authenticated
               check_policy_service unix:private/vpm-pfpolicy
               reject_unauth_destination

         The following lines must be added to the "/etc/postfix/master.cf"
         file:

            #  vPostMaster setup
            vpm-pfpolicy  unix  -       n       n       -       -       spawn
              user=vpostmaster argv=/usr/lib/vpostmaster/postfix/vpm-pfpolicy
            vpm-pftransport unix  -       n       n       -       -       pipe
                flags=Fqhu user=vpostmaster argv=/usr/lib/vpostmaster/postfix/vpm-pftransport $sender $recipient

         The long lines must not be broken.

         Re-start your Postfix daemon.

      Dovecot configuration:

         Add the following lines to the end of the "/etc/dovecot.conf":

         #  vPostMaster Configuration
         default_mail_env = maildir:~/Maildir/
         auth_userdb = pgsql /etc/dovecot-pgsql.conf
         auth_passdb = pgsql /etc/dovecot-pgsql.conf
         first_valid_uid = 100

      Re-start the Dovecot daemon.

   Further things:

      Don't forget to make sure that all the daemons start on a reboot.
      Now is a good time to do that.  The daemons that are required include
      Postfix, Dovecot, Apache, and PostgreSQL.

SUPPORT
   
   If you run into trouble with vPostMaster, support is available from
   tummy.com's experienced system administrators. 
   
   Commercial Licenses include support.

   Paid support is available for free, non-commercial installations.

FINAL THOUGHTS
   
   There are support forums available for vPostMaster users. 

   If you have questions with either the non-commercial or commercial
   version please contact us through our secure webform at
   https://secure.tummy.com/Company/contactus.html/
   or by email to info@tummy.com