Build a powerful email server based on Fedora

Source: Internet
Author: User
Article Title: create a powerful email server based on Fedora. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   I. Software preparation
A. Check whether the following software has been installed on your system.
1. pam
2. pam-devel
3. mysql
4. mysql-servel
5. mysql-devel
6. imap-devel
7. sharutils
  
B. download the following software
1. metamail *. i386.rpm
2. pam-mysql
3. cyrus-sasl-2.1.15
4. postfix-2.0.16
5. courier-imap
  
C. Description
  
Mysql-devel has 3rd disks. I forgot to install it. As a result, pam-mysql and postfix cannot be compiled. Metamail and sharutils use the verification code.
  
   Ii. Create a mysql database and table
A. [root @ localhost root] # mysql
  
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 3 to server version: 3.23.58
  
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
  
Mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-
  
Database changed
Mysql> insert into db (Host, Db, User, Select_priv) VALUES ('localhost', 'postfix', 'postfix', 'y ');
Query OK, 1 row affected (0.00 sec)
  
Mysql> create database postfix;
Query OK, 1 row affected (0.00 sec)
  
Mysql> grant all on postfix. * TO postfix @ localhost
-> Identified by "postfix ";
Query OK, 0 rows affected (0.00 sec)
  
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
  
Mysql> quit
Bye
  
B. Copy the following text to postfix. SQL.
  
######## Potfix_ SQL ######### bigin ##################
Create table alias (
Username varchar (255) not null default '',
Goto text not null,
Domain varchar (255) not null default '',
Primary key (username)
) TYPE = MyISAM;
Create table domain (
Domain varchar (255) not null default '',
Description varchar (255) not null default '',
Primary key (domain)
) TYPE = MyISAM;
  
Create table mailbox (
Userid char (20) binary not null default '',
Username varchar (255) not null default '',
Password varchar (255) not null default '',
Home varchar (255) not null default '',
Maildir varchar (255) not null default '',
Name varchar (255) not null default '',
Uid smallint (5) unsigned not null default '20140901 ',
Gid smallint (5) unsigned not null default '20140901 ',
Quota varchar (255) not null default '',
Domain varchar (255) not null default '',
Create_date date not null default '2017-00-00 ',
Create_time time not null default '00: 00: 00 ',
Change_date date not null default '2017-00-00 ',
Change_time time not null default '00: 00: 00 ',
Last_access int (10) unsigned not null default '0 ',
Passwd_lastchanged int (10) unsigned not null default '0 ',
Status tinyint (4) not null default '1 ',
Primary key (username ),
KEY status (status)
) TYPE = MyISAM;
##################### End ################## ######
  
[Root @ localhost root] # mysql postfix </work/postfix. SQL
  
C. Some descriptions of the table content.
  
Mysql> use postfix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-
  
Database changed
Mysql> show tables;
+ ------------------- +
| Tables_in_postfix |
+ ------------------- +
| Alias |
| Domain |
| Mailbox |
+ ------------------- +
3 rows in set (0.00 sec)
  
Mysql> desc alias;
+ ---------- + -------------- + ------ + ----- + --------- + ------- +
| Field | Type | Null | Key | Default | Extra |
+ ---------- + -------------- + ------ + ----- + --------- + ------- +
| Username | varchar (255) | PRI |
| Goto | text |
| Domain | varchar (255) |
+ ---------- + -------------- + ------ + ----- + --------- + ------- +
3 rows in set (0.00 sec)
  
Mysql> desc domain;
+ ------------- + -------------- + ------ + ----- + --------- + ------- +
| Field | Type | Null | Key | Default | Extra |
+ ------------- + -------------- + ------ + ----- + --------- + ------- +
| Domain | varchar (255) | PRI |
| Description | varchar (255) |
+ ------------- + -------------- + ------ + ----- + --------- + ------- +
2 rows in set (0.00 sec)
  
Mysql> desc mailbox;
+ -------------------- + ------ + ----- + ------------ + ------- +
| Field | Type | Null | Key | Default | Extra |
+ -------------------- + ------ + ----- + ------------ + ------- +
| Userid | varchar (20) binary |||||
| Username | varchar (255) | PRI |
| Password | varchar (255) |
| Home | varchar (255) |
| Maildir | varchar (255) |
| Name | varchar (255) |
| Uid | smallint (5) unsigned | 12345 |
| Gid | smallint (5) unsigned | 12345 |
| Quota | varchar (255) |
| Domain | varchar (255) |
| Create_date | date | 0000-00-00 |
| Create_time | time | 00:00:00 |
| Change_date | date | 0000-00-00 |
| Change_time | time | 00:00:00 |
| Last_access | int (10) unsigned | 0 |
| Passwd_lastchanged | int (10) unsigned | 0 |
| Status | tinyint (4) | MUL | 1 |
+ -------------------- + ------ + ----- + ------------ + ------- +
17 rows in set (0.00 sec)
  
Mysql>
Domain table explanation:
Any domain in the domain.
Description is usually two types of "local:" for local or "virtual.
Description of the alias table:
Username is a virtual mailbox address@domain.tld that will be forwarded to the connection under goto.
Goto can use a simple name, if it is a local user name, such as (root, postmaster, etc.), or the entire mailbox name, user@domain.tld.
  
Mailbox table content:
Userid user code
Username can be user. domain. tld or user@domain.tld
Use encrypt ('Password') to input the password in mysql.
The real name used by name.
Uid virtual user identity uid
Gid of the gid Group
Home "/usr/local/virtual/". Maildirs must be in this directory.
Domain is not required, but some software needs it.
Maildir is the whole address and must end.
Quota mailbox space or information limit.
Status 0 is forbidden. "MYSQL_WHERE_CLAUSE = status ".
  
   Iii. pam-mysql Compilation
Tar pam-mysql-5.0.tar.gz
Make cp pam_mysql.so/lib/security
  
   4. Modify pam
[Root @ localhost pam_mysql] # cd/etc/pam. d
[Root @ localhost pam. d] # cp/work/postfix
[Root @ localhost pam. d] #
The postfix content is as follows:
#########/Etc/pam. d/postfix ##################
Echo auth sufficient pam_mysql.so user = postfix passwd = postfix host = localhost db = postfix table = mailbox usercolumn = username passwdcolumn = password crypt = 1
Echo account requir

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.