Difference between revisions of "Setting up a server"

From Luanti Wiki
Jump to navigation Jump to search
(→‎Protecting your server: Example: the mesecons chatcommand block bug used together with the terminal mod)
(Page is moving!)
Tag: Replaced
 
(22 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Languages}}
+
[https://dev.luanti.org/Setting_up_a_server/ This page has been moved to the new Luanti Developer Wiki!]
 
 
== Choosing Hardware ==
 
 
 
It's recommended that you use a VPS or dedicated server to host a game server which you want to make publicly available.
 
Residential Internet connections tend to be unreliable and also have less upload speed. You may also not be able to keep
 
a server online 24/7 when hosting from home.
 
 
 
That being said, hosting from home will work fine if you have some hardware you can keep online, and you have a good
 
enough Internet connection.
 
 
 
There are two ways to run a Minetest server:
 
 
 
* Through the client - this is good for local / LAN games. Your admin player will be required to be online at all times, as the server is also hosted by the Minetest client
 
* Dedicated server - you definitely want this for a public server. Your admin player is just another player, and may join and leave at will like any other player.
 
 
 
== Running the Server ==
 
 
 
=== Through the Client ===
 
 
 
If you want to host a server to play on with friends, then the simplest way
 
to start it is to use the Minetest client. Note that you are hosting the server
 
on your computer, and the server will shutdown if you leave the game.
 
 
 
* Go to the server tab
 
* Make sure a world is selected
 
* Enter your username and password
 
* Click start
 
 
 
=== Dedicated Server ===
 
 
 
==== Linux ====
 
 
 
#Open a terminal.
 
#Type in <code>YOUR/MINETEST/DIRECTORY/bin/minetestserver</code> or just drop the minetestserver executable (located in <code>/Minetest/bin/</code>) into the terminal '''(PLEASE READ THE NOTES BELOW!)'''
 
#*If you want to specify a specific game ID, the game ID choices are located in <code>/Minetest/games/</code>. Add in <code>--gameid '''thegameid'''</code> to the end of the command.
 
#*If you get the error “Multiple worlds are available.”, the world choices are located in <code>/Minetest/worlds/</code>. Add in <code>--worldname '''theWorld'''</code> to the end of the command.
 
#If your server crashes, then look at the <code>debug.txt</code> in <code>/Minetest/bin/</code>
 
#Make sure you make your server [[#Protecting your server|safe from damage]].
 
 
 
For easy use you can create an file named minetestserver.sh, add the lines below and put it in your /Minetest/bin/ folder. To run the server, just run the file in a terminal.
 
#!/bin/bash -x
 
 
./minetestserver --gameid minetest --worldname world
 
 
 
==== Windows ====
 
 
 
#Open command prompt by going in the Minetest installation folder, then in the “bin” folder, hold Shift, do a right click on a empty file (not on minetest.exe), click “Open command window here”.
 
#Type this: <code>minetest.exe --server</code>.
 
#*If you get the error “Multiple worlds are available.”, use <code>minetest.exe --server --worldname '''world_name'''</code> instead, where <code>'''world_name'''</code> is the name of the world.
 
#If your server crashes, then look at the <code>debug.txt</code> in <code>/Minetest/bin/</code>
 
#Make sure you make your server [[#Protecting your server|safe from damage]].
 
 
 
If you don't like to start the crashed server, simply start the server out of a batch file which contains the following code:
 
 
 
@echo off
 
:crash
 
minetest.exe --server --worldname ''world_name''
 
goto crash
 
 
 
== Allowing external players to connect ==
 
 
 
Players outside of your network won't be able to join the server unless you port forward.
 
 
 
#Choose a port to run the server on. The default of 30000 is recommended
 
#Find out your internal IP of the computer you are running the server on
 
#*'''Linux''': open a terminal and type <code>ifconfig</code> and hit enter. Look for "inet adr" near "wlan0" or "eth0".
 
#*'''Windows'''
 
#** Open command prompt: Start → Run …, enter <code>cmd.exe</code> and hit enter.
 
#** Type <code>ipconfig</code> and hit enter.
 
#** Look for <code>IPv4 Address</code>.
 
#*'''macOS''': Open the command prompt and enter netstat -nr.
 
#Login to your router, and port forward UDP on your chosen port to the internal IP you found
 
#Alter any firewalls you may have to allow traffic to the port you choose
 
#Make your server listed in the server list by setting the following settings in minetest.conf
 
#* <code>server_announce = true</code> - makes Minetest tell the server list about the server.
 
#* <code>server_name</code> - set the value of this to your server's name.
 
#* <code>server_description</code> - set the value of this to a longer description describing your server.
 
#* <code>server_address</code> - if you have a domain name for your server, then set this to the domain name ([[How to get a domain name for your server|how to get a domain name if you want one for your server]]).
 
#* <code>server_url</code> - if you have a website for your server, then set this to the website URL.
 
#* <code>motd</code> - a message that is sent to the player when they join. Use this to welcome them.
 
#* You should restart the server to make sure any changed settings changed
 
 
 
== Protecting your server ==
 
 
 
When setting up a new server, you should consider which protections are needed. This is extremely important for public servers, because you cannot predict who will connect or what they will do on your server.
 
 
 
Common problems include:
 
* Accidental or intentional damage to other players' work (griefing).
 
* Chat spam (may include swearing or advertisements).
 
* Aggression, harassment or other unwanted behaviours between players.
 
* Trouble makers who evade bans.
 
* Impersonation of well known people within the MT community.
 
* Bugs, for example caused by mods, which allow a malicious player to execute arbitrary system commands.
 
 
 
 
 
Many of these problems can be removed or minimised by advanced planning and awareness:
 
* Install a protection mod, such as [https://forum.minetest.net/viewtopic.php?t=7239 areas] or [https://forum.minetest.net/viewtopic.php?f=11&t=9376 protectors]. These allow players to protect areas. Protected areas cannot be changed by other players.
 
* Enable rollback by adding <code>enable_rollback = true</code> to [[minetest.conf]]. Rollback can tell you which player placed a node, and allows a player's actions to be reverted.
 
* Install a mod to help you manage bans, such as [https://forum.minetest.net/viewtopic.php?t=9315 xban2].
 
* Create rules for your server and make sure you have enough time (or a team of moderators) to supervise your server and watch for players who breaks your rules.
 
* Never grant privileges to a player just because they use a name you recognise. Player names are not reserved between servers, so you should always confirm who the player is.
 
* On Linux you can add a dedicated user for running the minetest server.
 
 
 
 
 
Note that tnt and fire spreading, which are both enabled by default in singleplayer, are disabled by default on servers.
 
 
 
== Managing your server ==
 
 
 
=== Server Configuration ===
 
 
 
For a detailed explanation of the server configuration file, see the [https://github.com/minetest/minetest/blob/master/minetest.conf.example minetest.conf] page.
 
 
 
You may also want to consider to use a different [[Database backends|database backend]] for your world.
 
 
 
=== Server Commands ===
 
 
 
See the [[Server commands]] page for a list of useful commands.
 
 
 
Also see [[Itemstrings]] for the itemstrings for use with the <code>/give</code> and <code>/giveme</code> commands.
 
 
 
=== Privilege System ===
 
 
 
See the [[privileges]] page for detailed information on the privilege system.
 
 
 
== See also ==
 
* [[Help:Setting up a server/Debian|Setting up a Debian server]] page for more Debian (Ubuntu) related information.
 
* For more possible commands study the [[Command line]] page.
 
* The "[https://forum.minetest.net/viewtopic.php?f=10&t=2870 Illustrated Server Creation Guide]" forum thread contains interesting discussion.
 
* See this forum thread for more information about "[https://forum.minetest.net/viewtopic.php?f=10&t=8924 How to create and maintain a server - Windows]"
 
* See this forum thread for "[https://forum.minetest.net/viewtopic.php?f=10&t=1825 Server performance settings]"
 
 
 
[[Category:Tutorials]]
 
[[Category:Server]]
 

Latest revision as of 22:44, 14 December 2024