Voraussetzung
- Grundkentnisse im Umgang mit Archlinux und Bash
- ein installiertes Archlinux-Minimalsystem (base und base-devel)
Installation
als root:
pacman -S git go jq luanti-server npm postgresql postgresql-old-upgrade screen
Installation von rollup
als user:
mkdir build
cd build
git clone https://aur.archlinux.org/rollup.git
cd rollup makepkg
als root:
pacman -U /home/deinLinuxUserName/build/rollup/rollup-*.pkg.tar.zst
PostgreSQL konfigurieren
als root:
su -l postgres
initdb -D /var/lib/postgres/data
exit
sed -i 's/shared_buffers = 128MB/shared_buffers = 512MB/' /var/lib/postgres/data/postgresql.conf
systemctl --now enable postgresql
su -l postgres
psql
CREATE USER luantiuser WITH PASSWORD 'geheim';
CREATE DATABASE luantidb OWNER luantiuser;
GRANT ALL PRIVILEGES ON DATABASE luantidb TO luantiuser;
\q
exit
Mapserver bauen
als user:
cd ~/build
git clone https://github.com/minetest-mapserver/mapserver
cd ~/build/mapserver/public/
rollup -c rollup.config.js
cd ~/build/mapserver/
go build
Mapserver starten damit mapserver.json erzeugt wird, dann kopieren:
./mapserver --createconfig
mkdir --parents ~/.minetest/worlds/world/ && cp mapserver mapserver.json "$_"
Luantiserver Konfiguration
das Minetest-Game installieren:
mkdir --parents ~/.minetest/games/minetest_game/
git clone https://github.com/minetest/minetest_game ~/.minetest/games/minetest_game/
die Mapserver-Mod installieren:
mkdir --parents ~/.minetest/mods/mapserver_mod/
git clone https://github.com/minetest-mapserver/mapserver_mod ~/.minetest/mods/mapserver_mod/
Startskript für Mapserver:
cat > ~/start_mapserver.sh << "EOF"
#!/bin/bash
cd ~/.minetest/worlds/world/
screen ./mapserver
EOF
chmod 700 ~/start_mapserver.sh
die world.mt anlegen:
cat > ~/.minetest/worlds/world/world.mt << "EOF"
gameid = minetest
world_name = world
enable_damage = true
creative_mode = false
backend = postgresql
auth_backend= postgresql
player_backend = postgresql
mod_storage_backend = postgresql
pgsql_connection = host=localhost port=5432 user=luantiuser password=geheim dbname=luantidb
pgsql_auth_connection = host=localhost port=5432 user=luantiuser password=geheim dbname=luantidb
pgsql_player_connection = host=localhost port=5432 user=luantiuser password=geheim dbname=luantidb
pgsql_mapserver_connection = host=localhost port=5432 user=luantiuser password=geheim dbname=luantidb
pgsql_mod_storage_connection = host=localhost port=5432 user=luantiuser password=geheim dbname=luantidb
load_mod_mapserver = true
EOF
eine minimalistische luanti.conf anlegen:
cat > ~/.minetest/luanti.conf << "EOF"
server_address = example.example
disallow_empty_password = true
secure.http_mods = mapserver
name = AdminName
debug_log_level = warning
mapserver.enable_crafting = true
mapserver.key =
mapserver.send_interval = 2
mapserver.url = localhost:8080
EOF
den SecretKey von der mapserver.json in die luanti.conf schreiben:
(Das Sed-Kommando mit doppelte Anführungszeichen!)
dummy=$(jq --raw-output '.webapi.secretkey' ~/.minetest/worlds/world/mapserver.json)
sed -i "s/mapserver.key =/mapserver.key = $dummy/" ~/.minetest/luanti.conf
eine Service-Unit für Luantiserver anlegen (als root):
cat > /usr/lib/systemd/system/luanti.service << "EOF"
[Unit]
Description=Luanti Server
After=syslog.target network.target
[Service]
Type=simple
User=deinLinuxUserName
Group=users
WorkingDirectory=/home/deinLinuxUserName/.minetest/
ExecStart=/usr/bin/luantiserver --config /home/deinLinuxUserName/.minetest/luanti.conf --logfile /home/deinLinuxUserName/.minetest/debug.txt --world /home/deinLinuxUserName/.mintest/worlds/world/
RestartSec=480
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
Starten
Den Luanti-Server als erstes starten (als root):
systemctl start luanti
danach Mapserver starten (als user):
./start_mapserver.sh
upgrade PostgreSQL
pacman -Syu
systemctl stop postgresql.service
mv /var/lib/postgres/data /var/lib/postgres/olddata
mkdir /var/lib/postgres/data /var/lib/postgres/tmp
chown postgres:postgres /var/lib/postgres/data /var/lib/postgres/tmp
cd /var/lib/postgres/tmp
initdb -D /var/lib/postgres/data --locale=C.UTF-8 --encoding=UTF8 --data-checksums
pg_upgrade -b /opt/pgsql-PG_VERSION/bin -B /usr/bin -d /var/lib/postgres/olddata -D /var/lib/postgres/data
systemctl start postgresql.service
vacuumdb --all --analyze-in-stages
rm /var/lib/postgres/olddata
rm /var/lib/postgres/tmp