完美的服务器 - Ubuntu 15.04 (Vivid Vervet),带有 Apache、PHP、MySQL、PureFTPD、BIND、Postfix、Dovecot 和 ISPConfig 3完美的服务器 - Ubuntu 15.04 (Vivid Vervet),带有 Apache、PHP、MySQL、PureFTPD、BIND、Postfix、Dovecot 和 ISPConfig 3完美的服务器 - Ubuntu 15.04 (Vivid Vervet),带有 Apache、PHP、MySQL、PureFTPD、BIND、Postfix、Dovecot 和 ISPConfig 3完美的服务器 - Ubuntu 15.04 (Vivid Vervet),带有 Apache、PHP、MySQL、PureFTPD、BIND、Postfix、Dovecot 和 ISPConfig 3
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

完美的服务器 - Ubuntu 15.04 (Vivid Vervet),带有 Apache、PHP、MySQL、PureFTPD、BIND、Postfix、Dovecot 和 ISPConfig 3

本教程展示了安装带有 Apache2、Postfix、Dovecot、Bind 和 PureFTPD 的 Ubuntu 15.04 (Vivid Vervet) 网络托管服务器,为安装 ISPConfig 3 做准备。生成的系统将提供 Web、Mail、Mailinglist、DNS和 FTP 服务器。

ISPConfig 3 是一个虚拟主机控制面板,允许您通过网络浏览器配置以下服务:Apache 或 nginx 网络服务器、Postfix 邮件服务器、Courier 或 Dovecot IMAP/POP3 服务器、MySQL、BIND 或 MyDNS 名称服务器、PureFTPd、SpamAssassin、ClamAV , 还有很多。此设置包括 Apache(而不是 nginx)、BIND(而不是 MyDNS)和 Dovecot(而不是 Courier)的安装。

ISPConfig 3 手册

为了学习如何使用 ISPConfig 3,我强烈建议下载 ISPConfig 3 手册。

在 300 多页中,它涵盖了 ISPConfig(管理员、经销商、客户)背后的概念,解释了如何安装和更新 ISPConfig 3,包括 ISPConfig 中所有表单和表单字段的参考以及有效输入的示例,并提供了教程了解 ISPConfig 3 中最常见的任务。它还列出了如何使您的服务器更安全,并在末尾提供了故障排除部分。

1. 初步说明

在本教程中,我使用主机名 server1.example.com 以及 IP 地址 192.168.1.100 和网关 192.168.1.1 。这些设置可能因您而异,因此您必须在适当的地方替换它们。在继续之前,您需要按照教程中的说明对 Ubuntu 15.04 进行基本的最小安装。

2. 编辑 /etc/apt/sources.list 并更新你的 Linux 安装

编辑 /etc/apt/sources.list。从文件中注释掉或删除安装 CD,并确保启用了 universe 和 multiverse 存储库。之后应该是这样的:

nano /etc/apt/sources.list
#

# deb cdrom:[Ubuntu-Server 15.04 _Vivid Vervet_ - Release amd64 (20150422)]/ vivid main restricted

#deb cdrom:[Ubuntu-Server 15.04 _Vivid Vervet_ - Release amd64 (20150422)]/ vivid main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ vivid main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ vivid-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ vivid universe
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid universe
deb http://de.archive.ubuntu.com/ubuntu/ vivid-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ vivid multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid multiverse
deb http://de.archive.ubuntu.com/ubuntu/ vivid-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu vivid-security main restricted
deb-src http://security.ubuntu.com/ubuntu vivid-security main restricted
deb http://security.ubuntu.com/ubuntu vivid-security universe
deb-src http://security.ubuntu.com/ubuntu vivid-security universe
deb http://security.ubuntu.com/ubuntu vivid-security multiverse
deb-src http://security.ubuntu.com/ubuntu vivid-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu vivid partner
# deb-src http://archive.canonical.com/ubuntu vivid partner

然后运行

apt-get update

更新 apt 包数据库和

apt-get upgrade

安装最新的更新(如果有的话)。如果您看到作为更新的一部分安装了新内核,您应该在之后重新启动系统:

reboot

3.更改默认外壳

/bin/sh 是 /bin/dash 的符号链接,但是我们需要 /bin/bash,而不是 /bin/dash。因此我们这样做:

dpkg-reconfigure dash

使用 dash 作为默认系统 shell (/bin/sh)? <-- 没有

如果您不这样做,ISPConfig 安装将失败。

4.禁用AppArmor

AppArmor 是一个安全扩展(类似于 SELinux),应该提供扩展的安全性。在我看来,你不需要它来配置一个安全的系统,它通常会导致更多的问题而不是好处(在你完成一周的故障排除后想想它,因为一些服务没有按预期工作,然后你发现一切没问题,只有 AppArmor 导致了问题)。因此我禁用它(如果你想稍后安装 ISPConfig,这是必须的)。

我们可以像这样禁用它:

service apparmor stop 
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

5.同步系统时钟

当您运行一个物理服务器。如果您运行虚拟服务器,则应跳过此步骤。赶紧跑

apt-get install ntp ntpdate

并且您的系统时间将始终保持同步。

6. 安装 Postfix、Dovecot、MariaDB、phpMyAdmin、rkhunter、binutils

要安装 postfix,我们需要确保未安装和运行 sendmail。要停止和删除 sendmail,请运行以下命令:

service sendmail stop; update-rc.d -f sendmail remove

错误信息:

Failed to stop sendmail.service: Unit sendmail.service not loaded.

没关系,这只是意味着没有安装sendmail,所以没有什么可以删除的。

现在我们可以使用一个命令安装 Postfix、Dovecot、MariaDB(作为 MySQL 的替代品)、rkhunter 和 binutils:

apt-get install postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve sudo

您将被问及以下问题:

Create a self-signed SSL certificate? <-- yes
Host name: <-- server1.example.com
General type of mail configuration: <-- Internet Site
System mail name: <-- server1.example.com

接下来打开 Postfix 中的 TLS/SSL 和提交端口:

nano /etc/postfix/master.cf

取消对提交和 smtps 部分的注释,如下所示 - 添加行 -o smtpd_client_restrictions=permit_sasl_authenticated,reject 到这两个部分,然后留下所有注释:

[...]
submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       -       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
[...]

之后重启 Postfix:

service postfix restart

我们希望 MySQL 监听所有接口,而不仅仅是本地主机,因此我们编辑 /etc/mysql/my.cnf 并注释掉 bind-address=127.0.0.1 行:

nano /etc/mysql/mariadb.conf.d/mysqld.cnf
[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
[...]

现在我们在 MariaDB 中设置一个 root 密码。跑步:

mysql_secure_installation

你会被问到这些问题:

Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y

然后我们重启MariaDB:

service mysql restart

现在检查网络是否已启用。跑步

netstat -tap | grep mysql

输出应如下所示:

:~# 

7. 安装 Amavisd-new、SpamAssassin 和 Clamav

要安装 amavisd-new、SpamAssassin 和 ClamAV,我们运行

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl

ISPConfig 3 安装程序使用在内部加载 SpamAssassin 过滤器库的 amavisd,因此我们可以停止 SpamAssassin 以释放一些 RAM:

service spamassassin stop 
update-rc.d -f spamassassin remove

编辑 clamd 配置文件:

nano /etc/clamav/clamd.conf

并更改行:

AllowSupplementaryGroups false

到:

AllowSupplementaryGroups true 

并保存文件。开始 clamav 使用

freshclam
service clamav-daemon start
©2015-2025 艾丽卡 support@alaica.com