Basic installation of Mail Server

Source: Internet
Author: User
Tags apache php qmail

Linux Apache PHP MySQL Qmail Vpopmail qmaliadmin

As needed by the Organization, I spent some time off on May 1, but I don't quite understand the principle. Let's talk about the installation sequence and make a record for myself.
However, my patch may not be complete. Exercise caution when using servers.
1. install linux. You can do this by yourself.
2. Install mysql5. This is a denial of experience. You must follow the rules. Otherwise, you may be in trouble and I will be in trouble.
Installation sequence
Shell> groupadd MySQL
Shell> useradd-G MySQL user Creation
Shell> gunzip <mysql-VERSION.tar.gz | tar-xvf-extract
Shell> Cd mysql-version to enter the Directory
Shell>./configure -- prefix =/usr/local/MySQL pre-compilation parameters add by yourself
Shell> make
Shell> make install
Shell> CP support-files/my-medium.cnf/etc/My. CNF configure the MySQL configuration file
Shell> Cd/usr/local/MySQL permission Modification
Shell> chown-r MySQL.
Shell> chgrp-r MySQL.
Shell> bin/mysql_install_db -- user = MySQL initial database
Shell> chown-r root.
Shell> chown-r MySQL VaR
Shell> bin/mysqld_safe -- user = MySQL & background startup

If a problem occurs, it is generally caused by permission issues.
3. install Apache
Enter the Directory
./Configure -- prefix =/usr/local/Apache -- enable-shared = max -- enable-module = rewrite -- enable-module = so
Make
Make install
Start
CD/usr/local/Apache/bin/apachectl start
4. install PHP
Download, unzip, and install
./Configure
Make
Make install

5. Integrate PHP with Apache
VI/usr/local/Apache/CONF/httpd. conf
Loadmodule php5_module modules/libphp5.so
Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs

Now the lamp installation is complete.
Regardless of the version, the installation is basically the same
Install the mail server
Multiple combinations can be used, but Qmail is a common method.

Do not ask why the software is installed.

6. Install daemontools
Http://cr.yp.to/daemontools.html
Tar-zxvf daemontools-0.76.tar.gz
Extract
CD admin/daemontools-0.76
Patch
Patch-P1 Install
Package/install
# Verify that daemontools is running properly:
Sleep 5
PS ax | grep svscan

7. Install ucspi-TCP
Tar zxvf ucspi-tcp-0.88.tar.gz
CD ucspi-tcp-0.88
Patch-P1 <../ucspi-tcp-0.88.errno.patch // I did not succeed, direct record
Make
Make setup check

8. Qmail Installation
# Create a user
Mkdir/var/Qmail
Groupadd nofiles
Useradd alias-G nofiles-D/var/Qmail/alias-S/sbin/nologin
Useradd qmaild-G nofiles-D/var/Qmail-S/sbin/nologin
Useradd qmaill-G nofiles-D/var/Qmail-S/sbin/nologin
Useradd qmailp-G nofiles-D/var/Qmail-S/sbin/nologin
Groupadd Qmail
Useradd qmailq-G Qmail-D/var/Qmail-S/sbin/nologin
Useradd qmailr-G Qmail-D/var/Qmail-S/sbin/nologin
Useradd qmails-G Qmail-D/var/Qmail-S/sbin/nologin

# Add a Vpopmail user by the way
Groupadd vchkpw-G 89
Useradd Vpopmail-u 89-G vchkpw

# Prepare to install Qmail

CD/home/PKG

Tar-xzf toaster-scripts-0.7.tar.gz

CD netqmail-1.05/netqmail-1.05/

 

# Change 451 in the search function straynewline to 553

VI qmail-smtpd.c

# When your server receives an invalid email, it will send: "I am not going to accept that message at the moment, you can try again later, A few seconds later, the same email will be sent to you, resulting in repeated requests.

# After changing to 553, your server will directly send: "I am not going to accept that message, don't try sending it again. ", tell the recipient's server not to send this invalid letter again.

 

# RedHat/Fedora users may need to link an include file to the TLS patch

# Enter the following command:

Ln-S/usr/Kerberos/include/com_err.h/usr/include/

 

# Delete the Sendmail Link

Rm-RF/usr/sbin/sendmail

 

# Qmail compilation and Installation

Make

Make setup check

# Note: The Qmail patch should be called after Vpopmail is installed.

 

# Replace mail.domain.com with your host name

./Config-fast mail.domain.com

 

# Set the Administrator's email address.

# Emails sent to the root/Postmaster/mailer-daemon address will be received by the defined administrator mailbox.

# Replace the following "admin@domain.com" with your Postmaster mailbox.

CD/var/Qmail/alias

Echo "admin@domain.com">;. Qmail-postmaster

Echo "admin@domain.com">;. Qmail-mailer-daemon

Echo "admin@domain.com">;. Qmail-Root

Chmod 644/var/Qmail/alias/. Qmail *

 

# Enable SPF settings

Echo./maildir/>;/var/Qmail/control/defaultdelivery

Echo 3>;/var/Qmail/control/spfbehavior

 

# Add Qmail help manual

Echo manpath/var/Qmail/man>;/etc/man. config

 

# Create a monitoring directory and log file for the Qmail service:

Mkdir-P/var/Qmail/supervise/Qmail-send/log

Mkdir-P/var/Qmail/supervise/Qmail-smtpd/log

Mkdir-P/var/Qmail/supervise/qmail-pop3d/log

Mkdir-P/var/Qmail/supervise/qmail-pop3ds/log

CP/home/PKG/toaster-scripts-0.7/send. Run/var/Qmail/supervise/Qmail-send/run

CP/home/PKG/toaster-scripts-0.7/send. log. Run/var/Qmail/supervise/Qmail-send/log/run

CP/home/PKG/toaster-scripts-0.7/smtpd. Run/var/Qmail/supervise/Qmail-smtpd/run

CP/home/PKG/toaster-scripts-0.7/smtpd. log. Run/var/Qmail/supervise/Qmail-smtpd/log/run

CP/home/PKG/toaster-scripts-0.7/PoP3D. Run/var/Qmail/supervise/qmail-pop3d/run

CP/home/PKG/toaster-scripts-0.7/PoP3D. log. Run/var/Qmail/supervise/qmail-pop3d/log/run

CP/home/PKG/toaster-scripts-0.7/pop3ds. Run/var/Qmail/supervise/qmail-pop3ds/run

CP/home/PKG/toaster-scriptes-0.7/pop3ds. log. Run/var/Qmail/supervise/qmail-pop3ds/log/run

Echo 20>;/var/Qmail/control/concurrencyincoming

Chmod 644/var/Qmail/control/concurrencyincoming

Chmod 755/var/Qmail/supervise/Qmail-send/run

Chmod 755/var/Qmail/supervise/Qmail-send/log/run

Chmod 755/var/Qmail/supervise/Qmail-smtpd/run

Chmod 755/var/Qmail/supervise/Qmail-smtpd/log/run

Chmod 755/var/Qmail/supervise/qmail-pop3d/run

Chmod 755/var/Qmail/supervise/qmail-pop3d/log/run

Chmod 755/var/Qmail/supervise/qmail-pop3ds/run

Chmod 755/var/Qmail/supervise/qmail-pop3ds/log/run

Mkdir-P/var/log/Qmail/smtpd

Mkdir-P/var/log/Qmail/PoP3D

Mkdir-P/var/log/Qmail/pop3ds

Chown-r qmaill/var/log/Qmail

 

# STARTUP script:

CD/home/PKG

CP toaster-scripts-0.7/RC/var/Qmail/RC

Chmod 755/var/Qmail/RC

CP toaster-scripts-0.7/qmailctl/var/Qmail/bin/

Chmod 755/var/Qmail/bin/qmailctl

Ln-S/var/Qmail/bin/qmailctl/usr/bin

Ln-S/var/Qmail/bin/sendmail/usr/sbin/sendmail

Rm-RF/usr/lib/sendmail

Ln-S/var/Qmail/bin/sendmail/usr/lib/sendmail

 

# Use daemontools to start Qmail-send and qmail-smtpd

Ln-S/var/Qmail/supervise/Qmail-send/var/Qmail/supervise/Qmail-smtpd/service

 

# Command:

# Start, stop, restart, and view queues

Qmailctl START | stop | restart | doqueue | flush | reload | stat | pause | cont | CDB | queue | help

 

# Check the service

Netstat-an | grep 25

PS-Ef | grep Qmail

PS-EFL | grep "service errors" | grep-V grep

 

 

# Logs:

/Var/log/maillog

/Var/log/Qmail/Current

/Var/log/Qmail/PoP3D/Current

/Var/log/Qmail/pop3ds/Current

/Var/log/Qmail/smtpd/Current

The installation is successful after you find it online.

9. Install Vpopmail
Http://vpopmail.sf.net
Recommended Installation
Vpopmail-5.4.17.tar.gz

A small bug in vpopmail-5.4.18.tar.gz is not suitable for Servers

Decompress and enter
. /Configure -- enable-incdir =/usr/include/MySQL -- enable-libdir =/usr/lib/MySQL -- disable-roaming-users -- enable-logging = p -- disable-passwd -- enable-clear-passwd -- disable-Domain-quotas -- enable-auth-module = MySQL -- enable-auth-logging -- enable-SQL-logging -- disable-valias -- disable-MySQL -limits -- enable-Learn-passwords

There is a problem here, because we compile MySQL ourselves.
Therefore, the -- enable-incdir =/usr/include/MySQL -- enable-libdir =/usr/lib/MySQL directory must be modified.
-- Enable-incdir =/usr/local/MySQL/include/MySQL -- enable-libdir =/usr/local/MySQL/lib/MySQL

If the compilation fails, the main problem here is that make cannot
Make
Make install-strip

# Add a domain. The red part is followed by the domain name and the postmaster password.

Vadddomain domain.com xukixu

 

# Add a user. The red part is the annotation and does not need to be entered.

Vadduser-Q 10485760 S (mailbox size) xukixu@domain.com (mailbox account) 1234 (password)

Vmoduser-C Xu Jing (email description) xukixu@domain.com

 

# Set a warning message when the mailbox capacity reaches 90%

VI/home/Vpopmail/domains/. quotawarn. msg

 

From: email administrator

Reply-to: postmaster@domain.com

To: email user

Subject: email space warning

Mime-type: 1.0

Content-Type: text/html; charset = gb2312

Content-transfer-encoding: base64

 

Your mailbox has reached 90%. If you want to continue using it, please delete some emails.

If you need help, contact the postmaster:

Email: postmaster@domain.com

 

 

# Set a warning message when the mailbox is full

Echo "the email is rejected and the user's mailbox space is full.">;/home/Vpopmail/domains/. over-quota.msg

 

# STARTUP script:

CP/home/PKG/toaster-scripts-0.7/vpopmailctl/var/Qmail/bin

Ln-S/var/Qmail/bin/vpopmailctl/usr/bin

Chmod 755/var/Qmail/bin/vpopmailctl

Use online

10. Install autorespond.
Tar-xvzf autorespond-2.0.5.tar.gz
CD autorespond-2.0.5
Make
Make install

11. Install ezmlm
Tar-xvzf ezmlm-0.53.tar.gz
Tar-xvzf ezmlm-idx-0.42.tar.gz
CP-RF ezmlm-idx-0.42/* ezmlm-0.53/
CD ezmlm-0.53
Patch <idx. Patch
Chmod U + x makelang // the current version of this step is not required. I have not succeeded.
Make
Make man
Make setup

12. Install qmailadmin
Tar-xvzf qmailadmin-1.2.9.tar.gz
CD qmailadmin-1.2.9
. /Configure -- enable-htmldir =/var/www/html -- enable-cgibindir =/var/www/cgi-bin -- enable-vpopuser = Vpopmail -- enable-autoresponder-bin =/ usr/bin -- disable-ezmlm-mysql -- enable-maxusersperpage = 20 -- enable-maxaliasesperpage = 20 -- enable-Modify-quota -- enable-Domain-AutoFill
Make
Make install-strip
CD/usr/local/share/qmailadmin/lang
MV en. Bak
Cp zh-cn En

Even if the server is installed, there is still a webmail interface missing. This is your hobby. I haven't found a suitable one yet.
Maybe you have a useful idea with me. We have installed the server, but how can we synchronize user registration?
We can't add one user each time. We just add one user manually. We don't have that energy. That's right. I have the idea too.
I analyzed the Vpopmail table. We can push the user to this table through the program. This table is only saved, and the basic user information is very small. If you want to integrate other functions, it is estimated that other solutions are required.

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.