当前位置 : 145z游戏站 | 热血传奇 | 技术教程 | 

Linux各系列服务器怎么架设传奇?CentOS/Ubuntu/Debian分步指南

热度:
一、Linux各系列前期通用准备
系统版本确认(关键第一步)
CentOS:执行cat/etc/redhat-release,确认版本(如CentOS7.x、8.x,7.x系列兼容性最佳);
Ubuntu:执行lsb_release-a,推荐20.04LTS或22.04LTS版本(长期支持版稳定性高);
Debian:执行cat/etc/debian_version,选择10(Buster)或11(Bullseye)版本(适配多数传奇服务端);
统一要求:均使用64位系统,32位系统易出现内存不足或依赖库缺失问题。
必备工具清单(跨系列适配版)
远程工具:Xshell(命令行操作)、WinSCP(可视化传文件,Windows与Linux互传通用);
传奇服务端:选择Linux通用版或对应系统适配版(如“Linux全系列兼容1.76复古端”,避免Windows端,会报错);
数据库:MariaDB5.5-10.5(各系列均兼容,替代MySQL,高版本易适配失败);
依赖库:gcc、glibc-devel、net-tools(CentOS用yum装,Ubuntu/Debian用apt装,服务端运行必需);
编辑器:Notepad++(本地改配置文件,支持Linux编码,避免乱码);
登录器:Linux通用版侠客登录器(生成客户端可识别的.exe文件,跨系统连接无压力)。
通用系统配置
关闭SELinux(仅CentOS需操作):编辑/etc/selinux/config,改SELINUX=enforcing为SELINUX=disabled,执行setenforce0临时生效;
统一建目录:执行mkdir-p/usr/local/legend/server/usr/local/legend/data,分别存服务端和数据库文件,管理更清晰。
二、各系列Linux环境搭建(核心差异点)
(一)CentOS系列(以7.x为例)
依赖与数据库安装
装依赖:yuminstall-ygccglibc-develnet-toolsmariadb-servermariadb;
启数据库:systemctlstartmariadb,设开机自启:systemctlenablemariadb;
初始化数据库:mysql_secure_installation,按提示设root密码,删匿名账号(选“Y”)。
数据库配置(与其他系列通用步骤)
登录:mysql-uroot-p,输密码进入;
建库授权:createdatabaselegend_dbcharactersetutf8;grantallonlegend_db.*to'legend_user'@'localhost'identifiedby'你的密码';flushprivileges;;
导数据:WinSCP传db.sql到/usr/local/legend/data,执行mysql-ulegend_user-plegend_db</usr/local/legend/data/db.sql,输密码完成。
(二)Ubuntu系列(以20.04LTS为例)
依赖与数据库安装(包管理器差异)
先更新源:aptupdate;
装依赖:aptinstall-ygcclibc6-devnet-toolsmariadb-server;
启数据库:systemctlstartmariadb,设开机自启:systemctlenablemariadb;
初始化:同CentOS,执行mysql_secure_installation,步骤一致。
(三)Debian系列(以11为例)
依赖与数据库安装(适配细节)
更新源:aptupdate&&aptupgrade-y;
装依赖:aptinstall-ygcclibc6-devnet-toolsmariadb-server(与Ubuntu命令一致,但需确认依赖完整性);
启数据库:systemctlstartmariadb,设自启:systemctlenablemariadb;
初始化:同前两系列,无差异。
三、Linux各系列通用服务端部署
文件传输与解压
WinSCP传Linux版服务端压缩包(如legend_server.tar.gz)到/usr/local/legend/server;
解压命令(通用):tar-zxvf/usr/local/legend/server/legend_server.tar.gz-C/usr/local/legend/server。
权限设置(各系列必需)
执行:chmod+x/usr/local/legend/server/*.shchmod+x/usr/local/legend/server/GameSrv/usr/local/legend/server/LoginSrv(Linux权限严格,不设会启动失败)。
配置文件修改(通用步骤)
改IP和端口:vi/usr/local/legend/server/Config/ServerInfo.conf,按i编辑,ServerIP设为公网IP,ServerPort设7000(默认未占用),Esc+:wq保存;
调游戏参数:vi/usr/local/legend/server/Config/GameConfig.conf,改经验倍率(如ExpRate=5)、金币掉落率(GoldRate=3),保存方式同上。
启动服务端(通用命令)
后台启动:nohup/usr/local/legend/server/StartServer.sh&(关闭远程工具不中断进程);
验证:psaux|grepGameSrv,显示GameSrv和LoginSrv进程即成功;若缺库(如libstdc++.so.6),CentOS用yuminstall-ylibstdc++,Ubuntu/Debian用aptinstall-ylibstdc++6。
四、登录器适配与各系列网络配置
登录器生成(通用)
WinSCP传Linux登录器工具到/usr/local/legend/server,设权限:chmod+x/usr/local/legend/server/LoginMaker;
生成命令:cd/usr/local/legend/server./LoginMaker-ip你的公网IP-port7000-out/usr/local/legend/server/LegendLogin.exe;
下载登录器:WinSCP把LegendLogin.exe下到本地,复制到传奇客户端根目录。
防火墙配置(各系列差异)
CentOS(firewalld):firewall-cmd--zone=public--add-port=7000/tcp--permanentfirewall-cmd--reload,验证:firewall-cmd--query-port=7000/tcp(显“yes”);
Ubuntu/Debian(ufw):先启用ufw:ufwenable,再开放端口:ufwallow7000/tcp,验证:ufwstatus(显7000/tcp允许)。
五、各系列通用常见问题解决
服务端进程秒消失
查日志:catnohup.out,若显“数据库连接失败”,核对ServerInfo.conf中数据库账号密码;若显“权限不足”,重新执行chmod+x命令。
客户端连不上服务器
排查:①查端口监听:netstat-tuln|grep7000(显0.0.0.0:7000即正常);②查公网IP:curlifconfig.me(确认与配置一致);③云服务器需在控制台安全组开放7000端口(各厂商通用)。
游戏内中文乱码
改编码:echo"exportLANG=en_US.UTF-8">>/etc/profilesource/etc/profile,重启服务端:pkillGameSrvnohup/usr/local/legend/server/StartServer.sh&。
数据库远程连接(需管理时)
授权:mysql-uroot-pgrantallon*.*to'root'@'%'identifiedby'你的密码';flushprivileges;;
开端口:CentOS放3306端口(firewall-cmd--add-port=3306/tcp--permanent),Ubuntu/Debian放3306(ufwallow3306/tcp),即可用Navicat远程连。
[顶部]