Setup Minecraft On FreeBSD 10

Published on: Thu, Nov 13, 2014 at 6:29 am EST
BSD Game Servers Minecraft

This article assumes you have a Vultr VPS with 2 CPU and 2GB of ram. Please change any settings accordingly to your VPS type. This article also uses Minecraft 1.8, so please change accordingly if you wish to use something different.

Install Basic Tools

You may want to install wget, nano, and screen by running the following command:

pkg install screen nano wget

Install Java

Install OpenJDK 7 by running the following command:

pkg install java/openjdk7

Once it is done, run the following command to verify the installation of OpenJDK 7:

java -version 

If you see the following, then you can proceed to the next step:

openjdk version "1.7.0_71"
OpenJDK Runtime Environment (build 1.7.0_71-b14)
OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)

Download and Setup Minecraft

Run the following commands to download Minecraft:

cd ~
mkdir mcserver
cd mcserver
wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar –no-check-certificate

Once it is downloaded, you will want to create a file called eula.txt and populate it with eula=true. This is applicable to any server after version 1.7.9. By creating this file, you agree with the Mojang EULA which can be found here.

Next, create a file called startup.sh and populate it with the following:

java -Xmx1500M -Xms750M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -jar  minecraft_server.1.8.jar nogui

Save the file and run the following command to start the server:

screen sh startup.sh

If all is successful, you will be able to connect to the IP address of your VPS with the Minecraft game client. You have just setup Minecraft on FreeBSD 10.

Security Note

It is recommended to create a new user specifically for your server to make sure that the Minecraft server does not have root access. Giving a server or application root access poses a security risk. To create a new user, run adduser and follow everything being prompted, but make sure that when it asks about the shell, to choose nologin as a security measure for this user. Once completed, enter into your server directory and run the following command (Change "minecraft" with the username and group you have created):

chown -R minecraft:minecraft .

This will change the owner of the content of that directory to minecraft. Next, run the following command to start the server:

screen su -m minecraft -c "sh startup.sh"

This will start your server as the user minecraft. If everything is successful, the server will be running.

Want to contribute ?

You could earn up to $300 by adding new articles