Set up a high-capacity linux POP3 server _unix Linux

Source: Internet
Author: User
Tags comments hash
One: Overview
The purpose of this article is to describe how to use open source software procmail and Qpopper to configure a POP3 server that can be used by a large number of users, with a focus on maintaining optimal server performance.
Two: Steps
Software Environment for Redhat Linux 7.1
1. Download the latest version of Procmail and Qpopper
Procmail The latest version is now 3.21 available from
http://www.procmail.org/procmail-3.21.tar.gz download.
Qpopper The latest version is now 4.0 available from
http://www.eudora.com/qpopper_general/Download
2. Compile Qpopper
Suppose the downloaded file is placed in the/root
#cd/root
#tar XVFZ qpopper4.0.3.tar.gz
#cd qpopper4.0.3
#./configure--enable-hash-spool=2
--enable-log-login
--enable-server-mode
--enable-fast-update
--enable-shy
--enable-spool-dir=/usr/mail
--enable-specialauth
Comments:
--enable-specialauth Use/etc/shadow password Authentication
--enable-hash-spool=2 uses level two hash structure
--enable-spool-dir=/usr/mail The user mailbox file is/usr/mail/j/e/jephe
--enable-log-login Record of successful POP3 login into syslog
--enable-server-mode and--enable-fast-update
Do not allow Qpopper to copy mailbox files to temporary files when the user accesses the mailbox
Reduces disk I/O and enhances performance
--enable-shy do not display version information when responding to a server, enhancing security
#make
#make Install
Edit File/etc/inetd.conf
Create the file POP3 under/ETC/XINETD.D and include the following:
Service POP3
{
Socket_type = Stream
protocol = TCP
wait = no
user = root
Server =/usr/local/lib/popper
Server_args = qpopper-f-s-s-c-r-t120
Port = 110
}
Comments:
-F Enable fast update
-S Enable server mode (done when the user does not have shell access to the server)
-S opens log feature
-C ignores the case of the user name
-R does not reverse domain name check for incoming IP address
-T set timeout time
After this setting, if the user jephe the letter, lock the mailbox file/usr/mail/j/e/jephe create the lock file. Jephe.pop, check the number of letters, back out of the update status, generate. jephe.cache file.
Otherwise, the normal mode is to first copy the/usr/mail/j/e/jephe into the. Jephe.pop, the final user check the mailbox and then copy back, increased I/O processing time
If it is not Redhat 7.1, note the line beginning with pop-3 in/etc/inetd.conf, and then add the following line later: pop-3 stream TCP nowait.400 root/usr/local/sbin/popper-f- S-s-c-r-t120
400 in nowait:400 refers to the maximum number of connection requests per minute
If you set the All:all in the/etc/hosts.deny, enter it in the/etc/hosts.allow
Popper:all
3. Compile Procmail
Suppose the downloaded file is placed in the/root
#cd/root
#tar XVFZ procmail-3.21.tar.gz
#cd procmail-3.21
#vi src/authenticate.c
Change #define MAILSPOOLDIR line behind the/var/spool/mail as "/usr/mail/" (Here I use the
/usr/mail)
Change #define Mailspoolhash 0 to 2 (use a two-level hash directory to improve server file system performance, especially when there are large numbers of users)
Note: In this case, if the user's mailbox is jephe@domain.com, the file should exist
/usr/mail/j/e/jephe
#mv/var/spool/mail/var/spool/mail.bak
Note: Change this directory first, because it is possible to use this directory and the hash hierarchy if the directory can be found at compile time, which will store the user's mail to the file/var/spool/mail/j/e/ Jephe. If you want to use this directory, you do not need to change the Mailspooldir line above.
#make
#make Install
#make Install-suid
Then run #procmail-v as root to verify that the user's mail path is/usr/mail/r/o/root.
4. Create POP3 User
You do not need to assign a home directory to mail users, and you do not need to set the primary directory to/usr/mail/j/e (assuming the user is Jephe) and create the user with the following command.
#useradd jephe-c "Jephe Wu"-G mail-d/dev/null-s/bin/false
You can then write a batch command with CHPASSWD to each user with the same password.
A. First use passwd for Mailuser1 to set the password, assuming "abc123", check the/etc/shadow in the secret
Code, "abc123" on my machine.
For $1$g22plicn$r5.bse0u7dbahn7tcevtr/
B. Create a new file/tmp/password, each line includes a username: password, can be obtained from/etc/passwd with the following command
cat/etc/passwd | Awk-f: ' {print $} ' |sed-e
' S/$/:$$1$g22plicn$r5.bse0u7dbahn7tcevtr\//g '
C. Then run CHPASSWD </tmp/password
5. FAQ
A. After compiling the qpopper, you still need to use the-f-s parameter on the command line to start server mode and quick Update, please put-F in front of-s

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.