如何在ubuntu中安装设置tp服务器

 我来答
就烦条0o
推荐于2016-01-16 · 知道合伙人软件行家
就烦条0o
知道合伙人软件行家
采纳数:33315 获赞数:46492
从事多年系统运维,喜欢编写各种小程序和脚本。

向TA提问 私信TA
展开全部
1,安装postfix、SASL及smtp服务

apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail

您将会被问一些问题:
General type of configuration? <– Internet Site
Mail name? <– server1.example.com

2,配置postfix
dpkg-reconfigure postfix

您将再次被问一些问题:
General type of configuration? <– Internet Site
Where should mail for root go <– NONE
Mail name? <– server1.example.com
Other destinations to accept mail for? (blank for none) <– server1.example.com, localhost.example.com, localhost
Force synchronous updates on mail queue? <– No
Local networks? <– 127.0.0.0/8
Use procmail for local delivery? <– Yes
Mailbox size limit <– 0
Local address extension character? <– +
Internet protocols to use? <– all

3,配置postfix使它通过SASL实现smtp
### Configure Postfix to do SMTP AUTH using SASL (saslauthd)
postconf -e ‘smtpd_sasl_local_domain =’
postconf -e ‘smtpd_sasl_auth_enable = yes’
postconf -e ‘smtpd_sasl_security_options = noanonymous’
postconf -e ‘broken_sasl_auth_clients = yes’
postconf -e ‘smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination’
postconf -e ‘inet_interfaces = all’
echo ‘pwcheck_method: saslauthd’ >> /etc/postfix/sasl/smtpd.conf
echo ‘mech_list: plain login’ >> /etc/postfix/sasl/smtpd.conf

生成用于加密和认证用的证书
### Generate certificates to be used for TLS encryption and/or certificate Authentication
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650

配置postfix,加密发送和接收的邮件
### Configure Postfix to do TLS encryption for both incoming and outgoing mail
postconf -e ‘smtpd_tls_auth_only = no’
postconf -e ‘smtp_use_tls = yes’
postconf -e ‘smtpd_use_tls = yes’
postconf -e ‘smtp_tls_note_starttls_offer = yes’
postconf -e ‘smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key’
postconf -e ‘smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt’
postconf -e ‘smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem’
postconf -e ‘smtpd_tls_loglevel = 1′
postconf -e ‘smtpd_tls_received_header = yes’
postconf -e ‘smtpd_tls_session_cache_timeout = 3600s’
postconf -e ‘tls_random_source = dev:/dev/urandom’
postconf -e ‘myhostname = mail.[MailServer].com
4,重启postfix服务
/etc/init.d/postfix restart

5,做一些小的修改,以便于postfix可以通过saslauthd工作
mkdir -p /var/spool/postfix/var/run/saslauthd

6,编辑一下下面这个文件
vim /etc/default/saslauthd

# This needs to be uncommented before saslauthd will be run automatically
START=yes

PWDIR=”/var/spool/postfix/var/run/saslauthd”
PARAMS=”-m ${PWDIR} -r”
# PIDFILE=”${PWDIR}/saslauthd.pid”

# You must specify the authentication mechanisms you wish to use.
# This defaults to “pam” for PAM support, but may also include
# “shadow” or “sasldb”, like this:
# MECHANISMS=”pam shadow”

MECHANISMS=”shadow”

7,这步很重要,因为我找了很多资料,这一步都没写对 ^_^
vim /etc/init.d/saslauthd

[...]
PWDIR=/var/spool/postfix/var/run/saslauthd
PIDFILE=”/var/spool/postfix/var/run/${NAME}/saslauthd.pid”
[...]

8,配置一下
sudo dpkg-statoverride –force –update –add root sasl 755 /var/spool/postfix/var/run/saslauthd

9,重启saslauthd服务
/etc/init.d/saslauthd start

10,安装pop3服务
apt-get
install courier-authdaemon courier-base courier-imap courier-imap-ssl
courier-pop courier-pop-ssl courier-ssl gamin libgamin0 libglib2.0-0

回答他的问题
Create directories for web-based administration ? <– No
SSL certificate required <– Ok

做一些配置
postconf -e ‘home_mailbox = Maildir/’
postconf -e ‘mailbox_command =’
/etc/init.d/postfix restart

如果一切都正常的话,你现在可以用evolution之类的软件做测试了(ubuntu自带)
启帆信息
2024-11-22 广告
NVIDIA AI服务器在业界具有显著影响力。英伟达推出的AI服务器,如NVL72,凭借其卓越的性能和前所未有的计算能力,迅速成为市场的新宠。这些服务器采用高性能的GPU和CPU架构,支持万亿参数的多模态大模型,满足了大规模模拟和3D数据生... 点击进入详情页
本回答由启帆信息提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式