こちらのサイトを参考にほぼそのままの手順でpostfixとDovecotをインストールしたので手順のまとめておく。
バーチャルメールボックス用のユーザの登録とpostfixのインストール。

# sudo adduser --uid 20000 --disabled-password --disabled-login vmail
# apt install postfix sasl2-bin ; postfixの設定は別途行うのでNo Configuration

/etc/postfix/main.cf.protoを/etc/postfix/main.cfにコピーして以下の様に変更。

compatibility_level = 2
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = moon-forest.com
mydomain = moon-forest.com
myorigin = $mydomain
inet_interfaces = all
local_transport = dovecot
local_recipient_maps = $virtual_mailbox_maps
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
inet_protocols = ipv4
message_size_limit = 33554432
mailbox_size_limit = 1073741824
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions =
    permit_mynetworks,
    check_client_access hash:/etc/postfix/access,
    reject_unknown_client,
    permit
smtpd_relay_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    permit_auth_destination,
    reject
virtual_mailbox_domains = moon-forest.com, 2nd_domain_if_needed.xxx
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_uid_maps = static:20000 # 作成したuidに合わせる
virtual_gid_maps = static:20000 # 作成したgidに合わせる
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtpd_use_tls = yes
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache                                                            

/etc/postfix/master.cf.protoを/etc/postfix/master.cfにコピーして以下の様に変更。

smtp      inet  n       -       y       -       -       smtpd
submission inet n       -       y       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_sasl_auth_enable=yes 
  -o smtpd_tls_auth_only=yes    
smtps     inet  n       -       y       -       -       smtpd
  -o syslog_name=postfix/smtps  
  -o smtpd_tls_wrappermode=yes  
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
        -o syslog_name=postfix/$service_name
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
postlog   unix-dgram n  -       n       -       1       postlogd
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}
# Dovecot lda
dovecot unix    -   n   n   -   -   pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -a ${recipient} -d ${user}@${nexthop}

続いてdovecotをインストール。

# apt install dovecot-core dovecot-pop3d dovecot-imapd
# apt-get install dovecot-sieve dovecot-managesieved

/etc/dovecot/dovecot.confを以下の様に変更。

!include_try /usr/share/dovecot/protocols.d/*.protocol
listen = *, ::
dict {
}
!include conf.d/*.conf
!include_try local.conf

/etc/dovecot/conf.d/10-auth.confを以下の様に変更。

disable_plaintext_auth = no
auth_mechanisms = cram-md5 plain login
!include auth-passwdfile.conf.ext
!include auth-static.conf.ext                                

/etc/dovecot/conf.d/10-mail.confを以下の様にmail_locationを変更。

mail_location = maildir:/home/vmail/%d/%n/Maildir
namespace inbox {
  inbox = yes
}
mail_privileged_group = mail
protocol !indexer-worker {
}

/etc/dovecot/conf.d/10-master.confを以下の様にsubmisstionを削除し、postfix関連の設定を追加。

service imap-login { 
  inet_listener imap {
  }
  inet_listener imaps {
  }
}
service pop3-login {
  inet_listener pop3 {
  }
  inet_listener pop3s {
  }
}
service lmtp {
  unix_listener lmtp {
  }
}
service imap {
}
service pop3 {
}
service auth {
  unix_listener auth-userdb {
  }
  unix_listener /var/spool/postfix/private/auth {
    mode = 0666
    user = postfix
    group = postfix
  }
}
service auth-worker {
}
service dict {
  unix_listener dict {
  }
}

/etc/dovecot/conf.d/10-ssl.confのssl_dhの行をコメントアウト。

ssl = yes
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.key
ssl_client_ca_dir = /etc/ssl/certs

/etc/dovecot/conf.d/auth-passwdfile.conf.ext

passdb { 
  driver = passwd-file
  args = scheme=CRAM-MD5 username_format=%u /etc/dovecot/users
}

/etc/dovecot/conf.d/auth-static.conf.ext

userdb {
  driver = static
  args = uid=vmail gid=vmail home=/home/vmail/%d/%n
}

/etc/dovecot/conf.d/15-lda.conf

postmaster_address = postmaster@moon-forest.com
hostname = moon-forest.com
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
protocol lda {
  mail_plugins = $mail_plugins sieve
  log_path =
  info_log_path =
}

/etc/dovecot/conf.d/90-sieve.conf

plugin {
  sieve = file:/home/vmail/%d/%n/sieve;active=/home/vmail/%d/%n/.dovecot.sieve
  sieve_default = /var/lib/dovecot/sieve/default.sieve
  sieve_global = /var/lib/dovecot/sieve/global/
} 

/etc/dovecot/conf.d/20-managesieve.conf

service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  service_count = 0
}
service managesieve {
}
protocol sieve {
} 

仮想ユーザーアカウントの設定を以下の手順で行っていく。まず、/etc/postfix/virtual_mailboxを以下の内容で作成。

# virtual user                 virtual mailbox
xxx@moon-forest.com            moon-forest.com/xxx/Maildir/
yyy@moon-forest.com            moon-forest.com/yyy/Maildir/
zzz.2nd_domain_if_needed.xxx   2nd_domain_name_if_needed.xxx/zzz/MailDir/
   :                           :

/etc/postfix/virtualを以下の内容で作成。

# alias name                    real name
postmaster@moon-forest.com      xxx@moon-forest.com
webmaster@moon-forest.com       xxx@moon-forest.com
admin@moon-forest.com           xxx@moon-forest.com
    :                           :

以下のコマンドでデータベースを更新。

# postmap /etc/postfix/virtual_mailbox
# postmap /etc/postfix/virtual

以下のコマンドでパスワードを生成。

# doveadm pw -s CRAM-MD5
Enter new password:<パスワード入力>
Retype new password:<パスワード確認入力>

生成された暗号化したパスワードをコピーし、/etc/dovecot/usersに以下ように記載。

# user:passowrd
xxx@moon-forest.com:{CRAM-MD5}58fas73174asfs56622asd28988dc24347e4d...
yyy@moon-forest.com:{CRAM-MD5}bb36632605a93dba643535asdda983bada249...
xxx@2nd_domain_if_needed.com:{CRAM-MD5}58f3a22898d1feb5538dcaha24347807a3e4d... 

/etc/postfix/accessは使用しないので、空ファイルを作ってデータベースを更新。

# touch /etc/postfix/access
# postmap /etc/postfix/access

これでほぼ動作したが、mail.logを見ると、”Error: net_connect_unix(/var/run/dovecot/stats-writer) failed”といったエラーが出ていた。調べてみると、/etc/dovecot/dovecot.confに以下の内容を追加すると良いとの情報がったので追加してみるとめでたくエラーはでなくなった。

service stats {
    unix_listener stats-reader {
        user = vmail
        group = vmail
        mode = 0660
    }
 
    unix_listener stats-writer {
        user = vmail
        group = vmail
        mode = 0660
    }
}