Compile and install Qmail in linux

Source: Internet
Author: User
Tags mail exchange qmail
For details about how to compile and install Qmail in linux-Linux Enterprise Application-Linux server application, see the following. I believe you are very familiar with E-mail. You may have applied for one or more email mailboxes and used them to communicate with friends and family. Exchange business letters, transmit electronic documents, and program attachments with colleagues. E-mail has become an essential tool for you to communicate, learn, work, and entertain with the outside world. E-mail is a mature and practical service provided by the Internet. While enjoying the convenience it brings, many people want to understand its working principle and installation configuration. The following describes how to install, configure, and use the frequently-used e-mail system (QMail.

   Process 1: Install Qmail.

1. Obtain the Qmail program.
Qmail is a free software that can obtain its source code (C source code) and binary files based on various platforms and operating systems on the Internet. Binary files can be used directly without compilation, but be sure to select files with the same version as your platform and operating system. Otherwise, they may not be used. The source code can work in any environment (UNIX), but you need to compile and install it yourself. Here we select the source code. The source code downloaded from the Internet is usually a package of the tar program and then compressed with the compression software. For example, the qmail-1.03.tar.gz here uses gzip for compression (assuming you have installed gzip on your machine ). Decompress the gzip-d qmail-1.03.tar.gz into qmail-1.03.tar and then decompress the tar-xvf qmail-1.03.tar into a qmail-1.03 directory. The source code files are in this directory.

2. Compile and install Qmail.
The Qmail source code file contains several configuration files that can be modified to suit your environment.
Conf-qmail: This file contains the installation directory of Qmail. The default value is/var/qmail/
Conf-users: This file contains the users required for Qmail. The default users are root and alias. (These two users should have been created by the system in unix, the following users should create their own) qmails, qmaid, qmaill, qmailr, qmailq, qma-ilp.
Conf-groups: This file contains the group to be used by Qmail. The default group is qmail (qmails, qmaild, qmaill, qmailr, qmailq, and qmailp must belong to this group ).
Conf-cc: This file contains the compiler used by Qmail. The cc compiler is used by default. If other C compilers are required, replace them with this compiler, such as gcc.
Conf-ld: This file contains the compiler used by Qmail. The cc compiler is used by default. If other C compilers are required, replace it with this compiler, such as gcc.
The make command should have been installed before installation.
After these files are customized, run the command "make" under "/var/qmail. The make command will compile the source code and connect to the. obj file. If this process is interrupted or incorrect, check whether the preceding configuration file is correct. Whether the user and group are correctly established. If this process is correct, run the command: make check setup. This command will install all files under/var/qmail/(create this directory with makedir/var/qmail before executing this command.
In addition, you need to install checkpasswd, which is the same as installation and Qmail. This program is used to verify the password of a user when receiving an email using POP3 protocol.

   Process 2: basic configuration of Qmail

After Qmail is installed, several files and directories will be generated under/var/qmail.

1. open the file/etc/inetd. conf In the vi editor and add the following lines at the end of the file:
Smtp stream tcp nowait qmaild/var/qmail/bin/tcp-env
Tcp-env/var/qmail/bin/qmail-smtpd (same line as above)
Pop3 stream tcp nowait root/var/qmail/bin/qmail-popup
Qmail-popup your. host. name/bin/checkpassword
/Var/qmail/bin/qmail-pop3d Maildir (same line as above)
Here, your. host. name is your complete Internet host name, And Maildir is in the mailbox format (Here we use the popular Maildir format)

2. Check whether the/etc/services file contains the following two lines. If not, add them:
Smtp 25/tcp mail
POP3. 110/tcp # Post Office

3. Configure Qmail in DNS.
If Qmail is used to interact with other mail servers on the Internet (otherwise, only the mail users on this server can send and receive mail from each other ), you also need to set entries related to Qmail In the DNS server (if you are using another DNS server, you should apply to the DNS administrator to add entries) add an entry about email exchange (contact the DNS administrator for specific settings)

4. Create a control file
The control file of Qmail is stored in/var/qmail/control/. If the control file does not communicate with the email server on the Internet, many files need to be configured. Otherwise, you only need to configure one file: me
Its content is the complete Internet host name of the email server: your. host. name

   Process 3: Create Email users

Email users are system users. Therefore, you should add users to the system. To ensure security and management, you can create an e-mail user group and assign e-mail users to this group, when creating a user directory, it is best to create it in the same directory under the same file system (of course, this file system is not large enough to be created in a directory of another file system)
Then, run the command/var/qmail/bin/maildirmake in the initial directory of each user to create the mailbox directory and grant appropriate permissions, you can use the Shell script to create a mailbox for each user. The following is a simple example of this script:
If test $1
Then
Echo "Creating $1's directory and file ..."
Useradd-d/usr/email-users/$1-g emusers-s/bin/passwd $1
Cd/usr/email-users/
Mkdir $1
Chown $1 $1
Cd $1
/Var/qmail/bin/maildirmake Maildir
Echo./Maildir/>. qmail
Chown $1 Maildir
Chown $1 Maildir /*
Chown $1. qmail
Echo "Please input $1's email password"
Passwd $1
Echo "$1's account has been created !!! "
Else
Echo "Please input the user 'name! "
Fi
The system administrator can use emuadd email_user_name (the file name of this script, and store this file under/bin) to create an email_user_name mailbox.

   Process 4: Use of the Qmail System

After the above process is completed, restart the computer.
Set the following in the mail client program: (assume that the Host Name of the e-mail server is your. host. name, the domain for mail exchange management set in DNS is mail. domain, note: generally mail. domain and host. same name. Take the e-mail user as an example)
Email: user@mail.domain
SMTP server address: your. host. name
POP3 server address: your. host. name
POP3 account: user
POP3 account password: (the password can be modified by the Administrator)
Related Article

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.