在 Debian 10、Debian 11、Ubuntu 20.04 和 Ubuntu 22.04 上完美服务器自动化 ISPConfig 3 安装
在此页
- 先决条件
- 1。登录服务器
- 2。配置主机名和主机
- 3。更新系统
- 4。运行自动安装程序
- 5。设置防火墙
- 6。高级选项
- 7.定稿
- 8 下载为虚拟机
本教程将带您使用 ISPConfig 自动安装程序安装您自己的 ISPConfig 3 单服务器设置。此安装程序遵循旧的 Perfect Server 指南,但更加模块化且易于遵循。如果你想为每项服务设置专用服务器的多服务器设置,请参阅 Perfect Multiserver 指南。
本指南适用于 Debian 10、Debian 11、Ubuntu 20.04 和 Ubuntu 22.04,目前仅支持 x86_64(也称为 AMD64)CPU 架构,不支持 ARM。我们将使用主机名 server1.example.com。必要时更换它。该指南需要全新安装的空基本操作系统,请勿尝试在已配置其他服务的系统上使用它。
先决条件
- 操作系统:Debian 10、Debian 11、Ubuntu 20.04 或 Ubuntu 22.04。
- Intel 或 AMD 64 位 CPU 架构(x86_64,也称为 AMD64)。目前不支持 ARM CPU。
- 系统必须能够访问互联网才能使用 apt 下载和安装软件。
- 从干净且空的基本操作系统安装开始。
1.登录服务器
以 root 身份登录或运行
su -
在继续之前成为服务器上的 root 用户。重要提示:您必须使用 su - 而不仅仅是 su,否则您的 PATH 变量会被 Debian 设置错误。
2.配置hostname和hosts
服务器的主机名应该是一个子域,如 \server1.example.com\。不要使用没有子域部分的域名作为主机名,如 \example.com\,因为这会导致以后的设置出现问题。首先,您应该检查 /etc/hosts 中的主机名,并在必要时进行更改。该行应为:\IP 地址 - 空格 - 完整主机名,包括域 - 空格 - 子域部分\。对于我们的主机名 server1.example.com,该文件应如下所示(某些行可能不同,每个托管服务提供商可能不同):
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
# This line should be changed to the correct servername:
127.0.1.1 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
最后,重新启动服务器以应用更改:
systemctl reboot
再次登录并使用以下命令检查主机名是否正确:
hostname
hostname -f
输出应如下所示:
:~$ hostname -f
server1.example.com
您还必须使用指向您的服务器的 DNS 提供商设置 DNS 记录。指向您的公共 IP 的子域应该有一个 A(和/或 AAAA)记录。
3.更新系统
要更新系统包,请运行以下命令:
apt update && apt upgrade
4.运行自动安装程序
我们现在可以运行自动安装程序。基本设置包含以下软件包(当然还有它们的依赖项):Apache2、PHP(版本 5.6 - 8.0)、MariaDB、Postfix、Dovecot、Rspamd、BIND、Jailkit、Roundcube、PHPMyAdmin、Mailman、Webalizer、AWStats 和 GoAccess。您可以通过将参数传递给安装程序轻松地选择不使用某些功能或安装额外的服务。您可以使用以下命令查看所有参数:
wget -O - https://get.ispconfig.org | sh -s -- --help
您现在可以使用参数运行脚本。例如,如果您想要使用被动 FTP + 无人值守升级的端口范围进行正常安装,请运行:
wget -O - https://get.ispconfig.org | sh -s -- --use-ftp-ports=40110-40210
--unattended-upgrades
一段时间后,您会看到:
WARNING! This script will reconfigure your complete server!
It should be run on a freshly installed server and all current configuration that you have done will most likely be lost!
Type 'yes' if you really want to continue:
回答“是”并按回车键。安装程序现在将启动。
安装程序完成后,它会向您显示 ISPConfig 管理员和 MySQL root 密码,如下所示:
[INFO] Your ISPConfig admin password is: 5GvfSSSYsdfdYC
[INFO] Your MySQL root password is: kkAkft82d!kafMwqxdtYs
请务必记下这些信息,因为您稍后会需要它们。
5.设置防火墙
最后要做的是设置我们的防火墙。
登录到 ISPConfig UI,然后转到系统 -> 防火墙。然后单击“添加新的防火墙记录”。
对于正常设置,它看起来像这样:
TCP:
20,21,22,25,80,443,40110:40210,110,143,465,587,993,995,53,8080,8081
网络协议:
53
每个服务的必要端口是:
Web:20、21、22、80、443 和 40110:40210(所有 TCP,无 UDP)
邮件:25、110、143、465、587、993 和 995(所有 TCP,无 UDP)
DNS:53(TCP 和 UDP)
面板:8080 和 8081(所有 TCP,无 UDP)
您的服务器现已设置并可以使用。您可以登录 https://server1.example.com:8080
6.高级选项
自动安装程序有各种命令行选项来微调设置。你可以例如在 Apache 和 Nginx 网络服务器之间进行选择,以及应在系统上安装哪些服务。命令行参数是:
Usage: ispc3-ai.sh [] [...]
This script automatically installs all needed packages for an ISPConfig 3 setup using the guidelines from the "Perfect Server Setup" howtos on linux教程.
Possible arguments are:
--help Show this help page
--debug Enable verbose logging (logs each command with the exit code)
--channel Choose the channel to use for ISPConfig. --channel=<stable|dev>
"stable" is the latest ISPConfig release available on www.ispconfig.org
"dev" is the latest stable-branch from the ISPConfig git repository: https://git.ispconfig.org/ispconfig/ispconfig3/tree/stable-3.1
-> The dev channel might contain bugs and less-tested features and should only be used in production by very experienced users.
--lang Use language for ISPConfig installation. Specify with --lang=en|de (only en (English) and de (German) supported currently).
--interactive Don't install ISPConfig in non-interactive mode. This is needed if you want to use expert mode, e. g. to install a slave server that shall be integrated into an existing
multiserver setup.
--use-nginx Use nginx webserver instead of apache2
--use-amavis Use amavis instead of rspamd for mail filtering
--use-unbound Use unbound instead of bind9 for local resolving. Only allowed if --no-dns is set.
--use-php Use specific PHP versions, comma separated, instead of installing multiple PHP, e.g. --use-php=7.4,8.0 (5.6, 7.0, 7.1, 7.2, 7.3, 7.4 and 8.0 available).
--use-php=system disables the sury repository and just installs the system's default PHP version.
ommiting the argument (use all versions)
--use-ftp-ports This option sets the passive port range for pure-ftpd. You have to specify the port range separated by hyphen, e. g. --use-ftp-ports=40110-40210.
If not provided the passive port range will not be configured.
--use-certbot Use Certbot instead of acme.sh for issuing Let's Encrypt certificates. Not adviced unless you are migrating from a old server that uses Certbot.
--no-web Do not use ISPConfig on this server to manage webserver setting and don't install nginx/apache or pureftpd. This will also prevent installing an ISPConfig UI and implies
--no-roundcube as well as --no-pma
--no-mail Do not use ISPConfig on this server to manage mailserver settings. This will install postfix for sending system mails, but not dovecot and not configure any settings for
ISPConfig mail. It implies --no-mailman.
--no-dns Do not use ISPConfig on this server to manage DNS entries. Bind will be installed for local DNS caching / resolving only.
--no-local-dns Do not install local DNS caching / resolving via bind.
--no-firewall Do not install ufw and tell ISPConfig to not manage firewall settings on this server.
--no-roundcube Do not install roundcube webmail.
--roundcube Install Roundcube even when --no-mail is used. Manual configuration of Roundcube config is needed.
--no-pma Do not install PHPMyAdmin on this server.
--no-mailman Do not install Mailman mailing list manager.
--no-quota Disable file system quota
--no-ntp Disable NTP setup
--unattended-upgrades
Install UnattendedUpgrades. You can add extra arguments for automatic cleanup and automatic reboots when necessary with --unattended-upgrades=autoclean,reboot (or only
one of them).
--i-know-what-i-am-doing
Prevent the autoinstaller to ask for confirmation before continuing to reconfigure the server.
例如,要使用 Nginx 而不是 Apache 安装 Perfect Server 之类的设置,请使用以下命令:
wget -O - https://get.ispconfig.org | sh -s -- --use-nginx --use-ftp-ports=40110-40210
--unattended-upgrades
或者安装一个没有电子邮件和 DNS 服务的 Nginx 网络服务器:
wget -O - https://get.ispconfig.org | sh -s -- --use-nginx --no-dns --no-mail --use-ftp-ports=40110-40210
--unattended-upgrades
7. 定稿
您的设置现已完成!
您可以通过购买我们的手册来支持 ISPConfig:https://www.ispconfig.org/documentation/
以下链接是一些有用的教程/指针,可用于进一步设置:
- 设置邮件(rDNS、SPF、DKIM):https://linux教程/how-to-install-an-email-server-with-ispconfig-on-debian-10/
- 调整 Roundcube:https://linux教程/community/threads/tweaking-the-roundcube-settings.86387/
- 设置自动配置(为您的电子邮件客户端自动配置):https://schaal-it.com/ispconfig-automail/
- 提高 PHPMyAdmin 和 rspamd 界面的安全性:https://linux教程/community/threads/improving-the-security-of-phpmyadmin-and-rspamd-ui.86544/
- ISPConfig 自动安装程序的代码存储库和问题跟踪器:https://git.ispconfig.org/ispconfig/ispconfig-autoinstaller
如果您有任何问题,请在论坛上提问。
8 下载为虚拟机
此设置可作为 ova/ovf 格式的虚拟机下载(与 VMWare 和 Virtualbox 兼容)供 howtoforge 订阅者使用。虚拟机基于 Debian 11 并使用 Apache 作为 Web 服务器。
VM 的登录详细信息
- 根密码是:howtoforge
- ISPConfig \admin\ 用户的密码是:howtoforge
- 还有另一个 shell 用户,名称为“administrator”,密码为:howtoforge
- MySQL 根密码是:4VLc2vw5mZzqHNd4xURT
请在首次登录时更改所有密码。
- VM 的 IP 地址是 192.168.0.100