Luanti

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

Luanti (formerly Minetest, see bug #943292) is a voxel game engine. Luanti should not be confused with Minetest Game, which uses this engine.

Installation

USE flags

USE flags for games-engines/minetest A free open-source voxel game engine with easy modding and game creation

+client Build Minetest client
+curl Add support for client-side URL transfer library
+server Build Minetest server
+sound Enable sound support
+test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
leveldb Enable LevelDB backend
ncurses Add ncurses support (console display library)
nls Add Native Language Support (using gettext - GNU locale utilities)
postgres Add support for the postgresql database
prometheus Enable prometheus client support
redis Enable redis backend via dev-libs/hiredis
spatial Enable SpatialIndex AreaStore backend

Emerge

root #emerge --ask games-engines/minetest
Important
As of 2025-01-24 the package (v5.9.1) incorrectly defines build dependencies, as a workaround install the missing dependency manually:
root #emerge --ask --oneshot x11-apps/xinput
Wayland users must also install Xwayland or Luanti will not start.

Flatpak

Luanti can also be installed via Flatpak. To install the official package, run:

user $flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
user $flatpak install --user flathub net.minetest.Minetest

To run Luanti use the following command:

user $flatpak run --user net.minetest.Minetest
Important
Wayland users must also install Xwayland or Luanti will not start.

Configuration

Server

Server-side game installation

All games should be manually downloaded and installed in the /var/lib/minetest/.minetest/games/ directory. Games can be downloaded from the official website. The games are distributed as zip archives that need to be extracted. As an example, to install the Minetest Game, the following steps should be performed:

root #cd /var/lib/minetest/.minetest/games
root #unzip minetest_game.zip
Note
The game release used in this example may be outdated, retrieve a new link via the mentioned above website.

In order to launch the game, provide its name to the minetestserver(6) using the --gameid command line argument (--gameid minetest_game for the above example).

The worlds will be located in the /var/lib/minetest/.minetest/worlds/ directory.

Server-side mod installation

As games, mods need to be downloaded manually and installed in the /var/lib/minetest/.minetest/mods/ directory. Mods can be downloaded from the official website. However, it is important to check the compatibility of the mod with the installed game, as well as to install all its dependencies. As an example, to install the Mobs Monster mod, the Mobs Redo API mod must also be installed, otherwise Luanti will crash with no error messages. After the mods were installed, the world.mt file needs to be modified to load the mods:

FILE /var/lib/minetest/.minetest/worlds/world/world.mt
load_mod_mobs = true
load_mod_mobs_monster = true

Server configuration

The configuration is done in the /etc/minetest/minetest.conf file, which must be created manually. An example script can be found here (check the ## Server section).

The minimal configuration file requires only one field to be specified (replace 7777:777:7777:7777::1 with the IP address):

FILE /etc/minetest/minetest.conf
bind_address = 7777:777:7777:7777::1
Note
Luanti supports IPv6 addresses.

Luanti uses port 30000 by default, which is recommended [1].

Luanti only uses UDP protocol, all other traffic can be safely dropped by a firewall.

OpenRC

Note
This section assumes that the /etc/minetest/minetest.conf file is created as described above.

The Luanti package comes with a OpenRC service script, which is designed to simplify server startup.

  • /etc/init.d/minetest-server - Run script for OpenRC.
  • /etc/conf.d/minetest-server - Configuration run script for OpenRC.
Important
*/etc/conf.d/minetest-server must be modified to read the /etc/minetest/minetest.conf file (add --config /etc/minetest/minetest.conf to the ARGS)
  • /etc/conf.d/minetest-server must be modified to launch the desired game (add --gameid GAME_ID_GOES_HERE to the ARGS)

To start the server, run the command:

root #rc-service minetest-server start

To start the server at system boot, run:

root #rc-update add minetest-server default

systemd

Note
This section assumes that the /etc/minetest/minetest.conf file is created as described above.

To start the server, issue the following:

root #systemctl start minetest-server

If the server should automatically start when the system reboots, run:

root #systemctl enable minetest-server

SELinux

As of 2025-01-24, there are no official SELinux policies for Luanti.

OpenRC service policy

The following policy covers only the server side of Luanti and assumes that the server will run via the OpenRC service.

FILE luanti-server.te
# License: 0BSD

policy_module(luanti-server, 1.0)

gen_require(`
  attribute file_type, non_security_file_type, non_auth_file_type;
  type nsfs_t;
  type initrc_t;
  type var_lib_t;
  type var_log_t;
  type cert_t;
  type usr_t;
  type etc_t;
  type urandom_device_t;
  type unreserved_port_t;
  type node_t;
  role system_r;
  class file getattr;
  class process setcap;
')

# Allow to drop the root privileges
allow initrc_t self:process setcap;

##
# Type declarations.
#
  type luanti_server_t;
  type luanti_server_exec_t;

  domain_type(luanti_server_t)
  domain_entry_file(luanti_server_t, luanti_server_exec_t)

  type luanti_server_data_t;
  typeattribute luanti_server_data_t file_type, non_security_file_type, non_auth_file_type;

  type luanti_server_game_data_t;
  typeattribute luanti_server_game_data_t file_type, non_security_file_type, non_auth_file_type;

  type luanti_server_mod_data_t;
  typeattribute luanti_server_mod_data_t file_type, non_security_file_type, non_auth_file_type;

  type luanti_server_world_data_t;
  typeattribute luanti_server_world_data_t file_type, non_security_file_type, non_auth_file_type;

  type luanti_server_log_t;
  typeattribute luanti_server_log_t file_type, non_security_file_type, non_auth_file_type;

##
# Domain transition.
#
  domtrans_pattern(initrc_t, luanti_server_exec_t, luanti_server_t)
  role system_r types luanti_server_t;

##
# Requirements.
#
  # Access to /var/log/minetest
  allow luanti_server_t var_log_t:dir { search };
  allow luanti_server_t luanti_server_log_t:dir { search };
  allow luanti_server_t luanti_server_log_t:file { open append read ioctl };

  # Access to /var/lib/minetest
  allow luanti_server_t var_lib_t:dir { getattr search };
  allow luanti_server_t luanti_server_data_t:dir { getattr search };
  allow luanti_server_t luanti_server_data_t:file { getattr write };

  # Access to /var/lib/minetest/.minetest/games
  allow luanti_server_t luanti_server_game_data_t:dir { open getattr search read };
  allow luanti_server_t luanti_server_game_data_t:file { open getattr read };

  # Access to /va/lib/minetest/.minetest/mods
  allow luanti_server_t luanti_server_mod_data_t:dir { open read search getattr };
  allow luanti_server_t luanti_server_mod_data_t:file { open getattr read };

  # Access to /var/lib/minetest/.minetest/worlds
  allow luanti_server_t luanti_server_world_data_t:dir { open create getattr read write search remove_name add_name };
  allow luanti_server_t luanti_server_world_data_t:file { open getattr read write lock ioctl rename unlink create };

  # Access to /usr/share/minetest
  allow luanti_server_t usr_t:dir read;
  allow luanti_server_t usr_t:file { open read };

  # Access to /etc/minetest
  allow luanti_server_t etc_t:file { open read };

  # Signals
  allow luanti_server_t self:process signal;

  # SSL
  allow luanti_server_t cert_t:dir search;
  allow luanti_server_t cert_t:file { open read };

  # Sockets
  allow luanti_server_t self:udp_socket { create bind connect setopt read write };
  allow luanti_server_t unreserved_port_t:udp_socket name_bind;
  allow luanti_server_t node_t:udp_socket node_bind;

  # urandom
  allow luanti_server_t urandom_device_t:chr_file { open read };
FILE luanti-server.fc
/usr/bin/minetestserver  gen_context(system_u:object_r:luanti_server_exec_t)
/var/log/minetest(/.*)? gen_context(system_u:object_r:luanti_server_log_t)
/var/lib/minetest(/.*)? gen_context(system_u:object_r:luanti_server_data_t)
/var/lib/minetest/.minetest/games(/.*)? gen_context(system_u:object_r:luanti_server_game_data_t)
/var/lib/minetest/.minetest/mods(/.*)? gen_context(system_u:object_r:luanti_server_mod_data_t)
/var/lib/minetest/.minetest/worlds(/.*)? gen_context(system_u:object_r:luanti_server_world_data_t)

Installation of OpenRC service policy

.te and .fc files defined above should be in the same directory.

root #make -f /usr/share/selinux/strict/include/Makefile
root #semodule --install luanti-server
root #restorecon /usr/bin/minetestserver
root #restorecon -R /var/lib/minetest
root #restorecon -R /var/log/minetest

Removal of OpenRC service policy

root #semodule --remove luanti-server
root #restorecon /usr/bin/minetestserver
root #restorecon -R /var/lib/minetest
root #restorecon -R /var/log/minetest

Troubleshooting

The server is not running

If the server is not running, the server status should be checked.

OpenRC:

root #rc-service minetest-server status

systemd:

root #systemctl status minetest-server

Removal

Unmerge

root #emerge --ask --depclean --verbose games-engines/minetest

See also

  • Games — a landing page for many of the games (especially open source variants) available in Gentoo's main ebuild repository.

References