利用Ubuntu ExtMail 30分钟配置好一个功能强大的邮件

利用Ubuntu ExtMail 30分钟配置好一个功能强大的邮件服务器V1.1,以下文档通过19个大的步骤进行配置,配置成功! 

由于网上Ubuntu ExtMail的步骤特别多,看了都头痛,在此特别给朋友们制作了一个简洁的安装文档,希望大家喜欢:)

环境:
Ubuntu         8.04 TLS
postfix        2.5.1
ExtMail       1.2
extman        1.1 

1.安装依赖包
apt-get install mysql-client-5.0 mysql-server apache2 postfix postfix-mysql postfix-doc courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl libapache2-mod-fastcgi libfcgi-perl build-essential libtool libnet-server-perl libnet-cidr-perl libberkeleydb-perl arc zoo lzop liblzo1 libstdc++5 libgd-gd2-perl libfile-tail-perl libdigest-sha1-perl libdigest-HMAC-perl libnet-ip-perl libnet-dns-perl libhtml-tagset-perl libhtml-parser-perl libio-stringy-perl libio-multiplex-perl libio-socket-ssl-perl libio-zlib-perl libnet-ssleay-perl libunix-syslog-perl libtimedate-perl libmailtools-perl libconvert-binhex-perl libconvert-tnef-perl libconvert-uulib-perl libcompress-zlib-perl libarchive-zip-perl libarchive-tar-perl perl-suid

你会被询问以下问题:
Create directories for web-based administration? <– No
General type of mail configuration: <– Internet Site
System mail name: <– mail.extmail.org

2.下载extmail-1.2和extman-1.1,并修改配置
下载地址:
tar xvzf extmail-1.2.tar.gz
tar xvzf extman-1.1.tar.gz
mkdir /var/www/extsuite
mv extmail-1.2/ /var/www/extsuite/extmail
mv extman-1.1/ /var/www/extsuite/extman
cp /var/www/extsuite/extman/docs/mysql_virtual_*.cf /etc/postfix/

注意,非常重要:修改/etc/postfix/mysql_virtual_*.cf,将其中的“localhost”均改为“127.0.0.1”,修改数据库配置,保证能够连到mysql

3.建立相关系统用户
1)新建普通用户
useradd -m -d /home/hugwww -s /bin/bash hugwww
passwd hugwww

2)删除以前gid,uid为1000的用户
userdel -r gaojinbo

3)建立extmail所需要的用户和组
groupadd -g 1000 vgroup
useradd -m -g vgroup -u 1000 -d /home/vmail -s /bin/false vuser

4.修改权限
chmod 755 /etc/postfix/mysql_virtual_*.cf
chgrp postfix /etc/postfix/mysql_virtual_*.cf
chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/
chown -R vuser:vgroup /var/www/extsuite/extman/cgi/
cd /var/www/extsuite/extmail/
cp webmail.cf.default webmail.cf
cd /var/www/extsuite/extman/
cp webman.cf.default webman.cf

5.修改/var/www/extsuite/extmail/webmail.cf里的其他参数,主要变动的内容见下:
vi /var/www/extsuite/extmail/webmail.cf

SYS_USER_LANG = zh_CN
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock
SYS_AUTHLIB_SOCKET = /var/run/courier/authdaemon/socket
SYS_MAILDIR_BASE = /home/vmail
SYS_MESSAGE_SIZE_LIMIT = 102400000 //注:这个选项为修改附件的大小,默认为5M,你可以自行修改,这里面改了是不行的,还要去postfix里面修改,我在下面会讲到

6.修改 /var/www/extsuite/extman/webman.cf的参数
vi /var/www/extsuite/extman/webman.cf

SYS_CAPTCHA_ON = 0 //用于关闭后台登录时的验证码
SYS_MAILDIR_BASE = /home/vmail
SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock
SYS_LANG = zh_CN
SYS_GROUPMAIL_SENDER = postmaster@extmail.org //注:这个选项是,你在后台群发后,用户收到邮件的发件人地址,你可以自行修改

7.修改/var/www/extsuite/extman/contrib/passwd2ext.pl

my $sock = ‘/var/run/mysqld/mysqld.sock’;

8.数据库初始化
执行以下命令导入mysql数据库结构及初始化数据,注意必须逐行输入以下命令.
请把linuxidc.com替换成自己的密码

mysql -u root -plinuxidc.com < /var/www/extsuite/extman/docs/extmail.sql
mysql -u root -plinuxidc.com < /var/www/extsuite/extman/docs/init.sql

9.建立临时文件夹:
mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman

编辑rc.local,加入下面内容以实现开机自动建立编辑rc.local,加入下面内容以实现开机自动建立
vi  /etc/rc.local

if [ ! -d /tmp/extman ]; then
mkdir /tmp/extman
chown -R vuser:vgroup /tmp/extman

fi 

10.建立上边导入mysql的postmaster@extmail.org帐户的Maildir,请输入如下命令:
cd /var/www/extsuite/extman/tools
./maildirmake.pl /home/vmail/extmail.org/postmaster/Maildir
chown -R vuser:vgroup /home/vmail/extmail.org/

11.Postfix配置
cd /etc/postfix/
cp main.cf main.cf_backup

vi main.cf
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
mydomain = extmail.org
myhostname = mail.$mydomain
myorigin = $mydomain
mydestination = mail.$mydomain, localhost.$mydomain, localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
relayhost =
mynetworks = 127.0.0.1
message_size_limit = 102400000
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
######### virtual config############
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your Maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps

重启 postfix
/etc/init.d/postfix restart

12.SMTP身份认证
cd /etc/postfix
openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wydxsd.html