RHEL 4.1 + courier-imap + Postfix + MySQL + extmail + extman

Source: Internet
Author: User
Tags imap syslog email account spamassassin

Configuration process
1. Install basic software
Install RHEL 4 u1, disable se Linux, and install the "built-in system" software, including:
Web servers: All
Email server: All
MySQL database: All.
Development Kit: development tools; KDE software development; Legacy Software delelopment; xsoftware Development
Download other required software:
Courier-authlib-0.58.tar.bz2 google.cn
Courier-imap-4.0.6.tar.bz2 google.cn
Extmail-1.0.3.tar.gz www.extmail.org
Extman-0120012.161_12.16.2.3.tar.gz
Postfix-2.5.0.tar.gz.tar.gz (www.postfix.org)
MailScanner-4.49.7-1.rpm.tar.gz
Fp-linux-ws.rpm
I. Software Installation
1. Disable SELinux
[Root @ RedHat as4] # vi/etc/SELinux/config
SELinux = Disable
[Root @ RedHat as4] # reboot
2. Compile and configure Postfix
Stop Sendmail first
[Root @ localhost TMP] # service Sendmail stop
[Root @ localhost TMP] # tar-zxvf postfix-2.5.0.tar.gz
[Root @ localhost TMP] # cd postfix-2.5.0
[Root @ localhost TMP] # useradd Postfix
[Root @ localhost TMP] # groupadd postdrop
[Root @ localhost TMP] # Make-F makefile. init makefiles/
'Ccargs =-duse_sasl_auth-duse_cyrus_sasl-dhas_mysql-I/usr/include/MySQL-I/usr/include/sasl '/
'Auxlibs =-L/usr/lib/MySQL-L/usr/lib/sasl2-lmysqlclient-lsasl2-LZ-LM'
[Root @ localhost TMP] # Make
[Root @ localhost TMP] # make install
Execute make install. There will be many problems here, But Postfix has already set the default answers for us. Using these answers can make Postfix work normally, so we just need to press Enter.
3. Install courier-imap
Compiling module courier-authlib,
[Root @ localhost TMP] # tar-jxvf courier-authlib-0.58.tar.bz2
[Root @ localhost TMP] # courier-authlib-0.58 CD
[Root @ localhost TMP] #./configure -- prefix =/usr/lib/authlib -- without-authpam/
-- Without-authcustom -- without-authpgsql -- without-authldap/
-- Without-authuserdb -- without-authpwd -- without-authshadow/
-- Without-authvchkpw -- With-authmysql/
-- With-authdaemonvar =/usr/lib/authlib/var/
-- Mandir =/usr/lib/man -- without-stdheaderdir/
-- Sysconfdir =/usr/lib/authlib/etc/
-- With-RedHat
[Root @ localhost TMP] # Make
[Root @ localhost TMP] # make install
[Root @ localhost TMP] # make install-Migrate
[Root @ localhost TMP] # make install-configure
Because the installation location of courier-authlib has changed, you need to add the option -- without-stdheaderdir. When compiling imapd, you need to set the environment variable courierauthconfig. Its value is the path of the complete courierauthconfig, configure runs this command to obtain the header file of authlib and the location of the library file. If courierauthconfig is not specified or the path of the specified courierauthconfig is incorrect, the courier-imap cannot find the header file and library file. Example:
/Usr/lib/authlib/bin/courierauthconfig -- ldflags
Program output-L/usr/lib/authlib
/Usr/lib/authlib/bin/courierauthconfig -- cppflags
Program output-I/usr/lib/authlib/include
Compile imapd
[Root @ localhost TMP] # tar jxvf courier-imap-4.0.6.tar.bz2
[Root @ localhost TMP] # courier-imap-4.0.6 CD
[Root @ localhost TMP] # courierauthconfig =/usr/lib/authlib/bin/courierauthconfig./configure -- prefix =/usr/lib/imapd/
-- Silent -- without-authpgsql -- without-ipv6/
-- With-RedHat -- With-authmysql/
-- Mandir =/usr/lib/man -- disable-root-Check
[Root @ localhost TMP] # Make
[Root @ localhost TMP] # make install
Ii. Configuration System
1. Configure Postfix
[Root @ localhost TMP] # cd/etc/Postfix
[Root @ localhost Postfix] #/usr/sbin/postconf-N> main2.cf
[Root @ localhost Postfix] # mv main. Cf main. Cf. Old
[Root @ localhost Postfix] # mv main2.cf main. cf
[Root @ localhost Postfix] # vi main. CF (consistent with the following)
Command_directory =/usr/sbin
Config_directory =/etc/Postfix
Daemon_directory =/usr/libexec/Postfix
Debug_peer_level = 2
Html_directory = No
Mail_owner = Postfix
Mailq_path =/usr/bin/mailq
Manpage_directory =/usr/local/man
Newaliases_path =/usr/bin/newaliases
Queue_directory =/var/spool/Postfix
Readme_directory = No
Sample_directory =/etc/Postfix
Sendmail_path =/usr/sbin/sendmail
Setgid_group = postdrop
Unknown_local_recipient_reject_code = 550
Myhostname = redhat.test.com
Mydomain = test.com
Myorigin = $ mydomain
Mydestination = $ myhostname, localhost. $ mydomain, localhost
Alias_maps = hash:/etc/aliases
Home_mailbox = maildir/
# Add following line in file's finality
# How to retrieve virtual aliases using the specified Postfix
Virtual_alias_maps = MYSQL:/etc/Postfix/mysql_virtual_alias_maps.cf
Virtual_mailbox_base =/home/mail
# How to retrieve virtual domains using the specified Postfix
Virtual_mailbox_domains = MYSQL:/etc/Postfix/mysql_virtual_domains_maps.cf

Virtual_mailbox_limit = 102400000
# How to retrieve the mailbox with the specified Postfix. MySQL is used here.
Virtual_mailbox_maps = MYSQL:/etc/Postfix/mysql_virtual_mailbox_maps.cf
Virtual_minimum_uid = 501
# Email account uid, that is, the Postfix group ID (that is, the account of the owner of the/var/mailbox directory)
Virtual_uid_maps = static: 501

Virtual_gid_maps = static: 501

(Note that the UID and GID must be consistent with the Postfix user and group created in the system. Otherwise, the email cannot be received.
# If maildrop is not installed, it is virtual
Virtual_transport = Virtual
# Additional for quota support
Virtual_create_maildirsize = Yes
Virtual_mailbox_extended = Yes
Virtual_mailbox_limit_maps = MYSQL:/etc/Postfix/mysql_virtual_limit_maps.cf
Virtual_mailbox_limit_override = Yes
Virtual_maildir_limit_message = sorry, the user's maildir has overdrawn his disk
Space quota, please try again later.
Virtual_overquota_bounce = Yes
Virtual_trash_count = Yes
Virtual_trash_name =. Trash
Broken_sasl_auth_clients = Yes
Smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, rejec
T_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_una
Uth_destination, reject_unauth_pipelining, reject_invalid_hostname, reject_rbl_cli
Ent opm.blitzed.org, reject_rbl_client list.dsbl.org, reject_rbl_client BL. spamcop
. Net, reject_rbl_client sbl-xbl.spamhaus.org
Smtpd_sasl_auth_enable = Yes
Smtpd_sasl_local_domain = $ myhostname
Smtpd_sasl_security_options = noanonymous
[Root @ localhost TMP] # mv/etc/aliases. Old
[Root @ localhost TMP] # ln-S/etc/Postfix/aliases/etc/aliases
[Root @ localhost TMP] # echo 'root: admin@example.com '>/etc/Postfix/aliases
[Root @ localhost TMP] #/usr/bin/newaliases
[Root @ localhost Postfix] # mkdir/home/mail
[Root @ localhost Postfix] # chown-r Postfix: Postfix/home/mail
2. Configure SASL authentication
[Root @ localhost Postfix] # vi/usr/lib/sasl2/smtpd. conf (new)
Pwcheck_method: authdaemond
Log_level: 3
Mech_list: Plain Login
Authdaemond_path:/usr/lib/authlib/var/socket
3. Configure courier-imap
[Root @ localhost Postfix] # vi/usr/lib/authlib/etc/authlib/authmysqlrc (modify the items listed below)
Mysql_server localhost
Mysql_username extmail
Mysql_password extmail
Mysql_socket/var/lib/MySQL. Sock
Mysql_database extmail
Mysql_user_table mailbox
Mysql_crypt_pwfield Password
Mysql_uid_field '20140901'
Mysql_gid_field '20140901'
Mysql_login_field Username
Mysql_home_field Concat ('/home/mail/', homedir)
Mysql_maildir_field Concat ('/home/mail/', maildir)
Mysql_name_field name
4. Configure authdaemonrc:
[Root @ localhost Postfix] # vi/usr/lib/authlib/etc/authlib/authdaemonrc (modify the following points)
Authmodulelist = "authmysql"
Authmodulelistorig = "authmysql"
[Root @ localhost Postfix] # vi/usr/lib/imapd/etc/PoP3D (modify as follows)
Pop3dstart = Yes
[Root @ localhost Postfix] # chmod-r 755/usr/lib/authlib/var/
[Root @ localhost Postfix] # chmod-r 755/usr/lib/authlib/etc/authlib/
[Root @ localhost Postfix] # cp/usr/lib/imapd/etc/PoP3D. Dist/usr/lib/imapd/etc/PoP3D
[Root @ localhost Postfix] # cp/usr/lib/imapd/etc/pop3d-ssl.dist/usr/lib/imapd/etc/pop3d-ssl
[Root @ localhost Postfix] # cp/usr/lib/imapd/etc/imapd. Dist/usr/lib/imapd/etc/imapd
[Root @ localhost Postfix] # cp/usr/lib/imapd/etc/imapd-ssl.dist/usr/lib/imapd/etc/imapd-SSL
5. Install extmail
Tar zxvf extmail-0.22.tar.gz
[Root @ localhost Postfix] # Music extmail-0.22/var/www/html/extmail
[Root @ localhost Postfix] # cd/var/www/html/extmail
[Root @ localhost extmail] # chown-r Postfix: Postfix CGI
[Root @ localhost extmail] # cp webmail. Cf. Default webmail. cf
[Root @ localhost extmail] # vi webmail. cf
Sys_config =/var/www/html/extmail/
Sys_langdir =/var/www/html/extmail/lang
Sys_templdir =/var/www/html/extmail/html
Sys_user_lang = zh_cn
Sys_user_charset = gb2312
Sys_maildir_base =/home/mail
Sys_crypt_type = crypt
Sys_mysql_user = extmail
Sys_mysql_pass = extmail
Sys_mysql_db = extmail

6. Configure Apache:
[Root @ localhost extmail] # vi/etc/httpd/CONF/httpd. conf
# Adddefacharset UTF-8
Addhandler CGI-script. cgi
Namevirtualhost *: 80
<Virtualhost *: 80>
Serveradmin webmaster@example.com
DocumentRoot/var/www/html/extmail/html
Alias/extmail/cgi // var/www/html/extmail/cgi/
Alias/extmail // var/www/html/extmail/html/
Alias/extman/cgi // var/www/html/extman/cgi/
Alias/extman // var/www/html/extman/html/
Suexecusergroup Postfix
Servername redhat.test.com
Errorlog logs/mail.example.com-error_log
Customlog logs/mail.example.com-access_log common
</Virtualhost>
<Directory/var/www/html/extmail/cgi>
Options + execcgi
</Directory>
<Directory/var/www/html/extman/cgi>
Options + execcgi
</Directory>

7. Install extman
[Root @ localhost extmail] # tar zvxf extman-0.12.tar.gz
[Root @ localhost extmail] # Music extman-0.12/var/www/html/extman
[Root @ localhost extmail] # cd/var/www/html/extman/libs/EXT
[Root @ localhost ext] # cp/var/www/html/extmail/libs/EXT/*. PM
[Root @ localhost ext] # chown-r Postfix: Postfix/var/www/html/extman/cgi
[Root @ localhost ext] # mkdir/tmp/extman
[Root @ localhost ext] # chown Postfix: Postfix/tmp/extman
Use extmail. SQL and init. SQL In the docs directory under the extman source code directory to create a database:
[Root @ localhost ext] # cd/var/www/html/extman/docs
[Root @ localhost docs] # mysql-u root-P <extmail. SQL
[Root @ localhost docs] # mysql-u root-P <init. SQL
[Root @ localhost docs] # cp mysql_virtual _ */etc/Postfix/
Note: four files are copied to the/etc/Postfix directory.
Configure extman:
[Root @ localhost docs] # vi/var/www/html/extman/webman. cf
Sys_config =/var/www/html/extman/
Sys_langdir =/var/www/html/extman/lang
Sys_templdir =/var/www/html/extman/html
Sys_maildir_base =/home/mail
Sys_quota_type = courier

Test http: // 192.168.0.1/extman if verification cannot appear, you need to install the GD-2.35
Http://search.cpan.org /~ TLD/GD-2.35/

Perl makefile. pl
Prompt/usr/local/GD2/lib where GD is installed
(Supported Image Selection)

Where is libgd installed? [/Usr/lib]/usr/local/GD2

Build JPEG support? [Y] y
Build PNG support? [Y] y
Build FreeType support? [Y] y
Build GIF support? [Y] y
Build support for animated GIFs? [Y] y
Build XPM support? [Y] n

Make
Make install
Error: cannot find-lpng
Ln-Vs/usr/local/libpng2/lib/*/usr/lib
Error: cannot find-lfreetype
Ln-Vs/usr/local/FreeType2/lib/*/usr/lib
Error: cannot find-ljpeg
Ln-Vs/usr/local/IPv6/lib/*/usr/lib
Make clean again
Perl makefile. pl (successful)

You can also remove the extman logon verification code:
In webman. Cf, set sys_captcha_on to 0. Restart Apache.

3. Start the service
1. MySQL
[Root @ localhost Postfix] # service mysqld start
2. Postfix
[Root @ localhost Postfix] #/usr/sbin/Postfix start
3. Courier-imap
[Root @ localhost Postfix] #/usr/lib/authlib/sbin/authdaemond start
[Root @ localhost Postfix] #/usr/lib/imapd/libexec/PoP3D. RC start
[Root @ localhost Postfix] #/usr/lib/imapd/libexec/imapd. RC start
[Root @ localhost Postfix] # vi/etc/rc. Local
/Usr/sbin/Postfix start
/Usr/lib/authlib/sbin/authdaemond start
/Usr/lib/imapd/libexec/PoP3D. RC start
/Usr/lib/imapd/libexec/imapd. RC start
4. configure anti-virus and spam filter functions
1. Install F-Prot
[Root @ localhost Postfix] # rpm-IVH fp-linux-ws.rpm
2. Start spamassassin
[Root @ localhost Postfix] # service spamassassin start
[Root @ localhost Postfix] # chkconfig spamassassin on
3. install and configure mailbench
[Root @ localhost Postfix] # tar xzf MailScanner-4.49.7-1.rpm.tar.gz
[Root @ localhost Postfix] # cd MailScanner-4.49.7-1
[Root @ localhost MailScanner-4.49.7-1] #./install. Sh
[Root @ localhost Postfix] # vi/etc/mailmetadata. conf
Run as user = Postfix
Run as group = Postfix
Incoming queue dir =/var/spool/Postfix/hold
Outgoing queue dir =/var/spool/Postfix/incoming
MTA = Postfix
Virus scanners = F-Prot
Always include spamassassin report = Yes
Use spamassassin = Yes
Required spamassassin score = 4
Spamassassin user State dir =/var/spool/mailool/spamassassin
Spamassassin install prefix =/usr/bin
Spamassassin local rules dir =/etc/mailtasks
[Root @ localhost Postfix] # vi/etc/Postfix/Main. cf
Header_checks = Regexp:/etc/Postfix/header_checks
[Root @ localhost Postfix] # vi/etc/Postfix/header_checks
/^ Stored ed:/hold
[Root @ localhost Postfix] # chown Postfix. Postfix/var/spool/mailfix/incoming
[Root @ localhost Postfix] # chown Postfix. Postfix/var/spool/mail#/ quarantine
[Root @ localhost Postfix] # Postfix stop
[Root @ localhost Postfix] # service mail1_start
[Root @ localhost Postfix] # chkconfig mail#on
Note: The Postfix is automatically started for mailversions.
Test spamassassin
Send an email with the following content. After receiving the email, the title should be marked:
XJS * c4jdbqadn1. nsbn3 * 2idnen * GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL * c.34x
Test F-Prot
Upgrade the virus database:
#/Usr/local/F-Prot/tools/check-updates.pl
Visit http://www.webmail.us/testvirusand apply for a mail to be sent to your mailbox.

Command:

1. Manage mail queues

Display Mail List: postqueue-P or mailq
Show mail content: postcat-Q queue_id
Separate letters: postsuper-D queue_id
Delete all postsuper-d All
Hold the letter
Postsuper-H queue_id
Reply postsuper-H queue_id
Re-import schedule
Postsuper-r queue_id

Postsuper-r all
Clear mail
Postqueue-F (all)
Postqueue-s Host Name (individual objects)

Refer:
Http://blog.chinaunix.net/u1/54725/showart_432881.html

Http://small.dropbear.id.au/myscripts/postfixmysql.html

Http://www.postfix.org/SASL_README.html

Problem:
1. This error is reported when the web page is opened for the first time:
UNIX: syslog not found, please install it first! (In cleanup) undefined subroutine & Ext: logger: do_closelog called at/var/www/extsuite/extmail/libs/EXT/logger. PM line 87.
Solution:
Is to http://search.cpan.org search syslogdownload A unix-syslog-0.100.tar.gz
Tar zxvf Unix-Syslog-0.100.tar.gz
CD Unix-Syslog-0.100
Perl makefile. pl
Make
Make install2, extman default password
Extmail * 123 * Original article addressHttp://extmail.org/forum/archive/2/0604/1359.html http://extmail.org/forum/archive/2/0604/1359.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.