InfrawireInfrawire 标志文档

通过脚本安装 Pterodactyl 面板

本指南将教您如何使用简化的自动安装脚本在 VPS 上安装 Pterodactyl 面板和 Wings。Pterodactyl 是一个免费开源的用于管理游戏服务器(Minecraft、FiveM 等)的管理面板。

📋 先决条件

  • 具有 root 访问权限的 VPS 服务器
  • 至少 1 GB RAM(推荐 2 GB)
  • Ubuntu 22.04/24.04、Debian 11/12/13、Rocky Linux 8/9 或 AlmaLinux 8/9
  • 指向您的 VPS IP 的域名(可选但推荐)
  • 端口 80、443、2022 和 8080 开放(如果使用防火墙)

Important: Pterodactyl 需要干净的服务器。建议在新安装的系统上安装以避免冲突。

💡 基础设施推荐

Pterodactyl Panel 非常适合管理资源密集型的游戏服务器。为了获得最佳性能,我们推荐使用我们的性能VPS,它们提供高性能处理器和DDR5 RAM,非常适合同时托管多个游戏服务器(Minecraft、FiveM等)。

Info — 若希望自动完成 Pterodactyl(面板与 Wings)的安装,可选择我们的 Pterodactyl 托管

🚀 安装 Pterodactyl 面板

服务器准备

在安装 Pterodactyl 之前,准备您的服务器:

Bash
1# 更新系统 2sudo apt update && sudo apt upgrade -y 3 4# 如需要,安装 curl 5sudo apt install curl -y 6 7# 验证您是 root 或使用 sudo 8whoami

通过简化脚本安装

自动安装脚本大大简化了 Pterodactyl 的安装:

Bash
# 启动 Pterodactyl 安装脚本 bash <(curl -s https://pterodactyl-installer.se)

脚本将逐步指导您完成安装:

  1. 安装类型选择

    • 面板安装(Pterodactyl 面板)
    • Wings 安装(用于管理服务器的守护进程)
    • 完整安装(面板 + Wings)
  2. 系统配置

    • 自动安装依赖项(PHP、MySQL、Nginx 等)
    • 数据库配置
    • Web 服务器配置(Nginx)
    • SSL 配置(Let's Encrypt)

仅安装面板

如果您只想安装面板(用于管理服务器):

Bash
1# 启动脚本 2bash <(curl -s https://pterodactyl-installer.se) 3 4# 选择选项 "1" 安装面板 5# 按照脚本说明操作

完整安装(面板 + Wings)

在同一服务器上安装面板和 Wings:

Bash
1# 启动脚本 2bash <(curl -s https://pterodactyl-installer.se) 3 4# 选择选项 "3" 进行完整安装 5# 按照脚本说明操作

⚙️ 面板配置

初始配置

面板安装后,您需要配置:

  1. 创建管理员帐户

    • 脚本将要求您创建第一个管理员用户
    • 选择电子邮件和安全密码
  2. 数据库配置

    • 脚本将自动创建 MySQL 数据库
    • 记录数据库凭据
  3. 域名配置

    • 如果您有域名,脚本将自动配置 Nginx
    • 否则,您可以通过服务器 IP 访问

访问面板

安装完成后,访问面板:

Bash
1# 如果您配置了域名 2https://your-domain.com 3 4# 如果您没有域名 5http://YOUR_SERVER_IP

Important: 如果您使用 HTTP(无域名),您需要接受自签名证书或手动配置 SSL。

🛠️ 安装 Wings(守护进程)

Wings 是实际管理游戏服务器的守护进程。您可以将其安装在面板所在的同一服务器上,或安装在单独的服务器上。

在同一服务器上安装 Wings

Bash
1# 启动脚本 2bash <(curl -s https://pterodactyl-installer.se) 3 4# 选择选项 "3" 进行完整安装 5# 或者如果您已安装面板,选择选项 "2"

在单独服务器上安装 Wings

如果您在与面板不同的服务器上安装 Wings:

Bash
1# 在要安装 Wings 的服务器上 2bash <(curl -s https://pterodactyl-installer.se) 3 4# 选择选项 "2" 仅安装 Wings 5# 按照脚本说明操作

Wings 配置

安装后,您需要配置 Wings:

  1. 获取 API 密钥

    • 登录面板
    • 转到 Administration → Configuration → Nodes
    • 创建新节点或使用现有节点
    • 复制 API 密钥和 FQDN
  2. 配置 Wings

    Bash
    1# 编辑 Wings 配置文件 2sudo nano /etc/pterodactyl/config.yml 3 4# 粘贴来自面板的 API 密钥和 FQDN 5# 保存并退出(Ctrl+X,然后 Y,然后 Enter)
  3. 启动 Wings

    Bash
    1# 启动 Wings 服务 2sudo systemctl start wings 3 4# 在启动时启用 Wings 5sudo systemctl enable wings 6 7# 验证状态 8sudo systemctl status wings

🔧 防火墙配置(UFW)

如果您使用 UFW,配置必要的端口:

Bash
1# 允许 Pterodactyl 面板的端口 2sudo ufw allow 80/tcp 3sudo ufw allow 443/tcp 4 5# 允许 Wings 端口(默认 8080) 6sudo ufw allow 8080/tcp 7 8# 允许 Wings SFTP 端口(默认 2022) 9sudo ufw allow 2022/tcp 10 11# 验证规则 12sudo ufw status

Important: 如果您更改 Wings 的默认端口,请勿忘记在防火墙中打开它们。

📝 安装后配置

验证安装

Bash
1# 验证面板是否工作 2curl -I http://localhost 3 4# 验证 Wings 是否工作 5sudo systemctl status wings 6 7# 检查 Wings 日志 8sudo journalctl -u wings -f

更新 Pterodactyl

要更新面板或 Wings:

Bash
1# 重新启动安装脚本 2bash <(curl -s https://pterodactyl-installer.se) 3 4# 选择更新选项 5# 脚本将检测现有安装并提供更新

有用的 Wings 命令

Bash
1# 重启 Wings 2sudo systemctl restart wings 3 4# 停止 Wings 5sudo systemctl stop wings 6 7# 实时查看日志 8sudo journalctl -u wings -f 9 10# 在不重启的情况下重新加载 Wings 配置 11sudo wings --debug

🎮 创建您的第一个服务器

在 Pterodactyl 面板中

  1. 创建用户

    • 转到 Users → New User
    • 为您自己创建帐户(如果尚未完成)
  2. 创建服务器

    • 点击 "Create a new server"
    • 选择一个节点(您的 Wings)
    • 选择一个 Egg(Minecraft、FiveM 等)
    • 配置资源(RAM、CPU、磁盘)
    • 设置名称和描述
  3. 启动服务器

    • 创建后,点击您的服务器
    • 点击 "Power" → "Start" 以启动

✅ 验证和测试

验证一切正常工作

Bash
1# 验证面板(应返回 HTTP 200) 2curl -I http://localhost 3 4# 验证 Wings 5sudo systemctl status wings 6 7# 验证所需服务 8sudo systemctl status nginx 9sudo systemctl status mysql 10sudo systemctl status redis

测试面板 → Wings 连接

在面板中:

  1. 转到 Administration → Nodes
  2. 验证您的节点在线(绿色状态)
  3. 如果节点离线,检查 Wings 配置

🆘 故障排除

面板不显示

Bash
1# 验证 Nginx 是否工作 2sudo systemctl status nginx 3 4# 检查 Nginx 日志 5sudo tail -f /var/log/nginx/error.log 6 7# 重启 Nginx 8sudo systemctl restart nginx 9 10# 验证 Nginx 配置 11sudo nginx -t

Wings 无法启动

Bash
1# 检查 Wings 日志 2sudo journalctl -u wings -n 50 3 4# 检查配置文件 5sudo nano /etc/pterodactyl/config.yml 6 7# 验证配置语法 8sudo wings --debug 9 10# 验证端口 8080 是否空闲 11sudo netstat -tlnp | grep 8080

面板 → Wings 连接错误

Bash
1# 验证 config.yml 中的 API 密钥 2sudo cat /etc/pterodactyl/config.yml | grep -i "api\|token" 3 4# 验证 FQDN 是否正确 5sudo cat /etc/pterodactyl/config.yml | grep -i "remote" 6 7# 验证网络连接 8curl -I https://YOUR_PANEL_DOMAIN 9 10# 重启 Wings 11sudo systemctl restart wings

数据库问题

Bash
1# 验证 MySQL 是否工作 2sudo systemctl status mysql 3 4# 连接到 MySQL 5sudo mysql -u root -p 6 7# 在 MySQL 中,列出数据库 8SHOW DATABASES; 9 10# 验证 pterodactyl 数据库是否存在 11USE pterodactyl; 12SHOW TABLES;

SSL/HTTPS 错误

如果您遇到 SSL 问题:

Bash
1# 验证 Certbot 2sudo certbot --version 3 4# 更新 SSL 证书 5sudo certbot renew 6 7# 验证 Nginx SSL 配置 8sudo nginx -t 9sudo systemctl reload nginx

📚 其他资源

❓ 常见问题

问:我可以在单独的服务器上安装面板和 Wings 吗?
答:是的,甚至推荐用于大型部署。在一台服务器上安装面板,在一台或多台其他服务器上安装 Wings。然后配置 Wings 通过 API 密钥连接到面板。

问:面板和 Wings 有什么区别?
答:面板是用于管理服务器的 Web 界面。Wings 是在游戏服务器上运行并实际管理 Docker 容器和游戏服务器的守护进程。

问:我可以在没有域名的情况下安装 Pterodactyl 吗?
答:是的,您可以使用服务器 IP,但需要手动配置 SSL 或接受自签名证书。强烈建议使用带有 Let's Encrypt 的域名。

问:脚本会自动安装 Docker 吗?
答:是的,脚本会自动安装 Wings 所需的 Docker 和 Docker Compose。

问:安装后如何更新 Pterodactyl?
答:重新启动安装脚本。它将检测现有安装并提供更新:

Bash
bash <(curl -s https://pterodactyl-installer.se)

问:我可以使用除 Nginx 之外的另一个 Web 服务器吗?
答:脚本会自动安装 Nginx。您可以使用 Apache,但需要在安装后手动配置。

问:安装 Pterodactyl 需要多少 RAM?
答:最少 1 GB RAM,但推荐 2 GB。要管理游戏服务器,您需要根据服务器的数量和大小额外 RAM。

问:如何创建多个游戏服务器?
答:配置面板和 Wings 后,您可以在面板中创建任意数量的服务器。每个服务器将使用一部分资源(RAM、CPU、磁盘)。

问:我可以将 Pterodactyl 用于游戏之外的服务器吗?
答:是的,Pterodactyl 可以管理任何 Docker 容器。您可以将其用于 Web 应用程序、Discord 机器人等。