Installing POPFile on SuSE

General

This howto describes the process to successfully install POPFile on SuSE 9.1 Professional configured with the following options;

  1. POPFile listening on port 110 for POP3 connections with the UI on port 8080. This configuration requires POPFile run as superuser.
  2. POPFile started from an init.d script and servicing all users on the machine, this implies a shared corpus where all users share the same central corpus. It also implies shared message history in the UI. Due to the shared corpus and history, if privacy is a concern this setup should not be used.
  3. POPFile will be installed to the following directories;
    • /usr/share/popfile (the shared programs)
    • /var/lib/popfile (the shared data)
    • /var/log/popfile (popfile logs)

Step by Step Instructions

  • Download the Cross Platform zip package for the latest release of POPFile to your home directory, then issue the following shell commands to unzip the package into a popfile subdirectory;
mkdir popfile
unzip -d popfile popfile*.zip
  • Switch to the POPFile directory and issue the following shell commands after switching to superuser.
cd popfile
su
mkdir /usr/share/popfile
mkdir /var/lib/popfile
mkdir /var/log/popfile
cp *.gif *.pl *.png *.ico /usr/share/popfile/
cp stopwords /usr/share/popfile/
cp license /usr/share/popfile/
cp v*.change /usr/share/popfile/
chmod +x /usr/share/popfile/*.pl 
cp -Rf Classifier /usr/share/popfile/
cp -Rf POPFile /usr/share/popfile/
cp -Rf Proxy /usr/share/popfile/
cp -Rf UI /usr/share/popfile/
cp -Rf languages /usr/share/popfile/
cp -Rf manual /usr/share/doc/popfile/
cp -Rf skins /usr/share/popfile/
  • Create wrapper scripts for the POPFile programs, save the scripts in /usr/sbin/
    • popfile-bayes
  -!/bin/sh
cd /usr/share/popfile
export POPFILE_ROOT=/usr/share/popfile
export POPFILE_USER=/var/lib/popfile
umask 0027
exec /usr/share/popfile/bayes.pl "$@"
  • popfile-insert
  -!/bin/sh
cd /usr/share/popfile
export POPFILE_ROOT=/usr/share/popfile
export POPFILE_USER=/var/lib/popfile
umask 0027
exec /usr/share/popfile/insert.pl "$@"
  • popfile-pipe
  -!/bin/sh
cd /usr/share/popfile
export POPFILE_ROOT=/usr/share/popfile
export POPFILE_USER=/var/lib/popfile
umask 0027
exec /usr/share/popfile/pipe.pl "$@"
  • popfile
  -!/bin/sh
cd /usr/share/popfile
export POPFILE_ROOT=/usr/share/popfile
export POPFILE_USER=/var/lib/popfile
umask 0027
exec /usr/share/popfile/popfile.pl "$@" --set config_piddir=/var/run/ --set logger_logdir=/var/log/popfile/
  • Make the wrapper scripts executable
chmod +x /usr/sbin/popfile*
  • Put the following init.d script in /etc/init.d/ with the filename popfile
  #!/bin/sh
  #
  # This program is free software; you can redistribute it and/or
  # modify it under the terms of the GNU General Public License
  # as published by the Free Software Foundation; either
  # version 2 of the License, or (at your option) any later
  # version.
  #
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU General Public License
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  #
  # Copyright (c) 2003 John Graham-Cumming
  #
  # ===
  #
  # popfile
  #
  # A shell script designed to start and stop POPFile from within
  # /etc/init.d on *nix systems.
  #
  # usage: popfile { start | stop | restart | }

  #
  # RedHat comment block...
  #
  # chkconfig: 345 80 20
  # description: popfile is a POP3 proxy and mail filter
  # pidfile: /var/run/popfile.pid
  # processname: popfile
  #

  #
  # LSB comment block...
  #

  #
      # BEGIN INIT INFO
  # Provides: popfile
  # Required-Start: $network
  # Required-Stop: $network
  # Default-Start: 3 4 5
  # Default-Stop: 3 4 5
  # Description: popfile is a POP3 proxy and mail filter
      # END INIT INFO
    #

popfile_root=/usr/share/popfile
popfile_user=/var/lib/popfile
popfile="${popfile_root}/popfile.pl"
cwd=`pwd`
popfile_pid="/var/run/popfile.pid"
pid=`cat ${popfile_pid} 2> /dev/null`

start() {
   echo -n "Starting POPFile as background process: "
   if [ "${pid}" = "" ] ; then
       cd ${popfile_root}
       export POPFILE_ROOT=${popfile_root}
       export POPFILE_USER=${popfile_user}
       ${popfile} --set config_piddir=/var/run/ --set logger_logdir=/var/log/popfile/ &> /var/log/popfile/popfile &
       echo " done"
   else
       echo " POPFile already running"
   fi
}

stop() {
   echo -n "Stopping POPFile: "

   if [ "${pid}" = "" ] ; then
       echo "POPFile not running"
   else
       kill $pid
       if [ -e $popfile_pid ] ; then
          rm ${popfile_pid}
       fi
       pid=""
       echo " done"
   fi
}

status() {
   if [ "${pid}" = "" ] ; then
       echo "down"
   else
       echo "up"
   fi
}

case $1 in
   start)
       start
       ;;
   stop)
       stop
       ;;
   restart)
       stop
       start
       ;;
   status)
       status
       ;;
   *)
       echo $"Usage: $0 {start|stop|restart|status}"
       exit 1
       ;;
esac

cd $cwd
exit 0

  • Install the init.d service
chmod +x /etc/init.d/popfile
insserv /etc/init.d/popfile
  • Create a symbolic link to rcpopfile
ln -s /etc/init.d/popfile /usr/sbin/rcpopfile
  • Startup POPFile
rcpopfile start
  • Test the UI, from your browser, visit the url http://127.0.0.1:8080 . If the UI doesn't work, review the installation steps carefully and check the TroubleShooting page of the Wiki.
  • Cleanup, delete the downloaded source package from your home directory. Make sure you have exited superuser mode before doing this.
cd ~
rm -Rf popfile
rm popfile*.zip

Configuring the Mail Client

There are two ways that POP3 mail is typically configured under SuSE;

  1. The mail client, KMail, retrieves direct from the ISP via POP3. If you are using this method, follow the general POPFile instructions for configuring your mail client, e.g., change the server to 127.0.0.1 and the account to realserver.com:username
  2. Fetchmail is frequently used to poll POP3 accounts in the background and deliver the mail to local maildirs where the mail client then retrieves the mail. To configure fetchmail for POPFile, follow these steps;
    1. edit /etc/fetchmailrc
    2. change the polling lines that are pop3 to the following format, where realserver.com is your real mail server and username is your real username.
      • was
 poll "realserver.com" protocol POP3 : user "username" there with password "secret" is "mylocalname" here
  • change to
 poll "localhost" protocol POP3 : user "realserver.com:username" there with password "secret" is "mylocalname" here
  1. restart fetchmail to make your change go into effect
rcfetchmail restart
 
howtos/suse.txt · Last modified: 2008/02/08 19:49 (external edit)

Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.

Recent changes RSS feed Donate Driven by DokuWiki
The content of this wiki is protected by the GNU Fee Documentation License