Minecraft
Minecraft is a game about breaking and placing blocks. At first, people built structures to protect against nocturnal monsters, but as the game grew players worked together to create wonderful, imaginative things.
Client
Installation
The minecraft client can be installed via the minecraft-launcherAUR package. It provides the official game launcher, a script to launch it and a .desktop file. The package is officially recommended by Mojang on their website.
Firewall configuration for Client/LAN worlds
Most shared Minecraft worlds are hosted using dedicated Minecraft server. If this is how you want to host, see Server section below.
A simpler way is to allow others to join your current Minecraft game. When playing, your Minecraft client also allows others to join the game in progress. Your client automatically broadcasts the info about your game on port 4445. It will also listen for TCP connections on which other players join. This TCP listening port is picked at random every time you start Minecraft. This works well if you do not have a firewall. But if your firewall blocks incoming TCP connections, then it is very tricky to allow this random port in.
In conclusion, to allow your client to host a local LAN game, your firewall need to allow:
- UDP port
4445
to broadcast your game - random incoming TCP port
See [1] for more information.
Bedrock Edition Server
This version allows the hosting of Bedrock Edition Minecraft, which is currently supported on Windows 10 and Mobile, Amazon FireOS and FireTV, Android and iOS, Xbox One, Playstation 4, Nintendo Switch and Samsung Gear VR devices.
Installation
The Bedrock Minecraft server can be installed via the minecraft-bedrock-serverAUR package. It provides a systemd unit file. This package creates a separate minecraft-bedrock
account.
Starting the server
To start the server you may either use systemd or run it directly from the command line. Using systemd you may start and enable the included minecraft-bedrock-server.service
. Alternatively run the following as the minecraft-bedrock user inside the /opt/minecraft-bedrock-server
directory:
$ LD_LIBRARY_PATH=. ./bedrock_server
Server Configuration
The configuration file server.properties
contains the server settings and additional documentation. Most importantly, server-port
determines the UDP
port at which the server will listen for incoming connections. The default port is 19132
for IPv4, and 19133
for IPv6. UDP ports 43351
for IPv4 and 51885
for IPv6 are required for authentication.
Java Edition Server
Installation
The Java Edition Minecraft server can be installed via the minecraft-serverAUR package. It provides additional systemd unit files and includes a small control script.
Also see #Alternative servers for an overview of alternative programs allowing to host Minecraft.
Setup
Introduction
In the installation process the minecraft
user and group is introduced. Establishing a Minecraft-specific user is recommended for security reasons. By running Minecraft under an unprivileged user account, anyone who successfully exploits your Minecraft server will only get access to that user account, and not yours.
However you may safely add your user to the minecraft
group and add group write permission to the directory /srv/minecraft
(default) to modify Minecraft server settings. Make sure that all files in the /srv/minecraft
directory are either owned by the minecraft
user, or that the user has by other means read and write permissions. The server will error out if it is unable to access certain files and might even have insufficient rights to write an according error message to the log.
The package provides a systemd service and timer to take automatic backups. By default the backups are located in the backup
folder under the server root directory. Though to keep the disk footprint small only the 10 most recent backups are preserved (configurable via KEEP_BACKUPS
). The related systemd files are minecraftd-backup.timer
and minecraftd-backup.service
. They may easily be adapted to your liking, e.g. to follow a custom backup interval.
Starting the server
To start the server you may either use systemd or run it directly from the command line. Either way the server is encapsulated in a tmux session which is owned by the minecraft
user. Using systemd you may start/enable the included minecraftd.service
. Alternatively run
# minecraftd start
Accepting EULA
In order to run the minecraft server you must accept the EULA. This only needs to happen once after installation. The EULA file resides under /srv/minecraft/eula.txt
after being created by the package. You will need to edit this file to state that you have agreed to the contract in order to run the server. All you need to do is change:
eula=false
to the value true. Here is an example of accepted EULA in /srv/minecraft/eula.txt
:
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula). #Sat Sep 11 11:11:11 PDT 2011 eula=true
Firewall Configuration for Server Worlds
There are three settings in the server.properties
which determine ports that your server will use.
server-port
determines the TCP
port at which the server will listen for incoming connections. Default port is 25565
.
query.port
determines the UDP
port at which the server will share game info/advertising information. Default port is 25565
. Note that since server and query ports are TCP and UDP, they can share the same port. To enable query, you also have to specify enable-query=true
.
rcon.port
determines the TCP
port if you choose to allow remote access to admin console. Default port is 25575
. To enable rcon, you also have to specify enable-rcon=true
and rcon.password=...
.
You will need to allow incoming connections at least on the server-port
. It is advisable to allow query and its query.port
. On the other hand, enabling remote console access is a security risk, and you should be careful of allowing it.
Above information is for the official Minecraft server. If you are using alternate server, please see its documentation for details about its configuration.
See [2] and [3] for more information.
Server management script
To easily control the server you may use the provided minecraftd
script. It is capable of doing basic commands like start
, stop
, restart
or attaching to the session with console
. Moreover it may be used to display status information with status
, backup the server world directory with backup
, restore world data from backups with restore
or run single commands in the server console with command do-something
.
minecraftd console
), remember that you can exit any tmux session with ctrl+a
d
.Tweaking
To tweak the default settings (e.g. the maximum RAM, number of threads etc.) edit the file /etc/conf.d/minecraft
.
For example, more advanced users may wish to enable IDLE_SERVER
by setting it to true
. This will enable the management script to suspend the server if no player was online for at least IDLE_IF_TIME
(defaults to 20 minutes). When the server is suspended an idle_server
will listen on the Minecraft port using ncat(1) (also called netcat or simply nc for short; see Network tools#Netcat) and will immediately start the server at the first incoming connection. Though this obviously delays joining for the first time after suspension, it significantly decreases the CPU and memory usage leading to more reasonable resource and power consumption levels.
/srv/minecraft/eula.txt
file will not get created. You need to disable it to initially start.Alternative servers
Spigot (respectively Craftbukkit)
Spigot is the most widely-used modded Minecraft server in the world. It can be installed as spigotAUR via the AUR. The spigot PKGBUILD builds on top of the files from the minecraft-serverAUR package. This means that the spigot server provides its own systemd unit files, spigot script and corresponding script configuration file. The binary is called spigot
and is capable of fulfilling the same commands as minecraftd
. The configuration file resides under /etc/conf.d/spigot
.
Be sure to read #Setup and replace minecraftd
with spigot
wherever you encounter it.
It is somewhat affiliated with Bukkit and has grown in popularity since Bukkit's demise.
Cuberite
Cuberite is a highly efficient and extensively moddable Minecraft server, written in C++ and Lua. It achieves much better performances than the vanilla Minecraft server, but is not fully compatible with the latest Minecraft client (some game aspects might be missing or not working).
Cuberite minecraft server can be installed as a cuberiteAUR package, which provides a simple web interface by default at port 8080
with which most server operations can easily be done through the browser. The cuberite PKGBUILD builds on top of the files from the minecraft-serverAUR package. This means that the cuberite server provides its own systemd unit files, cuberite script and corresponding script configuration file. The binary is called cuberite
and is capable of fulfilling the same commands as minecraftd
. The configuration file resides under /etc/conf.d/cuberite
.
Be sure to read #Setup and replace minecraftd
with cuberite
wherever you encounter it.
PaperMC
PaperMC is a Minecraft server, compatible with Spigot plugins which aims to offer better performance. It can be installed via papermcAUR.
Be sure to read #Setup and replace minecraftd
with papermc
wherever you encounter it.
Forge
Forge is a widely used Minecraft modding API. The following server packages are available:
- forge-serverAUR for the latest Minecraft version (1.16.5)
- forge-server-1.15.2AUR for Minecraft 1.15.2
- forge-server-1.14.4AUR for Minecraft 1.14.4
- forge-server-1.12.2AUR for Minecraft 1.12.2
- forge-server-1.11.2AUR for Minecraft 1.11.2
- forge-server-1.10.2AUR for Minecraft 1.10.2
- forge-server-1.9.4AUR for Minecraft 1.9.4
- forge-server-1.8.9AUR for Minecraft 1.8.9
- forge-server-1.7.10AUR for Minecraft 1.7.10
- forge-server-1.6.4AUR for Minecraft 1.6.4
Be sure to read #Setup and replace minecraftd
with forged
(forge-x.x.xd
for legacy versions) wherever you encounter it.
Fabric
Fabric is a lightweight, experimental modding toolchain for Minecraft. The server package can be installed via fabric-serverAUR.
Be sure to read #Setup and replace minecraftd
with fabricd
wherever you encounter it.
Additional notes
- There are several server wrappers available providing everything from automatic backup to managing dozens of servers in parallel, refer to Server Wrappers for more information. However the management script provided by the AUR packages should suffice most needs.
- You might want to set up a systemd timer with e.g. mapper to generate periodic maps of your world.
- Be sure to take periodic backups e.g. using the provided management script (see #Introduction) or plain rsync.
Minecraft mod launchers
You can launch Minecraft from different so called launchers that often include an array of mod packs to enhance one's gameplay and add mods.
- Feed The Beast — Originated as a custom challenge map in Minecraft that made heavy use of multiple tech mods and evolved into a mod package launcher.
- MultiMC — Sandbox environment manager for separable pack association.
- PolyMC — Fork of MultiMC designed to be friendly to contribution & downstream packages.
- https://polymc.org/ || polymcAUR
- Technic Launcher — Modpack installer with a focus on mod discovery via popularity rankings.
- Lunar Client — PvP modpack for all modern versions of Minecraft
- Badlion Client — PvP modpack for all modern versions of Minecraft
- GDLauncher — Open-source Minecraft launcher written in electron/react
Other programs and editors
There are several programs and editors which can make your Minecraft experience a little easier to navigate. The most common of these programs are map generators. Using one of these programs will allow you to load up a Minecraft world file and render it as a 2D image, providing you with a top-down map of the world.
- AMIDST — Standing for Advanced Minecraft Interface and Data/Structure Tracking, it is a program that aids in the process of finding structures, biomes, and players in Minecraft worlds. It can draw the biomes of a world out and show where points of interest are likely to be by either giving it a seed, telling it to make a random seed, or having it read the seed from an existing world (in which case it can also show where players in that world are). The project has been forked in the past, of which the most notable one is "Amidst Exporter" (amidstexporterAUR) which includes a patch for calculating Ocean Monument locations in 1.8+ worlds.
- Mapcrafter — A high performance Minecraft map renderer written in C++ which renders worlds to maps with an 3D-isometric perspective. You can view these maps in any webbrowser hence they are easily deployed on one's server. Mapcrafter has a simple configuration file format to specify worlds to render, different rendermodes such as day/night/cave and can also render worlds from different rotations.
- Minutor — A minimalistic map generator for Minecraft. You are provided with a simple GTK based interface for viewing your world. Several rendering modes are available, as well as custom coloring modes and the ability to slice through z-levels.
Troubleshooting
Logs
Screen logs are in /tmp/spigot_spigot_command_dump.txt
file. If systemctl fails to start the service, inspect the screen logs.
Journal logs are under spigot.service
.
Client or server does not start
It might be the problem with Java version. Java version 8 is guaranteed to work well in all cases.
Both Minecraft server and the actual game work perfectly fine with the latest version of Java, such as jre-openjdk, but the Minecraft game launcher (and possibly all other mods) might only work with the Java version 8.
Broken fonts with MinecraftForge
Force Unicode fonts from the language menu.
Since you cannot read any of the menu options: in the main menu, choose the bottom-left most button is Options, second-from-the-bottom on the left side is the Language Button. From there, the Force Unicode Font button is on the bottom, on the left side.
MultiMC unable to build
If you are trying to install multimc5AUR and get an error similar to:
No CMAKE_Java_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "JAVA_COMPILER" or the CMake cache entry CMAKE_Java_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.
The error could be caused by Java missing, which can be fixed by installing jdk8-openjdk. If the error is not fixed by that or Java was properly installed in the first place, the wrong version could still be the default environment:
$ archlinux-java status
Available Java environments: java-13-openjdk (default) java-8-openjdk
You can set the default java version using archlinux-java set <version>
.
Cannot change pulseaudio sink
If you are unable to switch audio output device (indicated by DONT_MOVE
flag in the output of pacmd list-sink-inputs
) then the following openalsoft config may help
~/.alsoftrc
[pulse] allow-moves=yes