OpenRA 服务器搭建开源重制经典红色警戒和命令与征服OpenRA 是一款完全免费的开源项目致力于用现代引擎重制经典即时战略游戏——红色警戒Red Alert、命令与征服泰伯利亚黎明Tiberian Dawn以及沙丘 2000Dune 2000。与原版游戏不同OpenRA 原生支持 Linux内置在线多人对战系统玩家可以通过官方大厅列表发现和加入全球服务器也可以搭建私有服务器供好友联机。本教程将指导你在 Ubuntu 22.04 上搭建一台 OpenRA 专用服务器包括安装 OpenRA、配置服务端参数、设置 systemd 守护进程和防火墙规则并介绍如何同时托管红色警戒和命令与征服两个游戏的服务器实例。服务器配置建议OpenRA 服务端使用纯 C# 编写基于 .NET/Mono在空载时内存占用约 150–300 MB满人对战8 人通常在 400 MB 以内。CPU 占用相对较低主要消耗在地图计算和网络同步。推荐选择2 核 2GB 机型可以同时跑红色警戒和命令与征服两个服务器实例满足日常小队联机需求。推荐使用雨云服务器 rainyun-com注册填码2026off领 5 折价格实惠带宽充足适合长期托管经典 RTS 游戏服务器。操作系统推荐Ubuntu 22.04 LTS。安装依赖OpenRA 依赖 .NET 运行时现代版本已迁移到 .NET 6安装前先确保系统软件包是最新的。# 更新系统sudoaptupdatesudoaptupgrade-y# 安装常用工具sudoaptinstall-ywgetcurlgitunzip下载并安装 OpenRAOpenRA 提供 deb 包和 AppImage 两种安装方式。推荐使用 GitHub Releases 上的 deb 包安装简单且便于 systemd 管理。# 查看最新版本访问 GitHub Releases 确认版本号# https://github.com/OpenRA/OpenRA/releases# 以 release-20231010 为例OPENRA_VERSIONrelease-20231010# 下载 deb 包wget-O/tmp/openra.deb\https://github.com/OpenRA/OpenRA/releases/download/${OPENRA_VERSION}/openra_${OPENRA_VERSION}_amd64.deb# 安装sudodpkg-i/tmp/openra.debsudoapt-getinstall-f-y# 修复可能的依赖问题# 验证安装openra-ra--versionopenra-cnc--version也可以通过 apt 安装版本可能略旧sudoaptinstall-yopenra下载服务端OpenRA 安装完成后服务端二进制文件通常位于/usr/lib/openra/。你也可以单独下载服务端版本# 创建专用目录和用户sudomkdir-p/opt/openrasudouseradd-r-s/bin/false-d/opt/openra openrasudochownopenra:openra /opt/openra# 确认服务端可执行文件位置whichopenra-ra# 通常输出/usr/bin/openra-ra配置文件OpenRA 服务端通过命令行参数传入配置无需配置文件。核心参数如下参数说明示例Server.Name服务器显示名称我的红警服务器Server.ListenPort监听端口1234Server.MaxPlayers最大玩家数8Server.Password房间密码留空为公开Server.AdvertiseOnline是否在官方列表中显示TrueServer.Map起始地图 Hash可选启动脚本红色警戒服务器sudotee/opt/openra/start-ra.sh/dev/nullEOF #!/bin/bash exec openra-ra \ Server.Name雨云红色警戒服务器 \ Server.ListenPort1234 \ Server.MaxPlayers8 \ Server.Password \ Server.AdvertiseOnlineTrue \ Server.RequireAuthenticationFalse EOFsudochmodx /opt/openra/start-ra.sh命令与征服泰伯利亚黎明服务器sudotee/opt/openra/start-cnc.sh/dev/nullEOF #!/bin/bash exec openra-cnc \ Server.Name雨云泰伯利亚黎明服务器 \ Server.ListenPort1235 \ Server.MaxPlayers8 \ Server.Password \ Server.AdvertiseOnlineTrue \ Server.RequireAuthenticationFalse EOFsudochmodx /opt/openra/start-cnc.sh沙丘 2000 服务器sudotee/opt/openra/start-d2k.sh/dev/nullEOF #!/bin/bash exec openra-d2k \ Server.Name雨云沙丘2000服务器 \ Server.ListenPort1236 \ Server.MaxPlayers6 \ Server.Password \ Server.AdvertiseOnlineTrue EOFsudochmodx /opt/openra/start-d2k.sh手动测试前台运行sudo-uopenra /opt/openra/start-ra.sh看到类似Server listening on port 1234的输出即表示启动成功按CtrlC停止。systemd 服务为红色警戒和命令与征服分别创建 systemd 服务单元红色警戒服务sudotee/etc/systemd/system/openra-ra.service/dev/nullEOF [Unit] DescriptionOpenRA Red Alert Dedicated Server Afternetwork.target [Service] Typesimple Useropenra WorkingDirectory/opt/openra ExecStart/opt/openra/start-ra.sh Restarton-failure RestartSec15 StandardOutputjournal StandardErrorjournal SyslogIdentifieropenra-ra [Install] WantedBymulti-user.target EOF命令与征服服务sudotee/etc/systemd/system/openra-cnc.service/dev/nullEOF [Unit] DescriptionOpenRA Tiberian Dawn Dedicated Server Afternetwork.target [Service] Typesimple Useropenra WorkingDirectory/opt/openra ExecStart/opt/openra/start-cnc.sh Restarton-failure RestartSec15 StandardOutputjournal StandardErrorjournal SyslogIdentifieropenra-cnc [Install] WantedBymulti-user.target EOF启动并设置开机自启sudosystemctl daemon-reload# 启用并启动红色警戒服务sudosystemctlenable--nowopenra-ra# 启用并启动命令与征服服务sudosystemctlenable--nowopenra-cnc# 查看状态sudosystemctl status openra-rasudosystemctl status openra-cnc防火墙配置OpenRA 服务端默认使用TCP 1234 端口每个游戏实例使用不同端口。# 红色警戒端口sudoufw allow1234/tcp# 命令与征服端口sudoufw allow1235/tcp# 沙丘 2000 端口如果运行sudoufw allow1236/tcp# 如果 UFW 未启用sudoufwenable# 查看规则sudoufw status verbose同时在雨云控制台的安全组中放行对应端口的 TCP 入站规则。查询服务器状态通过日志查看连接信息# 实时查看红色警戒服务器日志sudojournalctl-uopenra-ra-f# 查看最近 100 行日志sudojournalctl-uopenra-ra-n100通过 OpenRA 客户端验证启动 OpenRA 客户端红色警戒点击「多人游戏」→「直接连接」输入服务器 IP 和端口1234如果服务器配置了AdvertiseOnlineTrue它还会出现在全球服务器列表中常用管理操作# 重启红色警戒服务器sudosystemctl restart openra-ra# 停止服务器sudosystemctl stop openra-ra# 查看所有 openra 相关进程psaux|grepopenra# 查看端口监听状态ss-tlnp|grep-E1234|1235|1236结尾通过本教程你已成功在 Linux 上搭建了 OpenRA 专用服务器可以同时为红色警戒、命令与征服等经典 RTS 游戏提供多人联机服务。OpenRA 完全免费服务端轻量非常适合长期托管。