Some small hints about installing horde/imp on Redhat 7.2 [was : anyone have step-by-step instructions for IMP 3.0 on Redhat 7.2?]

Timo Boettcher spida@gmx.net
Tue, 19 Feb 2002 23:08:41 +0100


Ok, here we go.

I worked this up from my .bash_history, my memory and the INSTALL and
README files found everywhere. I'm not sure that this is the method I
used, since I made many mistakes and had to turn back, and just now my
installation isn't quiet working.
So: If something doesn't work or is stupid, please tell me.

Timo Boettcher

Some small hints about installing horde/imp on Redhat 7.2

Required:
- Some Linux box, preferrably with Redhat 7.2 since this was written with a Redhat 7.2 box as reference
- working make environment
- internet-connection (or at least, the posiibility to obtain the mentioned files)
- wget, ftpget
- perl
- [aspell]
- time, nerves
- a working backup (since I refuse to give any warranty about this, even that this does anything)
- everything I have forgotten


First get and install openssl. You'll need it for various things.
        cd /usr/src
        wget http://www.openssl.org/source/openssl-0.9.6c.tar.gz
        tar xvzf openssl-0.9.6c.tar.gz
        cd openssl-0.9.6c
        ./config
        make
        make test
        make install

Let's create some self-signed certificate.
        cd /usr/local/ssl/certs/
        openssl req -new -x509 -nodes -out imapd.pem -keyout imapd.pem -days 365

Get and install libmcrypt.
        cd /usr/src
        ftpget ftp://mcrypt.hellug.gr/pub/mcrypt/libmcrypt/libmcrypt-2.4.22.tar.gz
        tar xvzf libmcrypt-2.4.22.tar.gz
        cd libmcrypt-2.4.22
        ./configure
        make
        make check
        make install

Get and install OpenSSH, since the versions in most distributions are not up-to-date and are said to be insecure.
        cd /usr/src
        ftpget ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-3.0.2p1.tar.gz
        tar xvzf openssh-3.0.2p1.tar.gz
        cd openssh-3.0.2p1
        ./configure
        make
Doing "make install" will generate a new host-key
        make install
        
Get and install some smtp-mailserver. Sendmail seems to be quiet bugggy, so I decided in favor of postfix.
        cd /usr/src
        wget http://postfix.portal-to-web.de/dist/official/postfix-20010228-pl08.tar.gz
        tar xvzf postfix-20010228-pl08.tar.gz
        cd postfix-20010228-pl08
"make" will ask you some questions. The defaults were OK for me.
        make
        
to start postfix, upon each reboot, let some script call
        /usr/sbin/postfix start


If you want to use your mailserver with clients except horde/imp from anywhere out of the internet, you should put up some protective measures against being an "open-relay".
        cd /usr/src
        wget http://people.oven.com/bet/pop-before-smtp/pop-before-smtp-1.28.tar.gz
        tar xvzf pop-before-smtp-1.28.tar.gz
        cd pop-before-smtp-1.28
Install the script
        cp pop-before-smtp /usr/sbin/
Install the init-script 
        cp init-redhat-alex /etc/init.d/pop-before-smtp
        cd contrib
Get the necessary perl-modules
        ./getfromcpan
or
        perl -MCPAN -e 'install Time::HiRes'
        perl -MCPAN -e 'install File::Tail'
        perl -MCPAN -e 'install Date::Parse'
        perl -MCPAN -e 'install Net::Netmask'

Get an Imap-server (UW-Imapd includes the also-needed client-library)
        cd /usr/src
        ftpget ftp://ftp.cac.washington.edu/imap/imap-2001a.tar.Z
        tar xvzf imap-2001a.tar.Z
        cd imap-2001a/
        make slx PASSWDTYPE=pam SSLTYPE=unix
        touch /etc/cram-md5
        chmod 0600 /etc/cram-md5

Get a db to store your user-settings. I decided to use postgres, but it should work with mysql just as fine.
        cd /usr/src
        ftpget ftp://ftp.postgresql.org/pub/source/v7.2/postgresql-7.2.tar.gz
        tar xvzf postgresql-7.2.tar.gz
        cd postgresql-7.2
        ./configure --with-perl --with-openssl
        make
        make install
        mkdir /usr/local/pgsql/data
        chown postgres:postgres /usr/local/pgsql/data
        /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
        cd /etc/httpd/htdocs/horde/scripts/db/
        adduser postgres
        
Get a new apache-webserver
        cd /usr/src
        wget http://www.apache.org/dist/httpd/apache_1.3.23.tar.gz
        tar xvzf apache_1.3.23.tar.gz

Get a new php and prepare to install as dynamic module
        cd /usr/src
        wget http://www.php.net/do_download.php?download_file=php-4.1.1.tar.gz
        tar xvzf php-4.1.1.tar.gz
        cd php-4.1.1
        ./configure --with-apxs=/usr/local/apache/bin/apxs --with-gettext --enable-track-vars --with-xml --with-pgsql --with-mcrypt --with-imap
        make
        make install
Make sure that the max attachment-size in /etc/php.ini is set to something reasonable
        upload_max_filesize = 20M

Build apache with the PHP module 
        cd apache_1.3.23
        ./configure --activate-module=src/modules/php4/libphp4.a --enable-module=rewrite --enable-shared=rewrite
        make
        make install
Open /etc/httpd/conf/httpd.conf with your favorite editor and make sure that the following settings are set.
        AddModule modules/php4/libphp4.a
        
        ServerName www.yourserver.net
        
        DocumentRoot "/etc/httpd/htdocs"
        
        DirectoryIndex index.php
        
        AddType application/x-httpd-php .php
Save and close

Update Pear (some shared php-code)      
        cd /usr/src
        ftpget ftp://ftp.horde.org/pub/horde/tarballs/pear-4.1.0.tar.bz2
        cd pear-4.1.0
        cp * /usr/local/lib/php

Get extremly latest horde/turba/imp versions from cvs
        cd /etc/httpd/htdocs
        cvs -d anoncvs@anoncvs.uk.horde.org:/cvs co -r RELENG_2 horde
        cd horde
        cvs -d anoncvs@anoncvs.uk.horde.org:/cvs co -r RELENG_3 imp
        cvs -d anoncvs@anoncvs.uk.horde.org:/cvs co -r RELENG_1 turba

        cd config/
        for foo in *.dist; do cp $foo `basename $foo .dist`; done
        
Open horde.php with your favorite editor and set
        $conf['auth']['driver'] = 'imap';
        
        $conf['auth']['params']['dsn'] = '{www.yourserver.net/imap:143}INBOX';
        
        $conf['prefs']['driver'] = 'sql';
        
        $conf['prefs']['params']['phptype'] = 'pgsql';
        $conf['prefs']['params']['hostspec'] = 'localhost';
        $conf['prefs']['params']['username'] = 'horde';
        $conf['prefs']['params']['password'] = 'yourpgsqlpassword';
        $conf['prefs']['params']['database'] = 'horde';
        $conf['prefs']['params']['table'] = 'horde_prefs';
        
        $conf['category']['driver'] = 'none';
        
        $conf['mailer']['params'] = array('sendmail_path' => '/usr/libexec/postfix/smtp');
Save and Close.

Open lang.php with your favorite editor and set your default language
        $nls['defaults']['language'] = 'de_DE';
Save and Close.

Open registry.php with your favorite editor and comment _in_ everything about imp and turba
Change login to imp, or you'll have to login twice
        $this->registry['auth']['login'] = 'imp';
        $this->registry['auth']['logout'] = 'imp';
        
        $this->registry['mail']['compose'] = 'imp';
        $this->registry['mail']['composePopup'] = 'imp';
        
        $this->registry['contacts']['search'] = 'turba';
        $this->registry['contacts']['add'] = 'turba';
        $this->registry['contacts']['sources'] = 'turba';
        $this->registry['contacts']['fields'] = 'turba';
                
        $this->applications['imp'] = array(
            'fileroot' => dirname(__FILE__) . '/../imp',
            'webroot' => $this->applications['horde']['webroot'] . '/imp',
            'icon' => '/horde/imp/graphics/imp.gif',
            'name' => _("Mail"),
            'allow_guests' => false,
            'show' => true
        );
        
        $this->applications['turba'] = array(
            'fileroot' => dirname(__FILE__) . '/../turba',
            'webroot' => $this->applications['horde']['webroot'] . '/turba',
            'icon' => '/horde/turba/graphics/turba.gif',
            'name' => _("Addressbook"),
            'allow_guests' => false,
            'show' => true
        );


Save and Close.

        cd ../imp/config/
        for foo in *.dist; do cp $foo `basename $foo .dist`; done
        
Open registry.php with your favorite editor and add your server. Comment out everything else
        $servers['_prompt'] = array(
            'name' => 'Choose a mail server:'
        );

        $servers['yourserver'] = array(
            'name' => 'yourserver.net',
            'server' => 'localhost',
            'protocol' => 'imap',
            'port' => 143,
            'folders' => 'mail/',
            'namespace' => '',
            'maildomain' => 'yourserver.net',
            'smtphost' => 'localhost',
            'realm' => 'yourserver.net',
            'preferred' => ''
        );
        
Save and close

Open conf.php with your favorite editor
        $conf['utils']['spellchecker'] = '/usr/bin/aspell';
Save and Close  

Initiallize the db
        su postgres
        /usr/local/pgsql/bin/createuser -P -D -A horde
Enter yourpgsqlpassword from /etc/httpd/horde/conf/horde.php when asked
        /usr/local/pgsql/bin/psql -d horde -U horde -f /etc/httpd/htdocs/horde/scripts/db/auth.sql
        /usr/local/pgsql/bin/psql -d horde -U horde -f /etc/httpd/htdocs/horde/scripts/db/prefs.sql
        /usr/local/pgsql/bin/psql -d horde -U horde -f /etc/httpd/htdocs/horde/scripts/db/category.sql
        logout
to start postgres, upon each reboot, let some script call
        su postgres -c"/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data &"