red hat企业版6.0带WEB界面的邮件服务器
需要安装软件包 www.zhishiwu.com
extmail-1.2.tar.gz extman-1.1.tar.gz
dovecot dovecot-mysql bind mysql-server perl-GD-2.45-1.el6.rfx.x86_64.rpm perl-CGI* perl-Unix-Syslog-1.1-1.el6.rf.x86_64.rpm mod_perl
我是直接用yum安装的
www.zhishiwu.com
解压extmail
tar zxvf extmail-1.2.tar.gz -C /var/www/html/
解压extman
tar zxvf extman-1.1.tar.gz -C /var/www/html/
cd /var/www/html
mv extmail-1.2/ extmail
mv extman-1.1/ extman
cd extmail
mv webmail.cf.default webmail.cf
useradd -M -s /sbin/nologin -u 1000 postadmin
打开配置文件修改以下内容
vim webmail.cf
SYS_CONFIG = /var/www/html/extmail/
SYS_LANGDIR = /var/www/html/extmail/lang
SYS_TEMPLDIR = /var/www/html/extmail/html
SYS_MAILDIR_BASE = /mailbox
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
打开httpd配置文件
vim /etc/httpd/conf/httpd.conf
<VirtualHost 10.0.0.1:80>
ServerName www.likun.com
DocumentRoot /var/www/html/extmail/html/
ScriptAlias /extmail/cgi /var/www/html/extmail/cgi
Alias /extmail /var/www/html/extmail/html
SuexecUserGroup postadmin postadmin
</VirtualHost>
chown -R postadmin.postadmin /var/www/html/extmail/cgi/
chown -R postadmin.postadmin /var/www/html/extman/cgi/
在/创建一个文件夹存放邮件
mkdir mailbox
赋予权限
chown postadmin.postadmin mailbox
cd /var/www/html/extman/
mv webman.cf.default webman.cf
打开后台配置文件
vim webman.cf
修改以下
SYS_CONFIG = /var/www/html/extman/
SYS_LANGDIR = /var/www/html/extman/lang
SYS_TEMPLDIR = /var/www/html/extman/html
SYS_MAILDIR_BASE = /mailbox
打开httpd配置文件
vim /etc/httpd/conf/httpd.conf
在虚拟主机里面在添加2句话
原:
<VirtualHost 10.0.0.1:80>
ServerName www.likun.com
DocumentRoot /var/www/html/extmail/html/
ScriptAlias /extmail/cgi /var/www/html/extmail/cgi
Alias /extmail /var/www/html/extmail/html
SuexecUserGroup postadmin postadmin
</VirtualHost>
修改后
<VirtualHost 10.0.0.1:80>
ServerName www.likun.com
DocumentRoot /var/www/html/extmail/html/
ScriptAlias /extmail/cgi /var/www/html/extmail/cgi
Alias /extmail /var/www/html/extmail/html
SuexecUserGroup postadmin postadmin
ScriptAlias /extman/cgi /var/www/html/extman/cgi
Alias /extman /var/www/html/extman/html
</VirtualHost>
cd /var/www/html/extman/docs
[root@localhost docs]# mysql -u root -p < extmail.sql
Enter password:
[root@localhost docs]# mysql -u root -p < init.sql
Enter password:
后台初始密码extmail*123*
mkdir /tmp/extman
chmod 777 /tmp/extman/
修改postfix配置文件
vim /etc/postfix/main.cf
修改以下
myhostname = mail.likun.com
mydomain = likun.com
myorigin = $mydomain
inet_interfaces = all
添加以下
virtual_mailbox_base = /mailbox/
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_transport = virtual
cd /etc/postfix
vim mysql_virtual_alias_maps.cf
添加内容
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
additional_conditions = AND active = '1'
vim mysql_virtual_domains_maps.cf
添加内容
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = domain
where_field = domain
additional_conditions = AND active = '1'
vim mysql_virtual_limit_maps.cf
添加内容
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = quota
where_field = username
additional_conditions = AND active = '1'
vim mysql_virtual_mailbox_maps.cf
添加内容
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
additional_conditions = AND active = '1'
vim mysql_virtual_sender_maps.cf
添加内容
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = username
where_field = username
additional_conditions = AND active = '1'
打开dovecot配置文件
vim /etc/dovecot/dovecot.conf
启用pop3
protocols = imap pop3 lmtp
cd /etc/dovecot/conf.d/
vim 10-auth.conf
修改以下
disable_plaintext_auth = on
auth_mechanisms = plain login
#!include auth-system.conf.ext
!include auth-sql.conf.ext
vim 10-mail.conf
修改以下
mail_location = maildir:/Mailbox/%d/%n/maildir/
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
vim 10-master.conf
修改以下
# unix_listener auth-userdb {
#mode = 0600
#user =
#group =
# }
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
}
下面来做DNS的配置
Vim /etc/named.conf
修改以下
options {
// listen-on port 53 { 127.0.0.1; };
// listen-on-v6 port 53 { ::1; };
directory "/var/named";
// dump-file "/var/named/data/cache_dump.db";
// statistics-file "/var/named/data/named_stats.txt";
// memstatistics-file "/var/named/data/named_mem_stats.txt";
// allow-query { localhost; };
// recursion yes;
// dnssec-enable yes;
// dnssec-validation yes;
// dnssec-lookaside auto;
/* Path to ISC DLV key */
// bindkeys-file "/etc/named.iscdlv.key";
};
在最后添加
zone "likun.com" {
type master;
file "likun.com.zone";
};
Cd /var/name
cp -p named.empty likun.com.zone
vim likun.com.zone
修改内容
$TTL 3H
@ IN SOA localhost. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS localhost.
www IN A 10.0.0.1
mail IN A 10.0.0.1
@ IN MX 10 mail.likun.com.
~
测试下DNS
[root@localhost named]# nslookup
> www.likun.com
Server: 10.0.0.1
Address: 10.0.0.1#53
Name: www.likun.com
Address: 10.0.0.1
> mail.likun.com
Server: 10.0.0.1
Address: 10.0.0.1#53
Name: mail.likun.com
Address: 10.0.0.1
> set type=mx
> likun.com
Server: 10.0.0.1
Address: 10.0.0.1#53
likun.com mail exchanger = 10 mail.likun.com.
> exit
[root@localhost named]#
打开后台web输入http://mail.likun.com/extman
输入初始密码
登陆后台以后再域列表把原来的域删除然后新建域
注:这里一定要吧自由注册打开,不然用户不可以直接注册。如果不开放自由注册可以自己登陆后台注册
保存以后打开web输入 http://mail.likun.com
注册邮箱
我已经注册过了aaa@likun.com bbb.@likun.com
注册完以后登陆测试