Installation:Ubuntu:Courier

From PMWH2 - PHPMyWebHosting's official wiki
Revision as of 08:50, 18 March 2008 by Chris (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
up

On Ubuntu 7.10 Server you need to install the following packages:

  • courier-authdaemon
  • courier-authlib-mysql (mySQL)
  • courier-authlib-postgresql (postgreSQL)
  • 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 Ubuntu 7.10 Server use this command to install all at once: MySQL

sudo apt-get install courier-authdaemon courier-authlib-mysql courier-base courier-pop courier-pop-ssl courier-imap courier-imap-ssl

PostgresQL

sudo apt-get install courier-authdaemon  courier-authlib-postgresql 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/PostgreSQL.

The final step is now to tell the Courier POP3 daemon to use MySQL/PostgreSQL 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 (mySQL)

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 239
Server version: 5.0.45-Debian_1ubuntu3.1-log Debian etch distribution

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

mysql> GRANT SELECT on pmwh2.postfix_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)

MYSQL_SERVER localhost
MYSQL_USERNAME courier_user
MYSQL_PASSWORD courier_password
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE pmwh2
MYSQL_USER_TABLE postfix_users
MYSQL_CRYPT_PWFIELD password  #(comment this out if you use clear passwords)
#MYSQL_CLEAR_PWFIELD password #(un-comment this if you use clear passwords)
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

/etc/courier/authdaemonrc (PostgreSQL)

comming soon

/etc/courier/authmysqlrc (mySQL)

comming soon

Finaly Do not forget to restart the authdaemon and imap process using

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

Configuration of Courier is done. next step using PowerDNS or next step using MyDNS