如何启动 dovecot?

如何启动 dovecot?

我正在构建一个 Web 服务器来托管多个网站。除了邮件服务器之外,其他一切都运行正常。我使用 linode 来托管我的 vps,并且一直在遵循他们的教程。仅供参考,我使用的是 Ubuntu 11.10。

这是我一直在关注的链接,http://library.linode.com/email/postfix/dovecot-mysql-ubuntu-10.04-lucid。我到了需要我重启 dovecot 的部分,所以我尝试了“service dovecot restart”。但是我得到了这个“重启:未知实例:”。我以 root 身份登录,所以我没有使用 sudo。

由于这不起作用,我尝试了“/etc/init.d/dovecot restart”,结果得到“dovecot start/running,进程 4760”。因此我尝试了“/etc/init.d/dovecot status”,结果得到“dovecot stop/waiting”。

于是我尝试了“service dovecot start”,结果得到了“dovecot start/running,process 4781”。于是,我尝试获取状态,于是又尝试了“service dovecot status”,结果得到了“dovecot stop/waiting”

然后我尝试“/etc/init.d/dovecot start”,结果得到“dovecot start/running,进程 4794”。因此我尝试获取状态,因此我尝试“/etc/init.d/dovecot status”,结果得到“dovecot stop/waiting”

只是为了好玩,我尝试终止该进程,我使用了执行“service dovecot start”时获得的 PID,这是命令“kill -9 4444”,然后我得到了这个“bash: kill: (4805) - 没有这样的进程”

难道我做错了什么?

--编辑1--

以下是在 /var/log/syslog 中找到的涉及 dovecot 的日志

dovecot: master: Dovecot v2.0.13 starting up (core dumps disabled)
dovecot: ssl-params: Generating SSL parameters
dovecot: ssl-params: SSL parameters regeneration completed
dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: config: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
kernel: init: dovecot main process (10276) terminated with status 89
kernel: init: dovecot main process (10289) terminated with status 89
kernel: init: dovecot main process (10452) terminated with status 89
kernel: init: dovecot main process (2275) terminated with status 89
kernel: init: dovecot main process (3028) terminated with status 89
kernel: init: dovecot main process (3216) terminated with status 89
kernel: init: dovecot main process (3230) terminated with status 89
kernel: init: dovecot main process (3254) terminated with status 89
kernel: init: dovecot main process (3813) terminated with status 89
kernel: init: dovecot main process (3845) terminated with status 89
kernel: init: dovecot main process (4664) terminated with status 89
kernel: init: dovecot main process (4760) terminated with status 89
kernel: init: dovecot main process (4781) terminated with status 89
kernel: init: dovecot main process (4794) terminated with status 89
kernel: init: dovecot main process (4805) terminated with status 89

--编辑 2 (/etc/dovecot/dovecot.conf)--

以下是dovecot.conf文件

protocols = imap imaps pop3 pop3s
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir

ssl_cert_file = /etc/ssl/certs/dovecot.pem
ssl_key_file = /etc/ssl/private/dovecot.pem

namespace private {
    separator = .
    prefix = INBOX.
    inbox = yes
}

protocol lda {
    log_path = /home/vmail/dovecot-deliver.log
    auth_socket_path = /var/run/dovecot/auth-master
    postmaster_address = postmaster@[mydomainname.com]
    mail_plugins = sieve
    global_script_path = /home/vmail/globalsieverc
}

protocol pop3 {
    pop3_uidl_format = %08Xu%08Xv
}

auth default {
    user = root

    passdb sql {
        args = /etc/dovecot/dovecot-sql.conf
    }

    userdb static {
        args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
    }

    socket listen {
        master {
            path = /var/run/dovecot/auth-master
            mode = 0600
            user = vmail
        }

        client {
            path = /var/spool/postfix/private/auth
            mode = 0660
            user = postfix
            group = postfix
        }
    }
}

-- 编辑 3 (/var/log/mail.log) --

以下是 /var/log/mail.log 中的内容

dovecot: master: Dovecot v2.0.13 starting up (core dumps disabled)
dovecot: ssl-params: Generating SSL parameters
postfix/master[9917]: daemon started -- version 2.8.5, configuration /etc/postfix
dovecot: ssl-params: SSL parameters regeneration completed
postfix/master[9917]: terminating on signal 15
postfix/master[10196]: daemon started -- version 2.8.5, configuration /etc/postfix
dovecot: master: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: config: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: anvil: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
dovecot: log: Warning: Killed with signal 15 (by pid=1 uid=0 code=kill)
postfix/master[2435]: daemon started -- version 2.8.5, configuration /etc/postfix
postfix/master[2435]: terminating on signal 15
postfix/master[2965]: daemon started -- version 2.8.5, configuration /etc/postfix

答案1

本教程于 2010 年 5 月 9 日发布。
v1.2.6 2009-10-05该日期之前的最后一个 dovecot 版本
v2.0.rc1 2010-07-02该日期之后的下一个 dovecot 版本

因此本教程可能会使用 1.x 配置,而现在我们将使用 dovecot 2.x。从那时起,配置设置方式已经发生了很多变化。

现在我发现了这个http://wiki2.dovecot.org/Upgrading/2.0
除了一些其他信息外,它还提供了一种将配置从 1.2 转换为 2.0 的方法。

有关升级的更多信息http://wiki2.dovecot.org/Upgrading

但我还没有解决方案

编辑:

更好的解决方案
忘掉那个教程吧http://library.linode.com并使用这个最新的更好的教程
http://www.exratione.com/2012/05/a-mailserver-on-ubuntu-1204-postfix-dovecot-mysql/
它还向您展示了如何安装垃圾邮件过滤器、防病毒检测以及如何为您的邮件服务器增加更多安全性。此外,使用此解决方案,您将能够非常轻松地添加多个域。
我首先使用下面的解决方案,现在我切换到该解决方案,它工作正常并且完美地满足了我的要求。

问题相关解答
但是如果你必须准确地找到问题中描述的鸽舍问题的解决方案,下面是我解决问题的方法......
还要安装:

apt-get install dovecot-sieve  
apt-get install dovecot-managesieved  
apt-get install dovecot-mysql  

如果你愿意,请阅读有关升级旧 1.x 配置的提示 http://wiki2.dovecot.org/Upgrading

我的dovecot.conf:

log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir
namespace {
  inbox = yes
  location = 
  prefix = INBOX.
  separator = .
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocols = imap pop3
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-master {
    mode = 0600
    user = vmail
  }
  user = root
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
#userdb {
#  args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
#  driver = static
#}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  log_path = /home/vmail/dovecot-deliver.log
  mail_plugins = sieve
  postmaster_address = [email protected]
  plugin {
    sieve_global_path = /var/vmail/globalsieverc
    # The include extension fetches the :personal scripts from this 
    # directory. When ManageSieve is used, this is also where scripts 
    # are uploaded.

    sieve_dir = ~/sieve

    # The location of the user's active script:

    sieve = ~/.dovecot.sieve

    # Directory for :global include scripts (for v1.1 include extension)

    sieve_global_dir = /var/vmail/sieve

    sieve_maxscriptsize = 128
  }
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}

我的 dovecot-db.conf.ext

driver = mysql
connect = host=127.0.0.1 dbname=mail user=mail_admin password=your_password
default_pass_scheme = CRYPT
#password_query = SELECT email as user, password FROM users WHERE email='%u';
#user_query = SELECT email as user, password, 5000 as uid, 5000 as gid, '/var/vmail/%d/%n' as home FROM view_users WHERE email='%u';
password_query = SELECT email AS user, password, 5000 AS userdb_uid, 5000 AS userdb_gid, '/var/vmail/%d/%n' AS userdb_home FROM users WHERE email = '%u';
user_query = SELECT email AS user, password, 5000 AS uid, 5000 AS gid, '/var/vmail/%d/%n' AS home FROM users WHERE email = '%u';

我的 /etc/postfix/sasl/smtpd.conf(注意 auxprop_plugin:sql、sql_engine:mysql 和 '%u@%r')

pwcheck_method: saslauthd
mech_list: plain login pam
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: mail_admin
sql_passwd: your_password
sql_database: mail
sql_select: select password from users where email = '%u@%r'

资料来源:
我通过谷歌搜索收集了有关此问题的所有信息,但最后一个问题

2013-01-03 16:43:27 lda: Error: userdb lookup([email protected]): Disconnected unexpectedly
2013-01-03 16:43:27 lda: Fatal: Internal error occurred. Refer to server log for more information.

我解决了阅读一些http://workaround.org/ispmail/lenny/configure-dovecot
基本上,我发现当你用 Google 搜索这里出现的任何错误输出时,你都会得到很好的结果:

/home/vmail/dovecot-deliver.log
/var/log/mail.log
/var/log/mail.err
/var/log/syslog

答案2

增加日志记录并重试。上面的消息仅表明有人在 Dovecot 启动后终止了它。仅此而已。

增加日志记录的方法如下:http://wiki2.dovecot.org/Logging

相关内容