歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

red hat企業版6.0帶WEB界面的郵件服務器

red hat企業版6.0帶WEB界面的郵件服務器

需要安裝軟件包  www.2cto.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.2cto.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
 
注冊郵箱
 

我已經注冊過了[email protected] [email protected]
注冊完以後登陸測試
 

 
 
 
 

 
 
 
Copyright © Linux教程網 All Rights Reserved