10. 安装 Mailman
apt-get install mailman
按照以下配置:
Languages to support: <-- en (英文) Missing site list <-- Ok 之前,我们可以开始Mailman,必须创建一个名为Mailman第一个邮件列表: newlist mailman
root@server1:~# newlist mailman
Enter the email of the person running the list: <-- admin email address, e.g. listadmin@example.com Initial mailman password: <-- admin password for the mailman list To finish creating your mailing list, you must edit your /etc/aliases (or equivalent) file by adding the following lines, and possibly running the `newaliases' program: ## mailman mailing list mailman: "|/var/lib/mailman/mail/mailman post mailman" mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/var/lib/mailman/mail/mailman join mailman" mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman" mailman-request: "|/var/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman" Hit enter to notify mailman owner... <-- ENTER root@server1:~#
打开/etc/aliases文件之后...
nano /etc/aliases
添加以下行:
[...]
## mailman mailing list
mailman: "|/var/lib/mailman/mail/mailman post mailman"
mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman"
mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman"
mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman"
mailman-join: "|/var/lib/mailman/mail/mailman join mailman"
mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman"
mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman"
mailman-request: "|/var/lib/mailman/mail/mailman request mailman"
mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
运行:
newaliases
事后并重新启动Postfix:
service postfix restart
最后,我们必须启用 mailman Apache配置:
ln -s /etc/mailman/apache.conf /etc/apache2/conf-available/mailman.conf
这定义别名 /cgi-bin/mailman/ 为 Apache 主机, 这意味着您可以在HTTP访问 http:///cgi-bin/mailman/admin/, 邮件列表用户的网页可以在HTTP上找到:http:///cgi-bin/mailman/listinfo/.
service apache2 restart
service mailman start
11.安装PureFTPd和Quota
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
编辑文件:
nano /etc/default/pure-ftpd-common
像下面的设置:
[...]
STANDALONE_OR_INETD=standalone
[...]
VIRTUALCHROOT=true
[...]
现在,我们配置PureFTPd允许FTP和TLS会话。 FTP是一个非常不安全的协议,因为所有的密码和所有数据以明文传输。通过使用TLS,整个通信可以被加密,因此FTP使得安全得多。
如果你希望允许FTP和TLS会话,运行:
echo 1 > /etc/pure-ftpd/conf/TLS
为了使用TLS,我们必须创建一个SSL证书。我在/ etc/ SSL/私营/创建它,所以我首先创建一个目录:
mkdir -p /etc/ssl/private/
然后,如下我们可以生成SSL证书:
openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
Country Name (2 letter code) [AU]: <-- Enter your Country Name (e.g., "DE"). State or Province Name (full name) [Some-State]:<-- Enter your State or Province Name. Locality Name (eg, city) []:<-- Enter your City. Organization Name (eg, company) [Internet Widgits Pty Ltd]:<-- Enter your Organization Name (e.g., the name of your company). Organizational Unit Name (eg, section) []:<-- Enter your Organizational Unit Name (e.g. "IT Department"). Common Name (eg, YOUR name) []:<-- Enter the Fully Qualified Domain Name of the system (e.g. "server1.example.com"). Email Address []:<-- Enter your Email Address. 更改SSL证书的权限: chmod 600 /etc/ssl/private/pure-ftpd.pem
然后重新启动ProFTPd:
service pure-ftpd-mysql restart
编辑:Edit /etc/fstab
nano /etc/fstab
设置如以下设置:
# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# /dev/mapper/server1–vg-root / ext4 errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0 1
# /boot was on /dev/sda1 during installation
UUID=39762f15-3a49-4982-add3-139d5040b48a /boot ext2 defaults 0 2
/dev/mapper/server1–vg-swap_1 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
要启用quota,运行以下命令:
mount -o remount /
quotacheck -avugm
quotaon -avug
它会显示以下的输出:
root@server1:~# quotacheck -avugm
quotacheck: Scanning /dev/mapper/server1--vg-root [/] done
quotacheck: Cannot stat old user quota file //quota.user: No such file or directory. Usage will not be subtracted.
quotacheck: Cannot stat old group quota file //quota.group: No such file or directory. Usage will not be subtracted.
quotacheck: Cannot stat old user quota file //quota.user: No such file or directory. Usage will not be subtracted.
quotacheck: Cannot stat old group quota file //quota.group: No such file or directory. Usage will not be subtracted.
quotacheck: Checked 11642 directories and 81307 files
quotacheck: Old file not found.
quotacheck: Old file not found.
root@server1:~# quotaon -avug
/dev/mapper/server1--vg-root [/]: group quotas turned on
/dev/mapper/server1--vg-root [/]: user quotas turned on
12. 安装 BIND DNS Server
apt-get install bind9 dnsutils haveged
13. 安装 Vlogger, Webalizer,和 AWstats
apt-get install vlogger webalizer awstats geoip-database libclass-dbi-mysql-perl
配置文件:
nano /etc/cron.d/awstats
#MAILTO=root
#*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh
# Generate static reports:
#10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
14. 安装 Jailkit
apt-get install build-essential autoconf automake1.11 libtool flex bison debhelper binutils
cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.19.tar.gz
tar xvfz jailkit-2.19.tar.gz
cd jailkit-2.19
./debian/rules binary
cd ..
dpkg -i jailkit_2.19-1_*.deb
rm -rf jailkit-2.19*
15. 安装 fail2ban 和 UFW
apt-get install fail2ban
配置文件:
nano /etc/fail2ban/jail.local
[pureftpd]
enabled = true
port = ftp
filter = pureftpd
logpath = /var/log/syslog
maxretry = 3
[dovecot-pop3imap]
enabled = true
filter = dovecot-pop3imap
action = iptables-multiport[name=dovecot-pop3imap, port="pop3,pop3s,imap,imaps", protocol=tcp]
logpath = /var/log/mail.log
maxretry = 5
[postfix-sasl]
enabled = true
port = smtp
filter = postfix-sasl
logpath = /var/log/mail.log
maxretry = 3
nano /etc/fail2ban/filter.d/pureftpd.conf
[Definition]
failregex = .*pure-ftpd: \(.*@\) \[WARNING\] Authentication failed for user.*
ignoreregex =
nano /etc/fail2ban/filter.d/dovecot-pop3imap.conf
[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed|Aborted login \(\d+ authentication attempts).*rip=(?P\S*),.*
ignoreregex =
echo "ignoreregex =" >> /etc/fail2ban/filter.d/postfix-sasl.conf
service fail2ban restart
apt-get install ufw
16. 安装 Roundcube Webmail
apt-get install roundcube roundcube-core roundcube-mysql roundcube-plugins roundcube-plugins-extra javascript-common libjs-jquery-mousewheel php-net-sieve tinymce
安装过程中的问题:
Configure database for roundcube with dbconfig-common? <-- Yes MySQL application password for roundcube: <-- Press enter 配置文件: nano /etc/apache2/conf-enabled/roundcube.conf
# Those aliases do not work properly with several hosts on your apache server
# Uncomment them to use it or adapt them to your configuration
Alias /roundcube /var/lib/roundcube
[...]
AddType application/x-httpd-php .php
[...]
service apache2 restart
然后编辑RoundCube的config.inc.php配置文件:
nano /etc/roundcube/config.inc.php
修改:
$config['default_host'] = 'localhost';
17. 安装 ISPConfig 3
cd /tmp
wget -O ispconfig.tar.gz https://git.ispconfig.org/ispconfig/ispconfig3/repository/archive.tar.gz?ref=stable-3.1
tar xfz ispconfig.tar.gz
cd ispconfig3*/install/
php -q install.php
# php -q install.php
--------------------------------------------------------------------------------
_____ ___________ _____ __ _ ____
|_ _/ ___| ___ \ / __ \ / _(_) /__ \
| | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ /
| | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/
__/ |
|___/
--------------------------------------------------------------------------------
>> Initial configuration
Operating System: Debian 8.0 (Jessie) or compatible
Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with .
Tap in "quit" (without the quotes) to stop the installer.
Select language (en,de) [en]: <-- Hit Enter Installation mode (standard,expert) [standard]: <-- Hit Enter Full qualified hostname (FQDN) of the server, eg server1.domain.tld [server1.canomi.com]: <-- Hit Enter MySQL server hostname [localhost]: <-- Hit Enter MySQL server port [3306]: <-- Hit Enter MySQL root username [root]: <-- Hit Enter MySQL root password []: <-- Enter your MySQL root password MySQL database to create [dbispconfig]: <-- Hit Enter MySQL charset [utf8]: <-- Hit Enter Configuring Postgrey Configuring Postfix Generating a 4096 bit RSA private key .......................................................................++ ........................................................................................................................................++ writing new private key to 'smtpd.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: <-- Enter 2 letter country code State or Province Name (full name) [Some-State]: <-- Enter the name of the state Locality Name (eg, city) []: <-- Enter your city Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter company name or press enter Organizational Unit Name (eg, section) []: <-- Hit Enter Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case: server1.example.com Email Address []: <-- Hit Enter Configuring Mailman Configuring Dovecot Configuring Spamassassin Configuring Amavisd Configuring Getmail Configuring BIND Configuring Jailkit Configuring Pureftpd Configuring Apache Configuring vlogger Configuring Metronome XMPP Server writing new private key to 'localhost.key' ----- Country Name (2 letter code) [AU]: <-- Enter 2 letter country code Locality Name (eg, city) []: <-- Enter your city Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter company name or press enter Organizational Unit Name (eg, section) []: <-- Hit Enter Common Name (e.g. server FQDN or YOUR name) [server1.canomi.com]: <-- Enter the server hostname, in my case: server1.example.com Email Address []: <-- Hit Enter Configuring Ubuntu Firewall Configuring Fail2ban [INFO] service OpenVZ not detected Configuring Apps vhost Installing ISPConfig ISPConfig Port [8080]: Admin password [admin]: Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]: <-- Hit Enter Generating RSA private key, 4096 bit long modulus .......................++ ................................................................................................................................++ e is 65537 (0x10001) You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: <-- Enter 2 letter country code State or Province Name (full name) [Some-State]: <-- Enter the name of the state Locality Name (eg, city) []: <-- Enter your city Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter company name or press enter Organizational Unit Name (eg, section) []: <-- Hit Enter Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case: server1.example.com Email Address []: <-- Hit Enter Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: <-- Hit Enter An optional company name []: <-- Hit Enter writing RSA key Configuring DBServer Installing ISPConfig crontab no crontab for root no crontab for getmail Detect IP addresses Restarting services ... Installation completed.
访问 ISPConfig 3 under http(s)://server1.example.com:8080/ or http(s)://192.168.1.100:8080/
18.其他注意事项
18.1 OpenVZ
如果你刚刚建立本教程中的Ubuntu的服务器是OpenVZ的容器(虚拟机),你应该这样做在主机系统上(我假设OpenVZ的容器的ID是101 - 与更换您的系统上正确VPSID):
VPSID=101
for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE
do
vzctl set $VPSID --capability ${CAP}:on --save
done
18.2本教程的虚拟机映像下载
本教程可作为准备OVF/ OVA格式,与VMware和VirtualBox虚拟兼容使用虚拟机映像。虚拟机映像使用下列登录信息:
SSH / Shell Login
Username: administrator
Password: howtoforge
This user has sudo rights.
ISPConfig Login
Username: admin
Password: howtoforge
MySQL Login
Username: root
Password: howtoforge
虚拟机的IP是192.168.1.100,它可以在文件 /etc/network/interfaces。请更改上述所有密码来保护虚拟机。
19.相关连接:
Ubuntu: http://www.ubuntu.com/
ISPConfig: http://www.ispconfig.org/
更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-04/130833.htm


