FreeBSD Minecraft Server

This article describes how to setup and run a Minecraft server on FreeBSD. It assumes only an existing FreeBSD installation with SSH or Physical access.

Requirements

These instructions were tested on FreeBSD 13.1-RELEASE amd64 with 2 Virtual CPU's, 2Gb memory, though it should be possible to run a Minecraft server on any platform that supports Java, either natively or via poudriere/qemu. This can enable running a Minecraft server on popular devices such as Raspberry Pi's, which are supported by FreeBSD.

Minecraft can be pretty resource hungry! Make sure to provide at least a couple of GB's of RAM and a not too low end CPU.

In the commands below, # means as the root user, $ means as a normal (unprivileged) user. You can use su or sudo or your preferred method to execute root commands.

The Minecraft dedicated server software is available from the FreeBSD Ports tree: games/minecraft-server. Pre-compiled (binary) packages are not available to due the software license prohibiting distribution.

Preparation steps

Update the FreeBSD base system if needed.

Run freebsd-update

Reboot if necessary.

Minecraft Server Options

The port itself gives two options: STANDALONE or DAEMON

DAEMON pulls in tmux - which is terminal multiplexer. You can run the Java .jar inside tmux and detach from the current session - this will result in the server continuing to run since the terminal session is not closed.

Selecting DAEMON also creates a RC script for you. This can be very handy if you don't want to start the server on the shell every time. Another possibility would also to be using tmux.

STANDALONE installs the .jar Java file which can be run by hand on the terminal. It is also possible to write a simple RC script which would handle starting and stopping the server.

NOTE: I have chosen STANDALONE in this guide.

The following will be provided:

Installation Methods

We provide two main methods below to building the Minecraft server software.

The Plain Ports method requires only obtaining the Ports tree, and is suitable for single instance, local installation, or experimentation without additional tooling setup and configuration.

The Poudriere method is great for anyone who:

Choose:

Method #1: Plain Ports

You can use portsnap or git

Run portsnap, which installs the Ports tree in /usr/ports/

Accept the Minecraft License

Set acceptance of the Minecraft LICENSE. To do that we'll create a /etc/make.conf

Build the Minecraft Server Port

Building the minecraft server port can be done with in a couple of ways, make install command from the ports framework or using the portmaster ports tool (ports-mgmt/portmaster).

Plain ports:

or using portmaster:

Additional Reading:

Method #2: Poudriere

Accept the Minecraft license

Poudriere's default make.conf location is different (LOCALBASE/etc/poudriere.d/make.conf) ..

Create a poudriere ports tree:

(poudriere-ports(8) manual page)

Build the Minecraft server port (create a package)

Poudriere:

See: poudriere(8) manual page

(To configure the port interactively one most run poudriere options command.

Keep that in mind if you want to make any alterations)

Run the server

4. After all ports have been built we can run the Minecraft server with the following command:

The output will be:

To fix this we need to accept the license. This can be done by editing /usr/local/etc/minecraft-server/eula.txt:

5. From now on the server can be started on the shell with the given command.

On the first run there will be quite some CPU load to generate the world - keep that in mind!

This will run the server with 1GB of memory allocated. Depending on the size of your instance the amount of memory may need to be adjusted.

6. The output of the server also shows a successful connection to the instance:

7. Have fun and enjoy playing :)

Credits


CategoryGaming CategoryHowTo

MinecraftServer (last edited 2022-10-29T11:24:04+0000 by KubilayKocak)