프리이미지
사이트 내 전체검색

[팁] [Webmail] COURIER IMAP 설치

페이지 정보

작성일11-09-15 20:59

본문

Courier-IMAP is an IMAP server. Having an IMAP server is a prerequisite to be able run a IMAP-client WebMail system like SquirrelMail. Courier-IMAP is good choice because it has support for vpopmail authentication and maildir mailboxes.
Download and unpack the authentication library
cd /usr/local/src
wget http://optusnet.dl.sourceforge.net/sourceforge/courier/courier-authlib-0.58.tar.bz2
bunzip2 courier-authlib-0.58.tar.bz2
tar xf courier-authlib-0.58.tar
chown -R root.root courier-authlib-0.58
cd courier-authlib-0.58
Build the authentication library
./configure \
  --prefix=/usr/local/courier-authlib \
  --without-authpam \
  --without-authldap \
  --without-authpwd \
  --without-authmysql \
  --without-authpgsql \
  --without-authshadow \
  --without-authuserdb \
  --without-authcustom \
  --without-authcram \
  --without-authpipe \
  --with-authdaemon \
  --with-authvchkpw 
# note, if you are running redhat/fedora, you may have to add a 
#   --with-redhat
# to the list of configuration settings above
make
make install
make install-configure
Review the settings for the authentication library
vi /usr/local/courier-authlib/etc/authlib/authdaemonrc
authmodulelist="authvchkpw"  <-- Authenticate via vpopmail
Configure the authentication library so it is running all the time from bootup onwards
cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
chmod 744 /etc/rc.d/init.d/courier-authlib
chkconfig --add courier-authlib
Then I like to use the ntsysv program to double-check that courier-authlib is set to launch at boot time
If you aren't ready to reboot the server now, you can fire up the authentication libraries in the mean time with this command :
/etc/rc.d/init.d/courier-authlib start 
At this point the courier-authlib software should be running. A good way to verify this is to use this command :
ps axf
And if all is well, you should be able to see something like this :
23689 ? S 0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/
23690 ? S 0:00  \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
23702 ? S 0:00      \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
23703 ? S 0:00      \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
23704 ? S 0:00      \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
23705 ? S 0:00      \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
23706 ? S 0:00      \_ /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
FAM + Courier-IMAP on Redhat 7.3 doesnt seem very stable. On old Linux platforms, I would recommend you remove FAM before trying to install Courier-IMAP ( By the way, the alternative/replacement package GAMIN seems to works OK with Courier-IMAP on newer platforms like FC4/FC5/CentOS43)
rpm -e fam fam-devel
Download and unpack the courier-IMAP source
cd /usr/local/src
wget http://optusnet.dl.sourceforge.net/sourceforge/courier/courier-imap-4.1.1.tar.bz2
bunzip2 courier-imap-4.1.1.tar.bz2
tar xf courier-imap-4.1.1.tar
chown -R root.root courier-imap-4.1.1
cd courier-imap-4.1.1
Build the program
COURIERAUTHCONFIG=/usr/local/courier-authlib/bin/courierauthconfig \
CPPFLAGS=-I/usr/local/courier-authlib/include \
./configure \
  --prefix=/usr/local/courier-imap \
  --disable-root-check \
  --with-ssl
# note, if you are running redhat/fedora, you may have to add a 
#   --with-redhat
# to the list of configuration settings above
make
make install
make install-configure
The Courier-IMAP package includes 4 servers that can be individually enabled/disabled : IMAP, IMAP-SSL, POP3, POP3SSL. In this example, we are only using the IMAP server.
vi /usr/local/courier-imap/etc/imapd
MAXDAEMONS=40
MAXPERIP=40
IMAP_EMPTYTRASH=Trash:7,Sent:30
IMAPDSTART=YES
<-- Max number of IMAP daemons
<-- All connections will be coming from single IP (SquirrelMail on localhost)
<-- Enable automatic purging of mail from these folders
<-- allow our init.d script-x (below) to boot up the imapd
Configure Courier-IMAP so it is running all the time from bootup onwards
cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
chmod 744 /etc/rc.d/init.d/courier-imap
chkconfig --add courier-imap
Then I like to use the ntsysv program to double-check that courier-imap is set to launch at boot time
If you aren't ready to reboot the server now, you can fire up Courier-IMAP in the mean time with this command :
/etc/rc.d/init.d/courier-imap start 
At this point the Courier-IMAP software should be running. A good way to verify this is to use this command :
ps axf
And if all is well, you should be able to see something like this :
1030 ? S 0:02 /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
1031 ? S 1:00  \_ /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
1032 ? S 0:59  \_ /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
1033 ? S 1:01  \_ /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
1035 ? S 1:02  \_ /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
1036 ? S 1:02  \_ /usr/local/courier-imap/libexec/authlib/authdaemond.plain start
17566 ? S 0:00 /usr/local/courier-imap/libexec/couriertcpd -address=0 -stderrlogger=/usr/local/courier-
17569 ? S 0:00 /usr/local/courier-authlib/sbin/courierlogger imapd



------------------------------다른 방법 ---------------------------------------

1. ( courier-authlib )

# tar xvf courier-authlib-0.57.20050930.tar
# chown -R root.root courier-authlib-0.57.20050930
# cd courier-authlib-0.57.20050930
# ./configure \
--prefix=/usr/local/courier-authlib \
--without-authpam \
--without-authldap \
--without-authpwd \
--without-authmysql \
--without-authpgsql \
--without-authshadow \
--without-authuserdb \
--without-authcustom \
--without-authcram \
--without-authpipe \
--with-authvchkpw \
--with-redhat
(위에 컴파일방법이 되었다. 오래걸리고 같은것을 하는것 같으나 후에 끝났다.) 
(원래있는거대로 해야 설치가 된다.-.-)
# make
# make install
# make install-configure

# vi /usr/local/courier-authlib/etc/authlib/authdaemonrc
authmodulelist="authvchkpw"

# cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib
# chmod 755 /etc/rc.d/init.d/courier-authlib

2. ( courier-imap-4.0.6 )

# tar xvf courier-imap-4.0.6.tar
# chown -R root.root courier-imap-4.0.6
# su test -> 일반유저로 로그인
# cd courier-imap-4.0.6
# CFLAGS="-DHAVE_OPEN_SMTP_RELAY"; export CFLAGS 

#./configure \
--prefix=/usr/local/courier-imap \
--disable-root-check \
--with-ssl \
--with-redhat
# make
# make check  =>컴파일 이상 없이 되었는지 체크
------- 일반유저 작업완료 ---------------------------

# find /* > /root/courier-imap1
# make install-strip  ->실제 설치 시작
# make install-configure  ->설정 파일 설치
# find /* > /root/courier-imap2
# diff /root/courier-imap1 /root/courier-imap2 > courier-imap-install

# cp -f courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
# chown root.root /etc/rc.d/init.d/courier-imap
# chmod 700 /etc/rc.d/init.d/courier-imap

# vi /etc/rc.d/init.d/courier-imap
--------------------- /etc/rc.d/init.d/courier-imap  start ---------------------------------
#!/bin/sh
#
# This is a sample /etc/init.d file for Courier-IMAP
#
# chkconfig: 2345 80 30
# descript-xion: Courier-IMAP - IMAP server
#
#
#
prefix=/usr/local/courier-imap
exec_prefix=/usr/local/courier-imap
bindir=${exec_prefix}/bin
sbindir=${exec_prefix}/sbin
case "$1" in
start)
       cd /
       . ${prefix}/etc/imapd
       touch /var/lock/subsys/courier-imap
       echo -n "Starting Courier-IMAP server:"
       case x$IMAPDSTART in
       x[yY]*)
               # Start daemons.
               /usr/local/courier-imap/libexec/imapd.rc start
               echo -n " imap"
               ;;
       esac
       . ${prefix}/etc/imapd-ssl
       case x$IMAPDSSLSTART in
       x[yY]*)
               if test -x $COURIERTLS
               then
               # First time we start this, generate a dummy SSL certificate.
                       if test ! -f $TLS_CERTFILE
                       then
                               echo -n " generating-SSL-certificate..."
                               ${prefix}/share/mkimapdcert >/dev/null 2>&1
                       fi
                       /usr/local/courier-imap/libexec/imapd-ssl.rc start
                       echo -n " imap-ssl"
               fi
               ;;
       esac
       echo ""
       ;;
stop)
       echo -n "Stopping Courier-IMAP server:"
       . ${prefix}/etc/imapd
       . ${prefix}/etc/imapd-ssl
       /usr/local/courier-imap/libexec/imapd.rc stop
       echo -n " imap"
       if test -x $COURIERTLS
       then
               /usr/local/courier-imap/libexec/imapd-ssl.rc stop
               echo -n " imap-ssl"
       fi
       echo ""
       rm -f /var/lock/subsys/courier-imap
       ;;
restart)
       $0 stop
       $0 start
       ;;
esac
exit 0
-------------------- /etc/rc.d/init.d/courier-imap  end -----------------------------------

# chkconfig --add courier-imap
# chkconfig --level 345 courier-imap on

# vi /usr/local/courier-imap/etc/imapd
ADDRESS=192.100.10.43
.......................
IMAPDSTART=YES


--------------------또다른 설치방법 -------------------------------------------
### courier-authlib-0.57 설치 ### 
cd courier-authlib-0.57 

./configure  --prefix=/usr/local/courier-authlib --with-redhat 
(default 로 설정하기 위해서 위의 옵션만 주면 된다) 
make 
make install 
make install-configure 

vi /usr/local/courier-authlib/etc/authlib/authdaemonrc 
   authmodulelist="authvchkpw" 

cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib 
chmod 744 /etc/rc.d/init.d/courier-authlib 
chkconfig --add courier-authlib 
/etc/rc.d/init.d/courier-authlib start 

[root@zosen courier-authlib-0.57]# pstree 
init-+-courierlogger---authdaemond---5*[authdaemond] 

[root@zosen courier-authlib-0.57]# ps aux | grep courier 
root      4192  0.0  0.1  2160  452 ?        S    10:35  0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/authdaemon/pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4193  0.0  0.3  4204  776 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4194  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4195  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4196  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4197  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4198  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4273  0.0  0.2  5860  684 pts/0    R+  10:36  0:00 grep courier

### courier-imap-4.0.6 설치 ### 

cd /usr/local/src 
wget http://optusnet.dl.sourceforge.net/sourceforge/courier/courier-imap-4.0.6.tar.bz2 
tar jvxf courier-imap-4.0.6.tar.bz2 
chown -R root.root courier-imap-4.0.6 
cd courier-imap-4.0.6 

COURIERAUTHCONFIG=/usr/local/courier-authlib/bin/courierauthconfig 
CPPFLAGS=-I/usr/local/courier-authlib/include 
./configure --prefix=/usr/local/courier-imap --disable-root-check --with-redhat 

make 
make install 
make install-configure 

vi /usr/local/courier-imap/etc/imapd 

MAXDAEMONS=40 
MAXPERIP=40 
IMAP_EMPTYTRASH=Trash:7,Sent:30 
IMAPDSTART=YES 

cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap 
chmod 744 /etc/rc.d/init.d/courier-imap 
chkconfig --add courier-imap 
/etc/rc.d/init.d/courier-imap start 

[root@zosen courier-imap-4.0.6]# pstree 
init-+-courierlogger---authdaemond---5*[authdaemond] 
   |-courierlogger---couriertcpd 

[root@zosen courier-imap-4.0.6]# ps aux | grep courier 
root      4192  0.0  0.1  2160  452 ?        S    10:35  0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/authdaemon/pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4193  0.0  0.3  4204  776 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4194  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4195  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4196  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4197  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root      4198  0.0  0.3  4204  780 ?        S    10:35  0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond 
root    11701  0.0  0.1  1592  388 ?        S    11:17  0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/var/run/imapd.pid -start -name=imapd /usr/local/courier-imap/libexec/couriertcpd -address=0 -maxprocs=40 -maxperip=40 -nodnslookup -noidentlookup 143 /usr/local/courier-imap/sbin/imaplogin /usr/local/courier-imap/bin/imapd Maildir 
root    11702  0.0  0.1  3164  468 ?        S    11:17  0:00 /usr/local/courier-imap/libexec/couriertcpd -address=0 -maxprocs=40 -maxperip=40 -nodnslookup -noidentlookup 143 /usr/local/courier-imap/sbin/imaplogin /usr/local/courier-imap/bin/imapd Maildir 
root    11812  0.0  0.2  5796  704 pts/0    R+  11:17  0:00 grep courier 

[root@zosen courier-imap-4.0.6]# netstat -anp | grep LISTEN 
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN      1552/mysqld 
tcp        0      0 0.0.0.0:110                0.0.0.0:*                  LISTEN      18663/tcpserver  -> vpopmail 로써 pop3확인 
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                  LISTEN      9097/httpd 
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                  LISTEN      1971/vsftpd 
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                  LISTEN      5812/sendmail: acce 
tcp        0      0 :::143                      :::*                        LISTEN      11702/couriertcpd  -> imap 확인. 
tcp        0      0 :::22                      :::*                        LISTEN      1951/sshd 
unix  2      [ ACC ]    STREAM    LISTENING    4558  2016/saslauthd      /var/run/saslauthd/mux 
unix  2      [ ACC ]    STREAM    LISTENING    4577  2029/dbus-daemon-1  /var/run/dbus/system_bus_socket 
unix  2      [ ACC ]    STREAM    LISTENING    1240384 4193/authdaemond    /usr/local/courier-authlib/var/spool/authdaemon/socket.tmp 
unix  2      [ ACC ]    STREAM    LISTENING    3738  1552/mysqld        /tmp/mysql.sock
게시물 검색