Difference between revisions of "Setting up a server/Debian"

From Luanti Wiki
Jump to navigation Jump to search
(added some links, categories and an example file tree - needs work :-))
(Various fixes.)
Line 1: Line 1:
These instructions have been tested in Debian Jessie ("Testing" as of May 2014) which includes a <code>minetest-server</code> package.
+
These instructions have been tested in Debian Jessie (“Testing” as of May 2014) which includes a <code>minetest-server</code> package.
  
A simple minetest [[server]] can be started in any Debian (or derivative distribution) that has the <code>minetest</code> package by going to its "server" tab, however such a game only remains available for the duration of the hosts desktop session.
+
A simple Minetest [[server]] can be started in any Debian (or derivative distribution) that has the <code>minetest</code> package by going to its “Server” tab, however such a game only remains available for the duration of the host's playing session.
  
 
This guide is aimed at providing a more permanent, minimal server environment setup without a graphical desktop environment.
 
This guide is aimed at providing a more permanent, minimal server environment setup without a graphical desktop environment.
  
 
== Installation and initial preparation ==
 
== Installation and initial preparation ==
 +
 
Install the <code>minetest-server</code> package:
 
Install the <code>minetest-server</code> package:
 
<pre># apt-get install minetest-server</pre>
 
<pre># apt-get install minetest-server</pre>
Line 37: Line 38:
  
 
== Manually stopping the server ==
 
== Manually stopping the server ==
To stop the server, press Ctrl-C.  
+
 
 +
To stop the server, press <kbd>Ctrl + C</kbd>.  
  
 
The last few lines of terminal output should be similar to this:
 
The last few lines of terminal output should be similar to this:
Line 52: Line 54:
 
03:34:52: INFO[main]: RollbackManager::flush()
 
03:34:52: INFO[main]: RollbackManager::flush()
 
03:34:52: INFO[main]: BanManager: saving to /home/minetest/.minetest/worlds/world/ipban.txt
 
03:34:52: INFO[main]: BanManager: saving to /home/minetest/.minetest/worlds/world/ipban.txt
03:34:52: INFO[main]: Server: Deinitializing scripting
+
03:34:52: INFO[main]: Server: Deinitializing scripting</pre>
minetest@vm-minetest:~$ </pre>
 
  
 
== Setup automatic startup at boot ==
 
== Setup automatic startup at boot ==
 +
 
=== With a boot-time scheduled command ===
 
=== With a boot-time scheduled command ===
 +
 
Once you're satisfied with command line arguments and having tested the server works, you can setup automatic startup at boot:
 
Once you're satisfied with command line arguments and having tested the server works, you can setup automatic startup at boot:
 
# Login as the user previously created. This can be a non-privileged user.
 
# Login as the user previously created. This can be a non-privileged user.
Line 63: Line 66:
 
## Add your command to be executed at reboot to the very end of the file, for example: <pre>@reboot /usr/games/minetestserver --info --worldname MyWorld</pre>
 
## Add your command to be executed at reboot to the very end of the file, for example: <pre>@reboot /usr/games/minetestserver --info --worldname MyWorld</pre>
 
# Save the file (Ctrl-X if using the <code>nano</code> editor)
 
# Save the file (Ctrl-X if using the <code>nano</code> editor)
 +
 
=== With an init script ===
 
=== With an init script ===
 +
 
A better practice when running a service in Debian is to create a proper init script and configuration for it.
 
A better practice when running a service in Debian is to create a proper init script and configuration for it.
  
 
Check [https://forum.minetest.net/viewtopic.php?p=135918#p135918 this forum discussion] for details, a cleaned-up version is being worked on.
 
Check [https://forum.minetest.net/viewtopic.php?p=135918#p135918 this forum discussion] for details, a cleaned-up version is being worked on.
  
=== Further Infirmation ===
+
=== Further information ===
  
 
* For a detailed explanation of the server configuration file, see the [https://github.com/minetest/minetest/blob/master/minetest.conf.example minetest.conf] page.
 
* For a detailed explanation of the server configuration file, see the [https://github.com/minetest/minetest/blob/master/minetest.conf.example minetest.conf] page.
Line 76: Line 81:
 
* See the [[Server commands]] page for a list of useful 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.
+
* Also see [[Item strings]] for the itemstrings for use with the <code>/give</code> and <code>/giveme</code> commands.
  
* See the [[privileges]] page for detailed information on the privilege system.
+
* See the [[Privileges]] page for detailed information on the privilege system.
  
 
== A few tips ==
 
== A few tips ==
 +
 
* The <code>.minetest</code> directory contains game data (worlds, config, debug.txt)
 
* The <code>.minetest</code> directory contains game data (worlds, config, debug.txt)
 
* File structure with the folders Minetest adds after some usage as client and server, as well as the positions (...) that costum made content goes could look like this.
 
* File structure with the folders Minetest adds after some usage as client and server, as well as the positions (...) that costum made content goes could look like this.
Line 115: Line 121:
 
</pre>
 
</pre>
  
..
 
  
 
[[Category:Server]]
 
[[Category:Server]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Revision as of 18:31, 21 May 2014

These instructions have been tested in Debian Jessie (“Testing” as of May 2014) which includes a minetest-server package.

A simple Minetest server can be started in any Debian (or derivative distribution) that has the minetest package by going to its “Server” tab, however such a game only remains available for the duration of the host's playing session.

This guide is aimed at providing a more permanent, minimal server environment setup without a graphical desktop environment.

Installation and initial preparation

Install the minetest-server package:

# apt-get install minetest-server

The current Debian package does not automatically setup the Minetest server to start as a service. It can run under the root user but it may be preferrable to create a user to run it:

# adduser minetest

Before setting up automatic startup at boot, consider manually running the server to determine the best command line arguments.

Manually starting the server

The server can be started manually by invoking its command:

$ /usr/games/minetestserver --info

The last few lines of terminal output should be similar to this:

03:33:25: INFO[main]: Server: Loading environment metadata
03:33:25: INFO[main]: Server: Loading players
03:33:25: INFO[main]: Starting server on port 30000...
03:33:25: ACTION[main]:         .__               __                   __   
03:33:25: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_ 
03:33:25: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
03:33:25: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  |  
03:33:25: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__|  
03:33:25: ACTION[main]:       \/        \/     \/          \/     \/        
03:33:25: ACTION[main]: World at [/home/minetest/.minetest/worlds/world]
03:33:25: ACTION[main]: Server for gameid="minetest" listening on port 30000.
03:33:25: INFO[ServerThread]: Server creating detached inventory "creative"
03:33:28: INFO[ServerThread]: ServerMap: SQLite3 database opened

Manually stopping the server

To stop the server, press Ctrl + C.

The last few lines of terminal output should be similar to this:

^C03:34:52: INFO: sigint_handler(): Ctrl-C pressed, shutting down.
03:34:52: INFO[main]: Dedicated server quitting
03:34:52: INFO[main]: Server destructing
03:34:52: INFO[main]: Server: Saving players
03:34:52: INFO[main]: Server: Saving environment metadata
03:34:52: INFO[main]: Server: Stopping and waiting threads
03:34:52: INFO[main]: Server: Threads stopped
03:34:52: INFO[main]: ServerMap: Saved map to /home/minetest/.minetest/worlds/world
03:34:52: INFO[main]: RollbackManager::~RollbackManager()
03:34:52: INFO[main]: RollbackManager::flush()
03:34:52: INFO[main]: BanManager: saving to /home/minetest/.minetest/worlds/world/ipban.txt
03:34:52: INFO[main]: Server: Deinitializing scripting

Setup automatic startup at boot

With a boot-time scheduled command

Once you're satisfied with command line arguments and having tested the server works, you can setup automatic startup at boot:

  1. Login as the user previously created. This can be a non-privileged user.
  2. Add the minetestserver command as determined after testing with manual server startup to crontab
    1. Invoke the crontab editor:
      $ crontab -e
    2. Add your command to be executed at reboot to the very end of the file, for example:
      @reboot /usr/games/minetestserver --info --worldname MyWorld
  3. Save the file (Ctrl-X if using the nano editor)

With an init script

A better practice when running a service in Debian is to create a proper init script and configuration for it.

Check this forum discussion for details, a cleaned-up version is being worked on.

Further information

  • For a detailed explanation of the server configuration file, see the minetest.conf page.
  • You may also want to consider to use a different database backend for your world.
  • Also see Item strings for the itemstrings for use with the /give and /giveme commands.
  • See the Privileges page for detailed information on the privilege system.

A few tips

  • The .minetest directory contains game data (worlds, config, debug.txt)
  • File structure with the folders Minetest adds after some usage as client and server, as well as the positions (...) that costum made content goes could look like this.
minetest/
├── bin/
├── builtin/
├── cache/
│   ├── media/
│   └── tmp/
├── client/
│   ├── serverlist/
│   └── shaders/
│       ├── alpha_shader/
│       ├── leaves_shader/
│       ├── liquids_shader/
│       ├── plants_shader/
│       └── solids_shader/
├── doc/
├── fonts/
├── games/
│   ├── minetest_game/
│   ├── minimal/
│   └── ... (installed extra games)
├── locale/ (lots of language folders)
├── mods/
│   └── ... (installed extra mods and modpacks)
├── textures/
│   ├── base/
│   │   └── pack/
│   └── ... (installed extra texturepacks)
└── worlds/
    └── ... (saved worlds. Some with exclusive world mods)