Installation:Debian:Courier

From PMWH2 - PHPMyWebHosting's official wiki
(Redirected from Installation:Courier)
Jump to: navigation, search
up

On Debian GNU/Linux you need to install the following packages:

  • courier-authdaemon
  • courier-authmysql
  • courier-base
  • courier-pop (for unencrypted POP3 access)
  • courier-pop-ssl (for SSL-encrypted POP3 access)
  • courier-imap (for unencrypted IMAP access)
  • courier-imap-ssl (for SSL-encrypted IMAP access)

On Debian GNU/Linux use this command to install all at once:

apt-get install courier-authdaemon courier-authmysql courier-base courier-pop courier-pop-ssl courier-imap courier-imap-ssl

Now we must configure the Courier POP3/IMAP daemon for use with MySQL.

The final step is now to tell the Courier POP3 daemon to use MySQL to access the username and password for authentication. First edit the file /etc/courier/authdaemonrc and change the directive authmodulelist to "authmysql" like this:

/etc/courier/authdaemonrc

authmodulelist="authmysql"

Then we create a mysql user who has read access to the users table:

bash #> mysql -u root -p mysql
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 32 to server version: 4.0.16-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT SELECT on pmwh.users to 'courier'@'localhost' identified by "courier-password";
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Then you need to define the fields of the MySQL database table in /etc/courier/authmysqlrc like this:

/etc/courier/authmysqlrc

MYSQL_SERVER [database server hostname]
MYSQL_USERNAME courier
MYSQL_PASSWORD courier-password
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE pmwh
MYSQL_USER_TABLE users
# MYSQL_CRYPT_PWFIELD
MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD uid
MYSQL_GID_FIELD gid
MYSQL_LOGIN_FIELD email
MYSQL_HOME_FIELD homedir
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD quota

Do not forget to restart the authdaemon and imap process using

bash #> /etc/init.d/courier-authdaemon restart && /etc/init.d/courier-imap restart

Courier is now configured and ready to use.