搭建Terraria服务器

下载服务端

从最新的版本号尝试,当前最新的版本号为1.4.1.2

wget https://terraria.org/system/dedicated_servers/archives/000/000/042/original/terraria-server-1412.zip

在这里插入图片描述

unzip解压
mkdir -p /opt/terraria-server/bin unzip && unzip terraria-server-1412.zip -d /opt/terraria-server/
修改配置

默认配置文件存放在/opt/terraria-server/bin/1412/Windows/serverconfig.txt

cp /opt/terraria-server/bin/1412/Windows/serverconfig.txt /opt/terraria-server/

修改配置项
world、autocreate、worldname、difficulty、maxplayers、port、password、worldpath、language

注意autocreate的使用,如果机器性能差可能autocreate=3(创建大世界)会失败

#this is an example config file for TerrariaServer.exe
#use the command 'TerrariaServer.exe -config serverconfig.txt' to use this configuration or run start-server.bat
#please report crashes by emailing crashlog.txt to support@terraria.org

#the following is a list of available command line parameters:

#-config <config file>				            Specifies the configuration file to use.
#-port <port number>				              Specifies the port to listen on.
#-players <number> / -maxplayers <number>	Sets the max number of players
#-pass <password> / -password <password>		Sets the server password
#-world <world file>					Load a world and automatically start the server.
#-autocreate <#>					Creates a world if none is found in the path specified by -world. World size is specified by: 1(small), 2(medium), and 3(large).
#-banlist <path>					Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory.
#-worldname <world name>             			Sets the name of the world when using -autocreate.
#-secure						Adds addition cheat protection to the server.
#-noupnp						Disables automatic port forwarding
#-steam							Enables Steam Support
#-lobby <friends> or <private>				Allows friends to join the server or sets it to private if Steam is enabled
#-ip <ip address>					Sets the IP address for the server to listen on
#-forcepriority <priority>				Sets the process priority for this task. If this is used the "priority" setting below will be ignored.
#-disableannouncementbox				Disables the text announcements Announcement Box makes when pulsed from wire.
#-announcementboxrange <number>				Sets the announcement box text messaging range in pixels, -1 for serverwide announcements.
#-seed <seed>						Specifies the world seed when using -autocreate

#remove the # in front of commands to enable them.

#Load a world and automatically start the server.
world=/opt/terraria-server.1412/Worlds/test_20210228.wld

#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
autocreate=3

#Sets the world seed when using autocreate
#seed=AwesomeSeed

#Sets the name of the world when using autocreate
worldname=Terraria

#Sets the difficulty of the world when using autocreate 0(classic), 1(expert), 2(master), 3(journey)
difficulty=0

#Sets the max number of players allowed on a server.  Value must be between 1 and 255
maxplayers=255

#Set the port number
port=7777

#Set the server password
password=12345678

#Set the message of the day
#motd=Please dont cut the purple trees!

#Sets the folder where world files will be stored
worldpath=/opt/terraria-server.1412/Worlds

#Sets the number of rolling world backups to keep
#worldrollbackstokeep=2

#The location of the banlist. Defaults to "banlist.txt" in the working directory.
#banlist=banlist.txt

#Adds addition cheat protection.
#secure=1

#Sets the server language from its language code. 
#English = en-US, German = de-DE, Italian = it-IT, French = fr-FR, Spanish = es-ES, Russian = ru-RU, Chinese = zh-Hans, Portuguese = pt-BR, Polish = pl-PL,
language=zh-Hans

#Automatically forward ports with uPNP
#upnp=1

#Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.
#npcstream=60

#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
priority=1

#Reduces maximum liquids moving at the same time. If enabled may reduce lags but liquids may take longer to settle.
#slowliquids=1

#Journey mode power permissions for every individual power. 0: Locked for everyone, 1: Can only be changed by host, 2: Can be changed by everyone
#journeypermission_time_setfrozen=2
#journeypermission_time_setdawn=2
#journeypermission_time_setnoon=2
#journeypermission_time_setdusk=2
#journeypermission_time_setmidnight=2
#journeypermission_godmode=2
#journeypermission_wind_setstrength=2
#journeypermission_rain_setstrength=2
#journeypermission_time_setspeed=2
#journeypermission_rain_setfrozen=2
#journeypermission_wind_setfrozen=2
#journeypermission_increaseplacementrange=2
#journeypermission_setdifficulty=2
#journeypermission_biomespread_setfrozen=2
#journeypermission_setspawnrate=2
启动服务
cd /opt/terraria-server/bin/1412/Linux/
chmod +x TerrariaServer.bin.x86_64
./TerrariaServer.bin.x86_64 -config /opt/terraria-server/serverconfig.txt

创建大世界的时候,可以看到此时服务器的负载是很高的
在这里插入图片描述

注释配置文件下面几项,避免下次启动该world时重新创建

# autocreate=3
# worldname=Terraria
# difficulty=0
创建新的screen会话后台运行服务器
 screen -S terrariaServer
 ./TerrariaServer.bin.x86_64 -config /opt/terraria/serverconfig

Ctrl+A+D退出当前会话
screen -R terrariaServer重新连接会话

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值