🎮 通过脚本安装 Pterodactyl 面板

使用简化的自动安装脚本在 VPS 上安装 Pterodactyl 面板和 Wings 以轻松管理游戏服务器的完整指南。

🎮 通过脚本安装 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等)。

🚀 安装 Pterodactyl 面板

服务器准备

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

# 更新系统 sudo apt update && sudo apt upgrade -y # 如需要,安装 curl sudo apt install curl -y # 验证您是 root 或使用 sudo whoami

通过简化脚本安装

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

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

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

  1. 安装类型选择

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

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

仅安装面板

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

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

完整安装(面板 + Wings)

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

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

⚙️ 面板配置

初始配置

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

  1. 创建管理员帐户

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

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

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

访问面板

安装完成后,访问面板:

# 如果您配置了域名 https://your-domain.com # 如果您没有域名 http://YOUR_SERVER_IP

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

🛠️ 安装 Wings(守护进程)

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

在同一服务器上安装 Wings

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

在单独服务器上安装 Wings

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

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

Wings 配置

安装后,您需要配置 Wings:

  1. 获取 API 密钥

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

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

    # 启动 Wings 服务 sudo systemctl start wings # 在启动时启用 Wings sudo systemctl enable wings # 验证状态 sudo systemctl status wings

🔧 防火墙配置(UFW)

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

# 允许 Pterodactyl 面板的端口 sudo ufw allow 80/tcp sudo ufw allow 443/tcp # 允许 Wings 端口(默认 8080) sudo ufw allow 8080/tcp # 允许 Wings SFTP 端口(默认 2022) sudo ufw allow 2022/tcp # 验证规则 sudo ufw status

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

📝 安装后配置

验证安装

# 验证面板是否工作 curl -I http://localhost # 验证 Wings 是否工作 sudo systemctl status wings # 检查 Wings 日志 sudo journalctl -u wings -f

更新 Pterodactyl

要更新面板或 Wings:

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

有用的 Wings 命令

# 重启 Wings sudo systemctl restart wings # 停止 Wings sudo systemctl stop wings # 实时查看日志 sudo journalctl -u wings -f # 在不重启的情况下重新加载 Wings 配置 sudo wings --debug

🎮 创建您的第一个服务器

在 Pterodactyl 面板中

  1. 创建用户

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

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

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

✅ 验证和测试

验证一切正常工作

# 验证面板(应返回 HTTP 200) curl -I http://localhost # 验证 Wings sudo systemctl status wings # 验证所需服务 sudo systemctl status nginx sudo systemctl status mysql sudo systemctl status redis

测试面板 → Wings 连接

在面板中:

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

🆘 故障排除

面板不显示

# 验证 Nginx 是否工作 sudo systemctl status nginx # 检查 Nginx 日志 sudo tail -f /var/log/nginx/error.log # 重启 Nginx sudo systemctl restart nginx # 验证 Nginx 配置 sudo nginx -t

Wings 无法启动

# 检查 Wings 日志 sudo journalctl -u wings -n 50 # 检查配置文件 sudo nano /etc/pterodactyl/config.yml # 验证配置语法 sudo wings --debug # 验证端口 8080 是否空闲 sudo netstat -tlnp | grep 8080

面板 → Wings 连接错误

# 验证 config.yml 中的 API 密钥 sudo cat /etc/pterodactyl/config.yml | grep -i "api\|token" # 验证 FQDN 是否正确 sudo cat /etc/pterodactyl/config.yml | grep -i "remote" # 验证网络连接 curl -I https://YOUR_PANEL_DOMAIN # 重启 Wings sudo systemctl restart wings

数据库问题

# 验证 MySQL 是否工作 sudo systemctl status mysql # 连接到 MySQL sudo mysql -u root -p # 在 MySQL 中,列出数据库 SHOW DATABASES; # 验证 pterodactyl 数据库是否存在 USE pterodactyl; SHOW TABLES;

SSL/HTTPS 错误

如果您遇到 SSL 问题:

# 验证 Certbot sudo certbot --version # 更新 SSL 证书 sudo certbot renew # 验证 Nginx SSL 配置 sudo nginx -t sudo systemctl reload nginx

📚 其他资源

❓ 常见问题

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

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

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

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

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

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 机器人等。