MineCraft Server, FreeNAS 9.2 Tutorial

How to install MineCraft Server in a FreeBSD Jail on FreeNAS 9.2:

(Click on screencaps to enlarge.)

Phase 1: Get a FreeBSD Jail up and running.

Step 1: Create a new FreeBSD Jail.

This may take a while.

Install Putty (or SSH client of your choice.)
SSH into FreeNAS Box. (The main system IP, not the jail’s IP.)


Type “su” to get root permission on your FreeNAS box.
Type “jls” to get a list of configured Jails.
See “JID” of MineCraft1 Jail = 4.
“jexec” to shell into a given jail. (Replace 4 with your JID. /bin/sh is correct.)

You are now ssh’d into your jail with root privileges and can configure as needed. Believe it or not, that used to be a whole heck of a lot harder. Wouldn’t have worked that easily with FreeNAS 9.1, and FreeNAS 8.x would have… oh, never mind. We live in the future. Be happy.

Phase 2: Configure Jail as MineCraft Server:

Many FreeBSD guides refer to installing software by /usr/ports/____ and then using the “make” command. Unfortunately, FreeBSD jails do not have ports installed. Rather than go nuts installing it, I just use pkg_add with the “-r” option to pull from a remote repo.

This is supposedly not the “right” way but it works fine.

Install Java – “pkg_add –r openjdk7”

I also installed “screen,” “nano,” and “lynx,” to make life a little easier for me. Screen is needed later. Nano will be useful for editing minecraft’s config files, although there are other ways to do that. (vim is included in FreeBSD already if that’s more your thing.)

Now, create a new user using the “adduser” command – this is the user account that will “own” the MineCraft server. (For various reasons, you don’t want to run it as root.)

You will notice we are still logged in as “root.” Enter “su mcuser” to switch to the mcuser account.

Use the “id” command to verify that you are logged in as mcuser, then navigate to mcusers homefolder and download the latest server.jar. (Available from https://minecraft.net/download)

Technically, you can simply launch the server at this point. However, I highly recommend that you use the “screen” program first. Otherwise, your java server will terminate when you disconnect from your SSH session. (That’s bad.)

Launch screen by typing “screen.” If you receive an error about “/dev/pts/5” run “script /dev/null” and then try launching screen again. Press space to continue.

Directions on using screen: https://forums.freebsd.org/viewtopic.php?&t=3599

Simply Ctrl-a, c to create a new virtual screen, then Ctrl-a, A to give it a name. (I chose, oddly enough, “MineCraft.”

Finally, enter “java -Xmx1024M -Xms1024M -jar minecraft_server.1.7.4.jar” to launch MineCraft. (If you copy that, right click in the Putty window to paste.)

If you have a lot of RAM in your system, and you run with a lot of users and server mods, you may want to give Java more RAM too – do this by changing those number to, say, 2048M instead of 1024M.)

Ctrl-a, w will show you the active screens at the bottom. Ctrl-a, d to detach the screen, then “exit” out of any other screens.

Once that’s done, “screen –ls” to see your detached session still running. Leave it alone, and never, ever restart your FreeNAS Box. (That’s the point.)

The rest is between you and MineCraft. Don’t forget to occasionally back up your ~/world directory. 🙂

Positive or constructive negative feedback is welcome below.

Leave a Reply

Your email address will not be published. Required fields are marked *