相关下载:sysv-rc-conf
一、sysv-rc-conf简介
sysv-rc-conf是一个强大的服务管理程序,群众的意见是sysv-rc-conf比chkconfig好用。
二、背景知识
1、Ubuntu运行级别
Linux 系统任何时候都运行在一个指定的运行级上,并且不同的运行级的程序和服务都不同,所要完成的工作和要达到的目的都不同,系统可以在这些运行级之间进行切换,以完成不同的工作。
Ubuntu 的系统运行级别:
0 系统停机状态
1 单用户或系统维护状态
2~5 多用户状态
6 重新启动
查看当前运行级别,执行命令:
runlevel
( runlevel 显示上次的运行级别和当前的运行级别,“N”表示没有上次的运行级别。)
切换运行级别,执行命令:
int [0123456Ss]
( 即在 init 命令后跟一个参数,此参数是要切换到的运行级的运行级代号,如:用 init 0 命令关机;用 init 6 命令重新启动。)
Linux 系统主要启动步骤:
1. 读取 MBR 的信息,启动 Boot Manager
Windows 使用 NTLDR 作为 Boot Manager,如果您的系统中安装多个
版本的 Windows,您就需要在 NTLDR 中选择您要进入的系统。
Linux 通常使用功能强大,配置灵活的 GRUB 作为 Boot Manager。
2. 加载系统内核,启动 init 进程
init 进程是 Linux 的根进程,所有的系统进程都是它的子进程。
3. init 进程读取 /etc/inittab 文件中的信息,并进入预设的运行级别,
按顺序运行该运行级别对应文件夹下的脚本。脚本通常以 start 参数启
动,并指向一个系统中的程序。
通常情况下, /etc/rcS.d/ 目录下的启动脚本首先被执行,然后是
/etc/rcN.d/ 目录。例如您设定的运行级别为 3,那么它对应的启动
目录为 /etc/rc3.d/ 。
4. 根据 /etc/rcS.d/ 文件夹中对应的脚本启动 Xwindow 服务器 xorg
Xwindow 为 Linux 下的图形用户界面系统。
5. 启动登录管理器,等待用户登录
Ubuntu 系统默认使用 GDM 作为登录管理器,您在登录管理器界面中
输入用户名和密码后,便可以登录系统。(您可以在 /etc/rc3.d/
文件夹中找到一个名为 S13gdm 的链接)
三、安装sysv-rc-conf
sudo apt-get install sysv-rc-conf
四、使用sysv-rc-conf
sudo sysv-rc-conf
操作界面十分简洁,你可以用鼠标点击,也可以用键盘方向键定位,用空格键选择,用Ctrl+N翻下一页,用Ctrl+P翻上一页,用Q退出。
常见的系统服务有:
acpi-support 高级电源管理支持
acpid acpi 守护程序.这两个用于电源管理,非常重要
alsa 声音子系统
alsa-utils
anacron cron 的子系统,将系统关闭期间的计划任务,在下一次系统运行时执行。
apmd acpi 的扩展
atd 类似于 cron 的任务调度系统。建议关闭
binfmt-support 核心支持其他二进制的文件格式。建议开启
bluez-utiles 蓝牙设备支持
bootlogd 启动日志。开启它
cron 任务调度系统,建议开启
cupsys 打印机子系统。
dbus 消息总线系统(message bus system)。非常重要
dns-clean 使用拨号连接时,清除 dns 信息。
evms 企业卷管理系统(Enterprise Volumn Management system)
fetchmail 邮件用户代理守护进程,用于收取邮件
gdm gnome 登录和桌面管理器。
gdomap
gpm 终端中的鼠标支持。
halt 别动它。
hdparm 调整硬盘的脚本,配置文件为 /etc/hdparm.conf。
hibernate 系统休眠
hotkey-setup 笔记本功能键支持。支持类型包括: HP, Acer, ASUS, Sony,Dell, 和 IBM。
hotplug and hotplug-net 即插即用支持,比较复杂,建议不要动它。
hplip HP 打印机和图形子系统
ifrename 网络接口重命名脚本。如果您有十块网卡,您应该开启它
inetd 在文件 /etc/inetd.conf 中,注释掉所有你不需要的服务。如果该文件不包含任何服务,那关闭它是很安全的。
klogd 重要。
linux-restricted-modules-common 受限模块支持。
/lib/linux-restricted-modules/ 文件夹中的模块为受限模块。例如某些驱动程序,如果您没有使用受限模块,就不需要开启它。
lvm 逻辑卷管理系统支持。
makedev 创建设备文件,非常重要。
mdamd 磁盘阵列
module-init-tools 从/etc/modules 加载扩展模块,建议开启。
networking 网络支持。按 /etc/network/interfaces 文件预设激活网络,非常重要。
ntpdate 时间同步服务,建议关闭。
pcmcia pcmcia 设备支持。
powernowd 移动 CPU 节能支持
ppp and ppp-dns 拨号连接
readahead 预加载库文件。
reboot 别动它。
resolvconf 自动配置 DNS
rmnologin 清除 nologin
rsync rsync 守护程序
sendsigs 在重启和关机期间发送信号
single 激活单用户模式
ssh ssh 守护程序。建议开启
stop-bootlogd 在 2,3,4,5 运行级别中停止 bootlogd 服务
sudo 检查 sudo 状态。重要
sysklogd 系统日志
udev & udev-mab 用户空间 dev 文件系统(userspace dev filesystem)。重要
umountfs 卸载文件系统
urandom 随机数生成器
usplash 开机画面支持
vbesave 显卡 BIOS 配置工具。保存显卡的状态
xorg-common 设置 X 服务 ICE socket。
adjtimex 调整核心时钟的工具
dirmngr 证书列表管理工具,和 gnupg 一起工作。
hwtools irqs 优化工具
libpam-devperm 系统崩溃之后,用于修理设备文件许可的守护程序。
lm-sensors 板载传感器支持
mdadm-raid 磁盘陈列管理器
screen-cleanup 清除开机屏幕的脚本
xinetd 管理其他守护进程的一个 inetd 超级守护程序
» 阅读全文
软件环境:
邮件传输代理(MTA) Postfix 使用最新版本2.5.1
邮件投递代理(MDA) maildrop 支持过滤和强大功能
数据库/目录服务 MySQL 可选openLDAP或NetScape LDAP,本文以MySQL为蓝本
Web帐户管理后台 ExtMan 支持无限域名、无限用户
POP3 服务器 Courier-IMAP 只使用pop3部分,对于大部分企业而言完全足够
WebMail 系统 ExtMail 支持多语言、全部模板化,功能基本齐全
SMTP认证库 Cyrus SASL 标准的SASL实现库,可以支持Courier authlib
其他数据认证库 Courier Authlib authlib是maildrop, courier-imap等服务的关键部件
日志分析及显示 mailgraph_ext 在ExtMan中已经包含了
系统LAMP已经配好,就不再多讲了。
1.下面安装postfix,Courier-IMAP,SASL,Courier Authlib还有perl相关等
apt-get install 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,并修改配置
我用的是ExtMail 1.1.0.tar.gz和ExtMan 1.0.0.tar.gz
tar zxvf extmail-1.1.0.tar.gz
tar zxvf extman-1.0.0.tar.gz
mkdir /var/www/extsuite
mv extmail-1.1.0 /var/www/extsuite/extmail
mv extman-1.0.0 /var/www/extsuite/extman
cp /var/www/extsuite/extman/docs/mysql_virtual_*.cf /etc/postfix/
3.注意:修改/etc/postfix/mysql_virtual_*.cf,将其中的“localhost”均改为“127.0.0.1”,另外修改这些文件内的数据库配置,保证能够连到mysql
4.修改权限以至于postfix可以读取
chmod 755 /etc/postfix/mysql_virtual_*.cf
chgrp postfix /etc/postfix/mysql_virtual_*.cf
5.注:如果打算使用默认用户vuser:vgroup,那么需创建此用户,且uid:gid为2000:2000.而本文为了以后方便,使用的是手动创建的用户vmail,所以需修改下边这些文件中的相关参数.
6.新建一个用户vmail组为vmail uid和gid为1000,不允放登录。用户下用来存放所有的用户的邮件
groupadd -g 2000 vmail
useradd -m -g vmail -u 2000 -d /home/vmail -s /bin/bash vmail
chown -R vmail:vmail /var/www/extsuite/extmail/cgi/
chown -R vmail:vmail /var/www/extsuite/extman/cgi/
cd /var/www/extsuite/extmail/
cp webmail.cf.default webmail.cf
7.修改/var/www/extsuite/extmail/webmail.cf里的其他参数,主要变动的内容见下:
SYS_USER_LANG = zh_CN
SYS_USER_CHARSET = gb2312
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = 127.0.0.1
SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock
SYS_AUTHLIB_SOCKET = /var/run/courier/authdaemon/socket
SYS_G_ABOOK_FILE_CHARSET = gb2312
SYS_MAILDIR_BASE = /home/vmail
SYS_MESSAGE_SIZE_LIMIT = 102400000 //注:这个选项为修改附件的大小,默认为5M,你可以自行修改,这里面改了是不行的,还要去postfix里面修改,我在下面会讲到。
8.修改 /var/www/extsuite/extman/webman.cf的参数
SYS_CAPTCHA_ON = 0 //用于关闭后台登录时的验证码
SYS_MAILDIR_BASE = /home/vmail
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
SYS_MYSQL_USER = webman
SYS_MYSQL_PASS = webman
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = 127.0.0.1
SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock
SYS_LANG = zh_CN
SYS_GROUPMAIL_SENDER = postmaster@extmail.org //注: 这个选项是,你在后台群发后,用户收到邮件的发件人地址,你可以自行修改。
9.修改 /var/www/extsuite/extmail/dispatch-init
SU_UID=vmail
SU_GID=vmail
10.修改 /var/www/extsuite/extmail/dispatch_lig.sh
BASE=/var/www/extsuite/extmail
$BASE/tools/suid-with -u vmail -g vmail /usr/bin/perl $BASE/dispatch.fcgi
11.修改/var/www/extsuite/extman/tools 下所有文件
--setgid=vmail
--setuid=vmail
注:这上面实际上都是把vuser改成vmail,vgroup改成vmail.
12.修改/var/www/extsuite/extman/contrib/passwd2ext.pl
my $sock = '/var/run/mysqld/mysqld.sock';
my $uid = '2000';
my $gid = '2000';
13.修改/var/www/extsuite/extman/libs/Ext/Mgr/LDAP.pm中
uidNumber => $opt{uidnumber} || '2000', //349行
gidNumber => $opt{gidnumber} || '2000', //350行
︰
uidNumber => $opt{uidnumber} || '2000', //541行
gidNumber => $opt{gidnumber} || '2000', //542行
14.修改/var/www/extsuite/extman/docs/init.ldif
uidNumber: 1000
gidNumber: 1000
15.修改 /var/www/extsuite/extman/docs/init.sql 行中的uid和gid
INSERT INTO `mailbox` VALUES ('postmaster@extmail.org','postmaster','$1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0','','PostMaster','','extmail.org/postmaster/Maildir/','extmail.org/postmaster','104857600S','52428800S','extmail.org',2000,2000,'2007-02-14 15:10:04','2010-11-08',1,0,0,0,0,0,0,0,'my question', 'my answer');
16.修改 /var/www/extsuite/extman/docs/extmail.sql
uidnumber int(6) NOT NULL default '2000',
gidnumber int(6) NOT NULL default '2000',
17.数据库初始化
执行以下命令导入mysql数据库结构及初始化数据,注意必须逐行输入以下命令.
mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql
mysql -u root -p < /var/www/extsuite/extman/docs/init.sql
18.建立临时文件夹:
mkdir /tmp/extman
chown -R vmail:vmail /tmp/extman
19.修改/etc/rc.local
编辑rc.local,加入下面内容以实现开机自动建立编辑rc.local,加入下面内容以实现开机自动建立
if [ ! -d /tmp/extman ]; then
mkdir /tmp/extman
chown -R vmail:vmail /tmp/extman
fi
20.建立上边导入mysql的postmaster@extmail.org帐户的Maildir,请输入如下命令:
cd /var/www/extsuite/extman/tools
./maildirmake.pl /home/vmail/extmail.org/postmaster/Maildir
chown -R vmail:vmail /home/vmail/extmail.org/
21.Postfix配置
cd /etc/postfix/
cp main.cf main.cf_backup
修改 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:2000
virtual_gid_maps = static:2000
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
22.重启 postfix
/etc/init.d/postfix restart
23.好了现在我们来做SMTP身份认证了
cd /etc/postfix
openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509
它们询问你问题
Country Name (2 letter code) [AU]: //国家
State or Province Name (full name) [Some-State]: //省
Locality Name (eg, city) []: //城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]: //组织名称
Organizational Unit Name (eg, section) []: 组织单位名称
Common Name (eg, YOUR name) []: 通用名称
Email Address []: 邮件地址
24.接下来是Apache2配置:
vi /etc/apache2/site-available/mail
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName mail.meiu.cn #这里改成你自己的域名
DocumentRoot /var/www/extsuite/extmail/html
Alias /extmail/cgi/ /var/www/extsuite/extmail/dispatch.fcgi/
Alias /extmail /var/www/extsuite/extmail/html
<Ifmodule mod_fastcgi.c>
FastCgiExternalServer /var/www/extsuite/extmail/dispatch.fcgi -host 127.0.0.1:8888 -idle-timeout 240
</Ifmodule>
<Location "/extmail/cgi">
SetHandler fastcgi-script
</Location>
ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman /var/www/extsuite/extman/html
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
SuexecUserGroup vmail vmail
</VirtualHost>
25.编辑/var/www/extsuite/extmail/dispatch-init文件:
MAXFORK=10
最后启动fastcgi server:
/var/www/extsuite/extmail/dispatch-init start
如果没有意外将启动10个dispatch.fcgi守护进程,可以通过以下命令将启动命令加到rc.local中,实现自启动:
echo "/var/www/extsuite/extmail/dispatch-init start">>/etc/rc.local
26.SMTP认证
1).更改saslauthd
vi /etc/default/saslauthd
更改如下几项
START=yes //设置开机自动启动
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
2). 创建文件/etc/pam.d/smtp
vi /etc/pam.d/smtp
内容如下:
auth required pam_mysql.so user=extmail passwd=extmail host=127.0.0.1 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=extmail passwd=extmail host=127.0.0.1 db=extmail table=mailbox usercolumn=username passwdcolumn=password crypt=1
解释一下:其实就是定义一个查询的方式 crypt=1或者0表示加密或者不加密 注意对照你的数据库 还有用户名密码 请保持跟自己的一致
3).由于postfix处于chroot,要想调用到saslauthd 必须更改socket文件
mkdir -p /var/spool/postfix/var/run/saslauthd
vi /etc/postfix/sasl/smtpd.conf
创建smtpd.conf,并且内容如下:
pwcheck_method:saslauthd
mech_list:plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: extmail #修改成自己的用户
sql_password: extmail #修改成自己的密码
sql_database: extmail
log_level:7
sql_select: SELECT password FROM mailbox WHERE username='%u@%r' and domain='%r'
4).更改main.cf 文件
###########SMTP AUTH config###############
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
###########smtpd related config############
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_sender_login_mismatch, reject_unknown_sender_domain, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname, check_recipient_maps
5).添加用户
adduser postfix sasl
6).重启postfix saslauthd
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
7).测验
telnet localhost 25
ehlo localhost
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
出现这两项表示 sasl 配置成功
然后继续操作
auth login
334 VXNlcm5hbWU6
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
334 UGFzc3dvcmQ6
ZXh0bWFpbA==
235 2.0.0 Authentication successful
quit
221 2.0.0 Bye
如果出现Authentication successful 表示没有问题了
27.POP验证
vi /etc/courier/authdaemonrc
#更改如下一项
authmodulelist="authmysql"
cp /etc/courier/authmysqlrc /etc/courier/authmysqlrc_orig
cat /dev/null > /etc/courier/authmysqlrc
vi /etc/courier/authmysqlrc
#内容如下:
MYSQL_SERVER 127.0.0.1
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD uidnumber
MYSQL_GID_FIELD gidnumber
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD homedir
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD quota
MYSQL_SELECT_CLAUSE SELECT username,password,"",uidnumber,gidnumber,\
CONCAT('/home/vmail/',homedir), \
CONCAT('/home/vmail/',maildir), \
quota, \
name, \
CONCAT("disablesmtpd=",disablesmtpd, \
",disablesmtp=",disablesmtp, \
",disablewebmail=",disablewebmail, \
",disablenetdisk=",disablenetdisk, \
",disableimap=",disableimap, \
",disablepop3=",disablepop3, \
",netdiskquota=",netdiskquota) \
FROM mailbox \
WHERE username = '$(local_part)@$(domain)'
配置Courier-POP3
编辑/etc/courier/pop3d修改下面参数
MAILDIRPATH=/home/vmail/
配置Courier-IMAP
编辑/etc/courier/imapd修改下面参数
MAILDIRPATH=/home/vmail/
重新启动
/etc/init.d/courier-authdaemon restart
/etc/init.d/courier-imap restart
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop restart
/etc/init.d/courier-pop-ssl restart
测试Courier-Authlib是否能成功连接mysql
authtest -s login postmaster@extmail.org extmail
如果成功应该有如下显示
Authentication succeeded.
Authenticated: postmaster@extmail.org (uid 2000, gid 2000)
Home Directory: /home/vmail/extmail.org/postmaster
Maildir: /home/vmail/extmail.org/postmaster/Maildir/
Quota: 104857600S
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
Options:disablesmtpd=0,disablesmtp=0,disablewebmail=0,disablenetdisk=0,disableimap=0,disablepop3=0,netdiskquota=52428800S
如果出现error请检查数据库连接,分析mail.log。 一般都是input/output
Tips: chown daemon:vmail /var/run/courier/authdaemon 可能避免错误
测试pop3
telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user postmaster@extmail.org
+OK Password required.
pass extmail
+OK logged in.
list
+OK POP3 clients that break here, they violate STD53.
.
quit
+OK Bye-bye.
Connection closed by foreign host.
如果出现问题请仔细分析日志
28.图形日志extmail
apt-get install mailgraph
cp -r /var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/mailgraph_ext
修改/usr/local/mailgraph_ext/mailgraph-init为:
MAIL_LOG=/var/log/mail.log
然后复制文件
cp /var/www/extsuite/extman/addon/mailgraph_ext/mailgraph-init /etc/init.d/mailgraph
update-rc.d mailgraph start 20 2 3 4 5 . stop 20 0 1 6 .
cp /var/www/extsuite/extman/addon/mailgraph_ext/qmonitor-init /etc/init.d/qmonitor
update-rc.d qmonitor start 20 2 3 4 5 . stop 20 0 1 6 .
启动服务
/etc/init.d/mailgraph start
/etc/init.d/qmonitor start
29.安装Maildrop
apt-get install maildrop
vi /etc/maildropmysql.config //创建一个文件
hostname 127.0.0.1
port 3306
database extmail
dbuser extmail
dbpw extmail #修改为您的密码
dbtable mailbox
default_uidnumber 1000
default_gidnumber 1000
uidnumber_field uidnumber
gidnumber_field gidnumber
uid_field username
homedirectory_field concat('/home/vmail/',homedir,'/')
maildir_field concat('/home/vmail/',maildir)
quota_field quota
mailstatus_field active
修改/etc/maildroprc
vi /etc/maildroprc
logfile "/var/log/maildrop.log"
手动创建日志
vi /var/log/maildrop.log
chown vmail:vmail /var/log/maildrop.log
chmod 766 /var/log/maildrop.log
创建 /etc/logrotate.d/maildrop
内容为下面:
/var/log/maildrop.log {
daily
notifempty
missingok
rotate 5
compress
create 766 vmail vmail
sharedscripts
}
编辑/etc/postfix/master.cf,注释掉原来maildrop的配置内容并改为:
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
由于maildrop不支持一次接收多个收件人,因此必须在/etc/postfix/main.cf增加如下参数:
###### Maildrop config ########
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop:
创建 /etc/quotawarnmsg,为邮箱空间超过配额时的警告邮件内容
X-Comment: Rename/Copy this file to quotawarnmsg, and make appropriate changes
X-Comment: See deliverquota man page for more information
From: Mail Delivery System <Mailer-Daemon@example.com>
Reply-To: support@example.com
To: Valued Customer:;
Subject: Mail quota warning
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Your mailbox on the server is now more than 90% full. So that you can continue
to receive mail you need to remove some messages from your mailbox.
至此,全部完成 登录 http://mail.xxx.cn/extmail/ 前台,http://mail.xxx.cn/extman/后台 后台默认用户名 root@extmail.org 默认密码 extmail*123*
其实配到现在还远远不够,比如防病毒,过滤都还没配置。
» 阅读全文