Search:  
Gentoo Wiki

HOWTO_Install_Kerio_Mailserver

Normally, Kerio isn't supported on Gentoo, only on Redhat variants and SuSE..... this won't do. So, follow these directions to have this great mail server on your gentoo machine.

Be sure to emerge rpm RPM and all of the needed dependencies:

emerge rpm libstdc++-v3 lib-compat lib-compat-loki

Afterwards, download the latest version of the mail server from Kerio Mailserver's Website

Next, issue the following command :


rpm -Uvh --nodeps kerio-mailserver-x.x.x-linux.y.rpm

remembering to replace x.x.x with your version number and y with your arch type.

For example, for version 6.1.1 and arch type i386 (x86), you'd type

rpm -Uvh --nodeps kerio-mailserver-6.1.1-linux.i386.rpm

NOTICE
Please be sure to know that when you use the nodeps flag, all dependency checks are ignored, and it is your job to ensure those dependencies are met.

Next, replace the stock the init.d script with the one provided below.

File: /etc/init.d/keriomailserver
#!/sbin/runscript
#
# /etc/init.d/keriomailserver  Script to start and stop Kerio MailServer 


depend () {
        need net
}

start() {
        [ -f ${KERIO_DIR}/mailserver ] || eend "Kerio MailServer not installed"

        rm -f "${KERIO_PIDFILE}"
        ebegin "Starting Kerio MailServer: "
        ulimit -c unlimited
        ulimit -s 2048
        ulimit -n 4096

        if [ -f /usr/local/bin/.uniprodloc ] ; then
                if [ -d `cat /usr/local/bin/.uniprodloc` ] ; then
                        export LD_LIBRARY_PATH=`cat /usr/local/bin/.uniprodloc`/
ino/config:`cat /usr/local/bin/.uniprodloc`/ino/lib
                        . `cat /usr/local/bin/.uniprodloc`/scripts/envset
                fi
        elif [ -f /opt/CA/.uniprodloc ] ; then
                if [ -d `cat /opt/CA/.uniprodloc` ] ; then
                        export LD_LIBRARY_PATH=`cat /opt/CA/.uniprodloc`/ino/config:`cat /opt/CA/.uniprodloc`/ino/lib
                        . `cat /opt/CA/.uniprodloc`/scripts/envset
                fi
        fi

        start-stop-daemon --start --quiet --exec ${KERIO_DIR}/mailserver -- ${KERIO_DIR}
        eend $?
}

stop() {
        ebegin "Shutting down Kerio MailServer: "

        start-stop-daemon --stop --quiet --exec ${KERIO_DIR}/mailserver
        rm -f "${KERIO_PIDFILE}"

        eend $?
}




restart () {

        svc_stop
        sleep 5
        svc_start

}

Next, create a link for the configuration files (you may use my example for this as well)

File: /etc/conf.d/keriomailserver
# Config file for /etc/init.d/keriomailserver

KERIO_DIR=/opt/kerio/mailserver
KERIO_PIDFILE=/var/run/keriomailserver.pid


Second way: make ebuild

1) Create local portage overlay

mkdir /usr/local/portage/
echo PORTDIR_OVERLAY="/usr/local/portage" >> /etc/make.conf

2)

mkdir -p /usr/local/portage/net-mail/kerio-kms/files

touch /usr/local/portage/net-mail/kerio-kms/kerio-kms-6.3.1.2402.ebuild
touch /usr/local/portage/net-mail/kerio-kms/files/keriomailserver.init
touch /usr/local/portage/net-mail/kerio-kms/files/keriomailserver.conf

3)

File: /usr/local/portage/net-mail/kerio-kms/files/keriomailserver.conf
# Config file for /etc/init.d/keriomailserver

KERIO_DIR=/opt/kerio/mailserver
KERIO_PIDFILE=/var/run/keriomailserver.pid

4)

File: /usr/local/portage/net-mail/kerio-kms/files/keriomailserver.init
All lines form /etc/init.d/keriomailserver box

5)

File: /usr/local/portage/net-mail/kerio-kms/kerio-kms-6.3.1.2402.ebuild
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header:  $

inherit eutils versionator rpm

MY_PV=$(replace_version_separator 3 -)

IUSE="sendmail"
DESCRIPTION="Kerio MailServer"
SRC_URI="http://eu.download.kerio.com/dwn/kms/${PN}-${MY_PV}.linux.i386.rpm"
HOMEPAGE="http://www.kerio.com/"
SLOT="0"
LICENSE="Kerio"
KEYWORDS="~x86"
RESTRICT="nomirror"
DEPEND=">=sys-libs/libstdc++-v3-3.3.6"
PROVIDE="virtual/mta"

src_unpack() {
	rpm_src_unpack
}

src_install() {
	mv ${WORKDIR}/opt ${D}
	
	newinitd ${FILESDIR}/keriomailserver.init keriomailserver
	newconfd ${FILESDIR}/keriomailserver.conf keriomailserver
	
	if use sendmail; then
		dosym /opt/kerio/mailserver/sendmail /usr/sbin/sendmail
	fi
}

pkg_postinst() {
	einfo
	einfo 'Kerio MailServer installed'
	einfo
	einfo 'Run /opt/kerio/mailserver/cfgwizard for setup'
	einfo
}

6)

ebuild /usr/local/portage/net-mail/kerio-kms/kerio-kms-6.3.1.2402.ebuild digest
emerge kerio-kms

You can copy ebuild file for "6.2.0.1254", "6.3.0.2132", "6.3.1.2402", "6.4.0.3364" and next versions

For 6.4.1.3679 you can insert in .ebuild file after rpm_src_unpack new line with "chmod -R go-w ${WORKDIR}/opt/kerio/mailserver/"

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Install_Kerio_Mailserver"

Last modified: Sun, 28 Oct 2007 18:55:00 +0000 Hits: 6,537