使用sudo apt install sendmail
安装
结果如下:
sudo dpkg --configure -a
Setting up sendmail-bin (8.15.2-3) ...
Updating sendmail environment ...
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Disabling HOST statistics file(/var/lib/sendmail/host_status).
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Could not open /etc/mail/databases(No such file or directory),creating it.
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...
Checking filesystem,this may take some time - it will not hang!
... Done.
Checking for installed MDAs...
sasl2-bin not installed,not configuring sendmail support.
To enable sendmail SASL2 support at a later date,invoke "/usr/share/sendmail/update_auth"
Creating/Updating SSL(for TLS) information
Creating /etc/mail/tls/starttls.m4...
Creating SSL certificates for sendmail.
卡在最后这一行,还有个进度条停在80%不动了。
解决方案:
cd /etc/mail/tls
sudo openssl dsaparam -out sendmail-common.prm 2048
sudo chown root:smmsp sendmail-common.prm
sudo chmod 0640 sendmail-common.prm
sudo dpkg --configure -a
解决方案出处:https://askubuntu.com/questions/937666/ubuntu-16-04-command-line-sendmail-installation-hanged/938450