完美的服务器 - Debian 8 Jessie(Apache2、BIND、Dovecot、ISPConfig 3)完美的服务器 - Debian 8 Jessie(Apache2、BIND、Dovecot、ISPConfig 3)完美的服务器 - Debian 8 Jessie(Apache2、BIND、Dovecot、ISPConfig 3)完美的服务器 - Debian 8 Jessie(Apache2、BIND、Dovecot、ISPConfig 3)
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

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

完美的服务器 - Debian 8 Jessie(Apache2、BIND、Dovecot、ISPConfig 3)

在此页

  1. 1 条初步说明
  2. 2 安装 SSH 服务器(可选)
  3. 3 安装 shell 文本编辑器(可选)
  4. 4 配置主机名
  5. 5 更新您的 Debian 安装
  6. 6 更改默认外壳
  7. 7 同步系统时钟
  8. 8 安装 Postfix、Dovecot、MySQL、phpMyAdmin、rkhunter、binutils
  9. 9 安装 Amavisd-new、SpamAssassin 和 Clamav

本教程介绍如何为安装 ISPConfig 3 准备 Debian Jessie 服务器(带有 Apache2、BIND、Dovecot),以及如何安装 ISPConfig 3。虚拟主机控制面板 ISPConfig 3 允许您通过 Web 浏览器配置以下服务: Apache 或 nginx 网络服务器、Postfix 邮件服务器、Courier 或 Dovecot IMAP/POP3 服务器、MySQL、BIND 或 MyDNS 名称服务器、PureFTPd、SpamAssassin、ClamAV 等等。此设置涵盖 Apache(而不是 nginx)、BIND(而不是 MyDNS)和 Dovecot(而不是 Courier)。

1 初步说明

在本教程中,我将使用主机名 server1.example.com,IP 地址为 192.168.1.100,网关为 192.168.1.1。这些设置可能因您而异,因此您必须在适当的地方替换它们。在继续之前,您需要安装 Debian 8 的最小化版本。这可能是您的托管服务提供商提供的 Debian 最小化镜像,或者您可以使用最小化 Debian 服务器教程来设置基本系统。

2 安装 SSH 服务器(可选)

如果您在系统安装时没有安装OpenSSH服务器,您现在可以安装:

apt-get install ssh openssh-server

从现在开始,您可以使用 PuTTY 等 SSH 客户端从您的工作站连接到您的 Debian Jessie 服务器,然后按照本教程中的其余步骤进行操作。

3 安装 shell 文本编辑器(可选)

我们将在本教程中使用 nano 文本编辑器。有些用户更喜欢经典的 vi 编辑器,因此我们将在此处安装这两个编辑器。默认的 vi 程序在 Debian 和 Ubuntu 上有一些奇怪的行为;为了解决这个问题,我们安装 vim-nox:

apt-get install nano vim-nox

如果 vi 是你最喜欢的编辑器,那么在以下命令中将 nano 替换为 vi 来编辑文件。

4 配置主机名

服务器的主机名应该是一个子域,如 \server1.example.com\。不要使用没有子域部分的域名作为主机名,如 \example.com\,因为这会导致以后的邮件设置出现问题。首先,您应该检查 /etc/hosts 中的主机名,并在必要时进行更改。该行应为:\IP 地址 - 空格 - 完整主机名,包括域 - 空格 - 子域部分\。对于我们的主机名 server1.example.com,该文件应如下所示:

nano /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.1.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

然后编辑 /etc/hostname 文件:

nano /etc/hostname

它应该只包含子域部分,在我们的例子中:

server1

最后重新启动服务器以应用更改:

reboot

再次登录并使用以下命令检查主机名是否正确:

hostname
hostname -f

输出应如下所示:

:/tmp# hostname -f
server1.example.com

5 更新您的 Debian 安装

首先确保您的 /etc/apt/sources.list 包含 jessie/updates 存储库(这确保您始终获得最新的安全更新),并且启用了 contrib 和 non-free 存储库(一些软件包,例如 libapache2- mod-fastcgi 不在主存储库中)。

nano /etc/apt/sources.list
#deb cdrom:[Debian GNU/Linux 8.0.0 _Jessie_ - Official amd64 NETINST Binary-1 20150425-12:50]/ jessie main

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

跑步:

apt-get update

更新 apt 包数据库

apt-get upgrade

并安装最新的更新(如果有的话)。

6 更改默认外壳

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

dpkg-reconfigure dash

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

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

7 同步系统时钟

最好通过 Internet 将系统时钟与 NTP(网络时间协议)服务器同步。只需运行

apt-get install ntp ntpdate

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

8 安装 Postfix、Dovecot、MySQL、phpMyAdmin、rkhunter、binutils

我们可以使用一个命令安装 Postfix、Dovecot、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 dovecot-lmtpd sudo

如果您更喜欢 MySQL 而不是 MariaDB,请将上述命令中的包 \mariadb-client mariadb-server\ 替换为 \mysql-client mysql-server\。

您将被问及以下问题:

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

nano /etc/postfix/master.cf

如下取消提交和 smtps 部分的注释,并在必要的地方添加行,以便 master.cf 文件的这一部分看起来与下面的完全一样。

[...]
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=
# -o smtpd_relay_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=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING [...]

之后重启 Postfix:

service postfix restart

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

nano /etc/mysql/my.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
[...]

然后我们重启MySQL:

service mysql restart

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

netstat -tap | grep mysql

输出应如下所示:

:/tmp# netstat -tap | grep mysql
tcp6 0 0 [::]:mysql [::]:* LISTEN 27371/mysqld

9 安装 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
systemctl disable spamassassin
©2015-2025 艾丽卡 support@alaica.com