Use the source code in Centos to build an extmail mail server

Source: Internet
Author: User
Tags syslog dovecot import database

Extmail is a high-capacity/ISP-level application written in perl. It is a free and high-performance Webmail software that allows you to quickly develop, improve, and upgrade your applications, supports Maildir and indexing, which is extremely fast. Supports multi-language display on the same screen, massive files in a mega mail (more than 1 GB), unlimited attachment size, strong I/O capabilities, templated, multi-language, easy to modify. The adaptable webmail system is a good choice for domestic email systems, including system functions, ease of use, and culture. Shows how it works:


I. Preparations

1. Prepare tools

Apr-1.4.6.tar.gz apr-util-1.5.1.tar.gz

Httpd-2.4.4.tar.bz2 courier-authlib-0.65.0.20130314.tar.bz2

Mysql-5.5.15-linux2.6-i686.tar.gz

Postfix-2.8.2.tar.gz dovecot-2.0.16.tar

Extmail-1.2.tar.gz Unix-Syslog-1.1.tar.gz

Extman-1.1.tar.gz

2. Prepare the development environment

[Root @ lly ~] # Create a disk mount point for mkdir/mnt/cdrom

[Root @ lly ~] # Mount/dev/cdrom/mnt/cdrom

[Root @ lly ~] # Vim/etc/yum. repos. d/rhel-debuginfo.repo edit yum client to build a repo id

[Root @ lly ~] # Yum grouplist check the development environment

Note: The software depends on these development environments. If the development environment is not installed in advance, you can use yum for installation.

Ii. Installation of software packages

1. install apache

[Root @ lly ~] # Tar-zxvf apr-1.4.6.tar.gz-C/usr/local/src/disassemble apr Software Package

[Root @ lly src] # cd/usr/local/src/apr-1.4.6/

[Root @ lly apr-1.4.6] #./configure -- prefix =/usr/local/apr install apr to the/usr/local/apr directory

[Root @ lly apr-1.4.6] # make

[Root @ Lili apr-1.4.6] # make install

[Root @ lly apr-1.4.6] # cd

[Root @ lly ~] # Tar-zxvf apr-util-1.5.1.tar.gz-C/usr/local/src/disassemble apr-util Software Package

[Root @ lly src] # cd apr-util-1.5.1/

[Root @ lly apr-util-1.5.1] #./configure -- with-apr =/usr/local/apr/bin/apr-1-config

[Root @ lly apr-util-1.5.1] # make

[Root @ Lili apr-util-1.5.1] # make install

[Root @ lly apr-util-1.5.1] # cd

[Root @ lly ~] # Tar-jxvf httpd-2.4.4.tar.bz2-C/usr/local/src/disassembling httpd Software Package

[Root @ lly ~] # Cd/usr/local/src/httpd-2.4.4/go to the apache directory for disassembling

[Root @ lly httpd-2.4.4] #. /configure -- prefix =/usr/local/apache -- sysconfdir =/etc/httpd -- enable-so -- enable-ssl -- enable-rewrite -- with-apr =/usr/local/ apr/bin/apr-1-config -- with-apr-util =/usr/local/apr/bin/apu-1-config -- with-pcre-with-z -- enable-mpms-shared = all

[Root @ lly httpd-2.4.4] # make

[Root @ Lili httpd-2.4.4] # make install

[Root @ lly httpd-2.4.4] # cd/usr/local/apache/man

[Root @ lly man] # vim/etc/man. config Add the man manual of apache to the man path to facilitate viewing the man manual of apache

[Root @ lly apache] # ln-s/usr/local/apache/include // usr/include/apache makes a symbolic link for the apache header file

[Root @ lly ~] # Cd/etc/init. d/

[Root @ lly init. d] # vim httpd edit apache Startup Script

The script is as follows:

#! /Bin/sh

# Set-x

HTTPD = '/usr/local/apache/bin/httpd'

CONFFILE = '/etc/httpd. conf'

# Description: http server

# Chkconfig: 2345 88 60

Start (){

[-F/var/lock/subsys/httpd] & echo "apache is started" & exit

Echo-n "starting apache ......"

Sleep 1

$ HTTPD-f $ CONFFILE & RETVAL = 0 | RETVAL = 1

[$ RETVAL-eq 0] & touch/var/lock/subsys/httpd & echo "OK" | echo "fail"

}

Stop (){

[! -F/var/lock/subsys/httpd] & echo "httpd is stoped..." & exit

Echo-n "stoping httpd ........"

Sleep 1

/Bin/rm-rf/var/lock/subsys/httpd

$ HTTPD-k stop & RETVAL = 0 | RETVAL = 1

[$ RETVAL-eq 0] & rm-rf/var/lock/subsys/httpd & echo "OK" | echo "fail"

}

Case $1 in

Start)

Start

;;

Stop)

Stop

;;

Restart)

Stop

Start

;;

*)

Echo "start | stop | restart"

;;

Esac

[Root @ lly init. d] # chmod a + x/etc/init. d/httpd add executable permissions for the apache service

[Root @ lly init. d] # service httpd start apache service

[Root @ lly init. d] # netstat-tupln | grep http check whether port 80 is enabled

[Root @ lly init. d] # chkconfig -- add httpd add auto-start

[Root @ lly init. d] # chkconfig -- list | grep http check whether startup is successfully added

2. Install cmake

The cmake tool is required for mysql installation.

[Root @ lly ~] # Tar-zxvf cmake-2.8.10.2.tar.gz-C/usr/local/src/

[Root @ lly ~] # Cd/usr/local/src/cmake-2.8.10.2/

[Root @ lly cmake-2.8.10.2] #./configure -- prefix =/usr/local/cmake

[Root @ lly cmake-2.8.10.2] # make & make install

Waiting .......................

[Root @ lly cmake-2.8.10.2] # cd/usr/local/cmake/

To quickly access the bin under cmake in the future, add the bin under cmke to the path

[Root @ lly cmake] # vim/etc/profile

Note: the path will be successfully added only after the next entry.

3. Install mysql

[Root @ lly ~] # Tar zxvf mysql-5.6.10.tar.gz-C/usr/local/src/

[Root @ lly ~] # Cd/usr/local/src/mysql-5.6.10/

[Root @ Lili mysql-5.6.10] # less INSTALL-SOURCE

Mysql instructions, we can install according to the installation instructions.


[Root @ lly ~] # Cd/usr/local/src/mysql-5.6.10/

[Root @ lly mysql-5.6.10] # cmake.

[Root @ lly mysql-5.6.10] # make & make install

This is time consuming. Please waiting for a long time ..........................

[Root @ lly ~] # Cd/usr/local/src/mysql-5.6.10/

[Root @ Lili mysql-5.6.10] # less INSTALL-SOURCE

Steps for configuring Mysql installation instructions

[Root @ lly mysql-5.6.10] # cd/usr/local/mysql/

Create account information

[Root @ lly mysql] # groupadd mysql

[Root @ lly mysql] # useradd-r-g mysql

[Root @ lly mysql] # chown-R mysql.

Initialize

[Root @ lly mysql] # scripts/mysql_install_db -- user = mysql

[Root @ lly mysql] # chown-R root.

[Root @ lly mysql] # chown-R mysql data

[Root @ lly mysql] # cd support-files/

[Root @ lly support-files] # cp my-default.cnf/etc/my. cnf

[Root @ lly support-files] # cp mysql. server/etc/init. d/mysqld

[Root @ lly support-files] # chmod a + x/etc/init. d/mysqld

[Root @ lly support-files] # service mysqld start

Starting MySQL... [OK]

Mysqld service started successfully

[Root @ lly support-files] # netstat-tupln | grep mysqld

[Root @ lly support-files] # cd ..

[Root @ lly mysql] # pwd

/Usr/local/mysql

[Root @ lly mysql] # vim/etc/profile

[Root @ lly bin] #./etc/profile

[Root @ lly ~] # Mysql

Mysql> show databases;

+ -------------------- +

| Database |

+ -------------------- +

| Information_schema |

| Mysql |

| Performance_schema |

| Test |

+ -------------------- +

4 rows in set (0.00 sec)

[Root @ lly ~] # Mysqladmin-u root-p password '000000' set an administrator account password 123

[Root @ lly ~] # Mysql-u root-p can log on to this account later

Note: the/usr/local/mysql/lib library file generated by mysql is not recognized by the system in the standard path (/lib or/usr/lib is the standard path). Therefore, the following configuration is required:

[Root @ lly mysql] # vim/etc/ld. so. conf. d/mysql. conf

Write

/Usr/local/mysql/lib

[Root @ lly mysql] # ldconfig

[Root @ lly mysql] # ln-s/usr/local/mysql/include // usr/include/mysql makes a connection to the mysql header file include


4. Install the dns server

[Root @ lly ~] # Yum install-y bind-chroot caching-nameserver

[Root @ lly ~] # Service mysqld start

Here we will create the 126.com email server domain mail.126.com local address 192.168.126.129

[Root @ lly ~] # Cd/var/named/chroot/etc/

[Root @ lly etc] # cp-p named. caching-nameserver.conf named. conf

[Root @ lly etc] # vim named. conf edit dns Configuration

[Root @ lly etc] # vim named. rfc1912.zones: The Declaration file of the editing area

[Root @ lly etc] # cd/var/named/chroot/var/named/

[Root @ lly named] # cp-p localhost. zone 126.com. zone generate the region File

[Root @ lly named] # vim 126.com. zone

[Root @ lly named] # service named start dns

[Root @ lly named] # chkconfig named on add auto-start

[Root @ lly named] # vim/etc/resolv. conf dns points

[Root @ lly named] # vim/etc/sysconfig/network modify the Host Name (email server)

[Root @ lly named] # vim/etc/hosts modify the hosts file

[Root @ lly named] # hostname mail.126.com restart, or modify the Host Name

[Root @ mail ~] # Nslookup mail.126.com view dns resolution

[Root @ mail ~] # Dig-t mx 126.com test the post office in the 126.com Region

Everything is normal...

5. Install postfix

[Root @ mail ~] # Service sendmil stop

[Root @ mail ~] # Chkconfig sendmail off If sendmail is installed, disable the sendmail service first.

[Root @ mail ~] # Tar-zxvf postfix-2.8.2.tar.gz-C/usr/local/src/

[Root @ mail ~] # Cd/usr/local/src/postfix-2.8.2/

Without the configure file, you can change the makefile file to replace configure.

Note: Postfix is a service that requires you to add an account to it.

[Root @ mail postfix-2.8.2] # groupadd-g 2121 add postfix group, group id 2121

[Root @ mail postfix-2.8.2] # useradd-u 2121-g postfix-s/sbin/nologin-M postfix create account username postfix group name postfix

[Root @ mail postfix-2.8.2] # groupadd-g 2122 postdrop

[Root @ mail postfix-2.8.2] # useradd-u 2122-g postfix-s/sbin/nologin-M postdrop create an account for the queue Management Service

[Root @ mail postfix-2.8.2] # make makefiles 'ccargs =-DHAS_MYSQL-I/usr/include/mysql-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/include/sasl-DUSE_TLS'' AUXLIBS =-L/usr/local/mysql/lib-lmysqlclient-lz-lm-L/usr/lib/sasl2-lsasl2-lssl-lcrypto'

Note: (if there is no configure file, you can change the makefile file to replace configure./configure)

[Root @ lly postfix-2.8.2] # make

[Root @ lly postfix-2.8.2] # make install

You can press enter to set the default value.

Note: The aliases file under the etc directory will be generated later. This file is used with sendmail. to combine it with postfix, run the following command:

[Root @ mail postfix-2.8.2] #/usr/bin/newaliases execution

Note: The redhat system startup script is called here. Because postfix is installed by default and the path is the default path, you can use the script that comes with the system.

[Root @ mail postfix-2.8.2] # mkdir/tmp/abc

[Root @ mail postfix-2.8.2] # cd/tmp/abc/

[Root @ mail abc] # cp/mnt/cdrom/Server/postfix-2.3.3-2.1.el5_2.i386.rpm./copy the disc

[Root @ mail abc] # rpm2cpio postfix-2.3.3-2.1.el5_2.i386.rpm | cpio-id disassembling postfix package

[Root @ mail abc] # cd etc

[Root @ mail etc] # cd rc. d

[Root @ mail rc. d] # cd init. d

[Root @ mail init. d] # cp-p postfix/etc/init. d/copy the configuration file

[Root @ mail init. d] # service postfix start postfix service

[Root @ mail ~] # Netstat-tupln | grep 25

[Root @ mail ~] # Vim/etc/postfix/main. cf

[Root @ mail ~] # Service postfix restart service

[Root @ mail sbin] # useradd user1 add user1 user

[Root @ mail sbin] # passwd user1 adds password 123 to user1

[Root @ mail ~] # Telnet 127.0.0.1 25 to send a test email to user1.

Check if user1 has received the email

[Root @ mail ~] # Su-user1 log on to user1 to view emails

[User1 @ mail ~] $ Mail

Note: The Postfix authentication function must be integrated with sasl

[Root @ mail ~] # Cd/usr/lib/sasl2/

[Root @ mail sasl2] # cp-p Sendmail. conf smtpd. conf

[Root @ mail sasl2] # vim smtpd. conf edit its configuration file

[Root @ mail sasl2] # service saslauthd start sasl

[Root @ mail sasl2] # chkconfig saslauthd on is set to boot

[Root @ mail ~] # Vim/etc/postfix/main. cf to make sasl effective for smtp, you need to add some validation statements for sasl.

[Root @ mail sasl2] # service postfix restart postfix service


6. Install courier-authlib

[Root @ mail ~] # Tar-jxvf courier-authlib-0.63.1.20111230.tar.bz2-C/usr/local/src/

[Root @ mail ~] # Cd/usr/local/src/courier-authlib-0.63.1.20111230/

[Root @ mail courier-authlib-0.63.1.20111230] #. /configure -- prefix =/usr/local/courier-authlib -- sysconfdir =/etc -- with-authmysql -- with-mysql-libs =/usr/local/mysql/lib/-- -mysql-nodes des =/usr/include/mysql -- with-redhat -- with-authmysqlrc =/etc/authmysqlrc -- with-authdaemonrc =/etc/authdaemonrc -- with-ltdl-lib = /usr/lib -- with-ltdl-include =/usr/include

[Root @ mail courier-authlib-0.63.1.20111230] # make

[Root @ mail courier-authlib-0.63.1.20111230] # make install

[Root @ mail courier-authlib-0.63.1.20111230] # service postfix restart

[Root @ mail etc] # module used for cp authdaemonrc. dist authdaemonrc Verification

[Root @ mail etc] # cp authmysqlrc. dist authmysqlrc

[Root @ mail etc] # vim authdaemonrc

[Root @ mail etc] # vim authmysqlrc

[Root @ mail src] # cd/usr/local/src/courier-authlib-0.63.1.20111230/

[Root @ mai courier-authlib-0.63.1.20111230] # cp courier-authlib.sysvinit/etc/init. d/courier-authlib copy Startup Script

[Root @ mail courier-authlib-0.63.1.20111230] # chmod a + x/etc/init. d/courier-authlib modify permission executable

[Root @ mail courier-authlib-0.63.1.20111230] # chkconfig courier-authlib on add boot startup

[Root @ mail courier-authlib-0.63.1.20111230] # service courier-authlib start courier-authlib

[Root @ mail courier-authlib-0.63.1.20111230] # cd/usr/local/courier-authlib/

[Root @ mail courier-authlib] # vim/etc/ld. so. conf. d/courier-authlib.conf import warehouse File

[Root @ mail lib] # ldconfig

[Root @ mail lib] # ldconfig-pv | grep courie

[Root @ mail lib] # cd ..

[Root @ mail courier-authlib] # ln-s/usr/local/courier-authlib/include // usr/include/courier-authlib file to create a symbolic link

[Root @ mail courier-authlib] # vim/etc/postfix/main. cf

Add the following content so that postfix supports virtual domains and virtual accounts.

Create the directory where the virtual user mailbox is located, and grant its permission to the postfix user

[Root @ mail ~] # Mkdir-pv/var/mailbox

[Root @ mail ~] # Chown-R postfix/var/mailbox

Reconfigure SMTP authentication

[Root @ mail postfix] # vim/usr/lib/sasl2/smtpd. conf

7. Install extman

[Root @ mail ~] # Tar-zxvf extman-1.1.tar.gz

[Root @ mail ~] # Cd extman-1.1

[Root @ mail extman-1.1] # cd docs/

[Root @ mail docs] # mysql-u root-p <extmail. SQL import database

[Root @ mail docs] # mysql-u root-p <init. SQL

[Root @ mail docs] # mysql-u root-p log on to the database for account authorization

Mysql> GRANT all privileges on extmail. * TO extmail @ localhost identified by 'extmail ';

Mysql> GRANT all privileges on extmail. * TO extmail@127.0.0.1 identified by 'extmail ';

Mysql> flush privileges; refresh authorization

[Root @ mail docs] # cp mysql_virtual _ */etc/postfix/

[Root @ mail postfix] # service postfix restart postfix service

8. Install dovecot

[Root @ mail ~] # Useradd-M-s/sbin/nologin dovecot create an account

[Root @ mail ~] # Cd/usr/local/src/dovecot-2.0.16/

[Root @ mail dovecot-2.0.16] #./configure -- sysconfdir =/etc -- with-mysql

[Root @ mail dovecot-2.0.16] # make

[Root @ mail dovecot-2.0.16] # make install

[Root @ mail dovecot-2.0.16] # cd/usr/local/share/doc/dovecot/

[Root @ mail dovecot] # cp example-config/dovecot. conf/etc/dovecot. conf


[Root @ mail ~] # Vim/etc/dovecot-mysql.conf create mysql. conf file, let dovecot and mysql combined

[Root @ mail ~] # Vim/etc/postfix/main. cf

9. Install extmail

[Root @ mail ~] # Tar-zxvf extmail-1.2.tar.gz

[Root @ mail ~] # Mkdir-pv/var/www/extsuite

[Root @ mail ~] # Music extman-1.1/var/www/extsuite/extman

[Root @ mail ~] # Music extmail-1.2/var/www/extsuite/extmail

[Root @ mail ~] # Cd/var/www/extsuite/extmail/

[Root @ mail extmail] # cp webmail. cf. default webmail. cf

[Root @ mail extmail] # vim webmail. cf

Note: The combination of Apache and extmail relies on cgi.

[Root @ mail extmail] # vim/etc/httpd/conf/httpd. conf modify apache to configure the virtual host

[Root @ mail extmail] # chown-R postfix. postfix/var/www/extsuite/extmail/cgi/modify the cgi execution file owner as an apache running user

[Root @ mail extmail] # service httpd restart

Extmail will use the perl Unix: syslogd function to install the patch.

[Root @ mail ~] # Tar zxvf Unix-Syslog-0.100.tar.gz-C/usr/local/src/Unix-Syslog-0.100

[Root @ mail ~] # Cd Unix-Syslog-0.100

[Root @ mail Unix-Syslog-0.100] # perl Makefile. PL

[Root @ mail Unix-Syslog-0.100] # make

[Root @ mail Unix-Syslog-0.100] # make install

[Root @ mail Unix-Syslog-0.100] # cd/var/www/extsuite/extman/

[Root @ mail extman] # cp webman. cf. default webman. cf

[Root @ mail extman] # vim webman. cf

[Root @ mail extman] # chown-R postfix. postfix/var/www/extsuite/extman/cgi/modify the owner of the cgi directory

[Root @ mail extman] # vim/etc/httpd/conf/httpd. conf

[Root @ mail extman] # service httpd restart

Iii. logon Management

Start various services

Enter http: // 192.168.126.129/extmail in the address bar

Select Manage to log on to extman for background management. The default management account is: root@extmail.org password: extmail * 123 *

Then you can manage it.

This article is from the "HWOTT" blog, please be sure to keep this source http://iceblock.blog.51cto.com/6758400/1221962


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.