Hosting MeseCraft

This walk-through covers the process of building and configuring a dedicated MeseCraft server on Minetest. It also has some tips on how to update and maintain your server. The guide is primarily written for Debian & Ubuntu Linux.

SECTION 1: Installing the server software

STEP 1: Install the required software dependencies.

Debian/Ubuntu:

sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev

Fedora:

sudo apt install g++ make libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libzstd-dev libluajit-5.1-dev gettext

Arch:

sudo pacman -S base-devel libcurl-gnutls cmake libxi libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses zstd gettext

Alpine:

sudo apk add build-base cmake libpng-dev jpeg-dev libxi-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev zstd-dev gettext

STEP 2: Install Git.

Debian/Ubuntu:

sudo apt install git

Fedora:

sudo dnf install git

Arch:

sudo pacman -S git

Alpine:

sudo apk add git

STEP 3: Use Git to download the Minetest source code and it’s dependencies.

I recommend locating the server files in /opt/mesecraft-server/  so, let’s create that directory and go there.
sudo mkdir /opt/mesecraft-server && cd /opt/mesecraft-server/

Now, use Git to download the stable branch of Minetest:
sudo git clone -b stable-5 --depth 1 https://github.com/minetest/minetest.git

Next, change directories into the minetest/ sub-folder we just downloaded:
cd minetest

Then, use Git to download irrlicht-mt, which is a Minetest dependency:

sudo git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt

Now, make a directory for the server logs:

sudo mkdir logs

STEP 4: Use git to download MeseCraft game files.

Next, we are going to download the game files for MeseCraft and place them within the games/ directory in the minetest folder:
sudo git clone --depth 1 https://github.com/MeseCraft/MeseCraft.git games/MeseCraft

STEP 5: Build a version of Minetest that runs from the source directory.

Now, we need to configure the Minetest source code build:
sudo cmake . -DRUN_IN_PLACE=TRUE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE

You can read more about these parameters on Minetest’s Github page:

STEP 6:

Compile the code and make our Minetest server binary file:
sudo make install

SECTION 2: Configure the software

We’ll need to configure a few things on the system for Minetest to run properly.

STEP 1: Create the server configuration file.

Copy the example configuration and use it as a template to configure our server configuration file:
sudo cp minetest.conf.example minetest.conf

STEP 2: Edit the configuration file

Use a text editor (e.g. nano) to edit the configuration file:
sudo nano minetest.conf

You should read the comments in the configuration file and modify them to setup your server. Un-comment lines to enable your custom values. The default values are shown.

Here are some lines of interest:
name = (your-admin-name);
server_name =
server_description =
server_address =
server_announce = true
motd =
max_users =
static_spawnpoint = 0,0,0
port = 30000
default-privs = interact, shout (Add creative if you want creative mode)
default_game = MeseCraft
creative_mode = false

map-dir = /opt/mesecraft-sever/minetset/worlds/my-world (set this to the path to your world)

STEP 3: Create a system service for your server so you can run it as a service daemon and automate startup on reboots.

First, create a service unit file:
sudo nano /etc/systemd/system/mesecraft-server.service

Then, add your content to the file. (COPY & PASTE THE TEXT BELOW):

[Unit]
Description=MeseCraft Server
Documentation=man:minetestserver(6)
After=network.target
RequiresMountsFor=/opt/mesecraft-server/minetest/worlds
[Service]
Restart=on-failure
User=root
Group=root
ExecStart=/opt/mesecraft-server/minetest/bin/minetestserver --config /opt/mesecraft-server/minetest/minetest.conf --logfile /opt/mesecraft-server/minetest/logs/minetest.log
StandardOutput=null
[Install]
WantedBy=multi-user.target

Then save the file with (CTRL+S). Then exit (CTRL+X).

Now, Reload the systemd manager:
sudo systemctl daemon-reload

Now, enable the system unit that we created for running Minetest/MeseCraft:
sudo systemctl enable mesecraft-server

Now, MeseCraft server can be controlled with simple service commands and will automatically start at system boot! 🙂

You can start the server with this command:
sudo systemctl start mesecraft-server

You can check the status of the server with this command:
sudo systemctl status mesecraft-server

Section 3: Maintaining your Server

Minetest and MeseCraft have active development. You’ll want to update the game and engine periodically to receive updates to the software. Here are the processes you’ll need to follow to accomplish this.

Updating MeseCraft (game)

First, stop your server service:
sudo service mesecraft-server stop

Make sure you are in the MeseCraft game directory.
cd /opt/mesecraft-server/minetest/games/MeseCraft/

Then, update the game files from the git repository:
sudo git pull

Finally, start the server again.
sudo service mesecraft-server start

Updating Minetest (engine)

Stop the Minetest/MeseCraft server.
sudo service mesecraft-server stop

Change directories to the server root.
cd /opt/mesecraft-server/minetest/

Then, use Git to update Minetest:
sudo git pull

Next, we need to update Irrlict-MT. Change directories:
cd /opt/mesecraft-server/minetest/lib/irrlichtmt/

Then, use Git to update irrlicht-mt:
sudo git pull

Return to the minetest directory:
cd /opt/mesecraft-server/minetest/

sudo cmake . -DRUN_IN_PLACE=TRUE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=FALSE

sudo make install

Section 4: Additional Reading

Now that you’ve setup your own MeseCraft server, you can share it with the world! Let us know that you have a new server in the MeseCraft forum!

Here are some additional reading resources for more information about operating your server.

  • https://github.com/minetest/minetest
  • https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files