Minetest is a free and open source alternative to the popular game Minecraft. The server is extremely easy to set up and run.
apt install wget).
As Ubuntu tends to lag behind with packages for Minetest you'll be using the stable PPA instead. This can be added with the following commands.
# add-apt-repository ppa:minetestdevs/stable # apt update
Following this you can install the server.
# apt install minetest
For security reasons it is always a good idea to run services within their own user as shown.
# useradd -mU minetest
This will create your
minetest user with its own group and with a home directory for the server to run in.
Before testing you must open up port
30000 on Ubuntu's default firewall otherwise you'll be unable to connect.
# ufw allow 30000
Now would be a good time to test the server and see if it runs.
# su minetest $ minetest --server
If all went well you'll be greeted by the following output:
WARNING[Main]: BanManager: creating /home/minetest/.minetest/worlds/world/ipban.txt WARNING[Main]: NodeDefManager: Ignoring CONTENT_IGNORE redefinition WARNING[Main]: /!\ You are using old player file backend. This backend is deprecated and will be removed in next release /!\ WARNING[Main]: Switching to SQLite3 or PostgreSQL is advised, please read http://wiki.minetest.net/Database_backends. ACTION[Main]: .__ __ __ ACTION[Main]: _____ |__| ____ _____/ |_ ____ _______/ |_ ACTION[Main]: / \| |/ \_/ __ \ __\/ __ \ / ___/\ __\ ACTION[Main]: | Y Y \ | | \ ___/| | \ ___/ \___ \ | | ACTION[Main]: |__|_| /__|___| /\___ >__| \___ >____ > |__| ACTION[Main]: \/ \/ \/ \/ \/ ACTION[Main]: World at [/home/minetest/.minetest/worlds/world] ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000.
If you receive the above warning about the player backend, don't worry too much as this will be fixed in the next step.
Connect to your server with your client to see if everything works. You can stop the server at any time by pressing
Ctrl+C on your keyboard inside the shell.
First, you will want to download the example
minetest.conf configuration file.
$ cd ~/.minetest $ wget https://raw.githubusercontent.com/minetest/minetest/master/minetest.conf.example $ mv minetest.conf.example minetest.conf
This file has an extensive list of possible settings for you to modify and enable (by uncommenting lines) however for the moment there are a few important ones you need to set.
The name and description of your server (for example):
server_name = Minetest server server_description = Welcome to my Minetest Server
The IP address and desired port of your server (for example):
bind_address = 203.0.113.1 port = 30000
If you set a different port than the default
30000 make sure you update your firewall rules.
#ufw delete allow 30000 #ufw allow <port>
Another important option is
name. Whoever connects to the Minetest server with the value specified will be given administrator privileges. Set this to a username you want and set a password for your account later.
You'll probably recall the warning about the player backend earlier so switching to SQLite3 is a must as the old backend is deprecated and will be removed in a later release, if it hasn't been already. If you didn't receive this message when you tested the server in step 2 then you can go straight to step 4.
$ minetest --server --migrate-players sqlite3 --world ~/.minetest/worlds/world
Afterwards you should see something like the following message.
ACTION[Main]: Successfully migrated 1 players ACTION[Main]: world.mt updated
In order to run the server on boot a systemd service file is needed. Thankfully these are fairly straightforward to create.
Exit back into your root shell and add the following to
[Unit] Description=Minetest Server After=network.target [Service] Type=simple User=minetest Group=minetest WorkingDirectory=/home/minetest ExecStart=/usr/bin/minetest --server Restart=on-abort [Install] WantedBy=multi-user.target
From now on the Minetest server can be started with
systemctl (and will do so automatically after reboot or if the Minetest server crashes)
# systemctl enable minetest.service # systemctl start minetest.service
Likewise you can check the status or stop/restart the Minetest server by replacing "start" in the above command.
Your Minetest server should be active and usable. If you have any issues connecting, verify that your port is open and IP address is correctly specified in
minetest.conf. Information on managing player permissions and various server commands can be found on the Minetest wiki.