基本安装 - maramail/FiveMNote GitHub Wiki

本笔记以Ubuntu为例

服务器结构包括两部分,server和server-data

安装

  • 创建一个新目录(如 mkdir /root/myserver/server
  • 从[https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/ artifacts server]下载(建议最新)版本的server数据。每一项是一个新的版本(注意看日期),点进去然后选择下载fx.tar.xz,获得它的地址。然后到/root/myserver/server下,使用命令wget “刚才的地址”下载。
  • 解压缩该文件(tar xf fx.tar.xz),你需要系统有xz,在ubuntu上是xz-utils。
  • 创建数据目录(如 mkdir /root/myserver/server-data
  • 用git克隆github的数据到数据目录。(如git clone https://github.com/citizenfx/cfx-server-data.git /root/myserver/server-data
  • 在数据目录里创建文件server.cfg(touch server.cfg),到[https://keymaster.fivem.net/]申请一个key,填写到key项。切记先做这步,否则直接测试执行会出现段错误。
  • 在数据目录server-data里(切记)执行命令bash /root/myserver/server/run.sh +exec server.cfg,然后你在客户端里应该就可以搜索到你的服务器,如果不行,请重启一下服务器(我是说linux)再重试。

强烈建议

建议在screen命令状态下运行,然后你可以在ssh上直接关闭窗口,让它在后台运行。

范例

server.cfg范例如下


# only change these if you're using a server with multiple network interfaces
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

start mapmanager
start chat
start spawnmanager
start sessionmanager
start fivem
start hardcap
start rconlog
start scoreboard
start playernames

# allow client mods such as Lamda Menu?
sv_scriptHookAllowed 1

# change this
#rcon_password yay

# a comma-separated list of tags for your server
# for example: sets tags "drifting, cars, racing" or sets tags "roleplay, military, tanks"
sets tags "default"

sv_hostname "My new FXServer!"

# nested configs!
#exec server_internal.cfg

# loading a server icon (96x96 PNG file)
#load_server_icon myLogo.png

# convars for use from script
set temp_convar "hey world!"

# Uncomment to DISABLE your server coming up in the server list
#sv_master1 ""

# want to only allow players authenticated with a third-party provider like Steam (don't forget, Social Club is a third party provider too!)?
#sv_authMaxVariance 1
#sv_authMinTrust 5

# add system admins
add_ace group.admin command allow # allow all commands
add_ace group.admin command.quit deny # but don't allow quit
add_principal identifier.steam:110000112345678 group.admin # add the admin to the group

# remove the # to hide player endpoints in external log output
#sv_endpointprivacy true

# server slots limit (must be between 1 and 32)
sv_maxclients 32

# 服务器许可证(可从https://keymaster.fivem.net获取)
sv_licenseKey xdddddddddddd
⚠️ **GitHub.com Fallback** ⚠️