Setup a Minecraft Server on your FreeNAS

I was able to setup a Minecraft server on my FreeNAS box after several hours of Google’ing around. I am running FreeNAS-8.0.4 (this tutorial works for FreeNAS-8.2 as well) on a USB drive. FreeNAS reserves basically the entire drive for the operating system’s use—because of this, any changes you make to the server are lost after powering down or rebooting. Thus in order to install Java—which is needed to run your Minecraft server—we must setup a “jail” running FreeBSD onto your actual volume. A jail is basically an isolated chroot. Our FreeBSD jail is initiated at system bootup then runs in the background parallel with FreeNAS. Files in this jail are saved on your NAS to a folder from within the chroot jail.

This document will explain how to manually setup such a jail on your box. After setting up the jail, we will setup the Minecraft CraftBukkit server.

Let’s begin. First things first, access your FreeNAS terminal whether via SSH or locally.

Make sure to change all the commands below from Main, the name of my volume, to the name of yours.
We will name our jail MinecraftServer. Start off by creating the jail’s directories:

mkdir /mnt/Main/MinecraftServer
mkdir /mnt/Main/MinecraftServer/jail_root
mkdir /mnt/Main/MinecraftServer/FreeBSD

Now, we will change into the FreeBSD directory and download FreeBSD:

 cd /mnt/Main/MinecraftServer/FreeBSD/

wget -rnd`uname -m`/`uname -r | cut -d- -f1-2`/base/ `uname -r | cut -d- -f1-2`_`uname -m`_base

Note: If you see an error like “Resolving 8.2-release_i386_base (8.2-release_i386_base)… failed: hostname nor servname’ provided, or not known“, just disregard it.

Execute the following command

cat base.?? | tar –unlink -xpzf – -C /mnt/Main/MinecraftServer/jail_root/

Next, we need to copy over some of the FreeNAS configurations to the jail:

cd /mnt/Main/MinecraftServer/jail_root/etc
cp /etc/resolv.conf .
cp /etc/localtime .

mount -uw /

cd /conf/base/etc
cp -a /conf /mnt/Main/MinecraftServer/jail_root

mount -t devfs devfs /mnt/Main/MinecraftServer/jail_root/dev

We need to download the Java JRE for FreeBSD. Depending on which version of FreeNAS you have installed download one of the files below from your PC browser, then save it onto your NAS. If you don’t remember which FreeNAS platform you have installed, go to the FreeNAS web interface then click on System > System Information. It should be listed under “Platform”.

AMD64 Java JRE
i386 Java JRE

After you saved the JRE into your FreeNAS, execute the commands below. These will move the .tbz file from /mnt/Main into the jail’s /mnt/Main/MinecraftServer/jail_root/usr/local/ directory:

mkdir /mnt/Main/MinecraftServer/jail_root/usr/local/virtual_java/

mv /mnt/Main/diablo-jre-freebsd7.amd64. /mnt/Main/MinecraftServer/jail_root/usr/local/virtual_java/

cd /mnt/Main/MinecraftServer

Now, change the apparent root to the jail_root directory, then update FreeBSD:

chroot jail_root freebsd-update fetch install

Run the jail:

chroot /mnt/Main/MinecraftServer/jail_root
set prompt=”MinecraftServer &> “

Download the packages needed to install and run Java JRE:

pkg_add -rv xtrans
pkg_add -rv xproto
pkg_add -rv xextproto
pkg_add -rv javavmwrapper

Install the Java JRE:

cd /usr/local/virtual_java
pkg_add -v /usr/local/virtual_java/diablo-jre-freebsd7.amd64.

echo > /mnt/Main/MinecraftServer/jail_root/etc/libmap.conf

echo > /mnt/Main/MinecraftServer/jail_root/conf/base/etc/libmap.conf

echo > /etc/libmap.conf

Make sure you are root user then test to see if the java command runs:

su root

If you see the Java help manual after typing java, the JRE should be installed at this point. Now we have what we need to run the Minecraft server.

Let’s setup the Minecraft server now. You should still be in the jail (if the terminal says “MinecraftServer &>”). While in the jail, create the Minecraft server folder in your volume:

mkdir /mnt/Main/server/
cd /mnt/Main/server/

In the /server folder, create


Copy the text below onto the clipboard, press “i” in the terminal to enter insert mode, then right-click to paste it in:

BINDIR=$(dirname “$(readlink -fn “$0″)”)
cd “$BINDIR”
java -Xmx1024M -Xms1024M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=2 -XX:+AggressiveOpts -jar craftbukkit.jar nogui

Type “:wq” to save and quit the text editor. Now, we need to Change permissions for to make it executable:

chmod -x ./

Start the server by running the script:


Make sure your router is forwarding port 25565 (TCP) to your FreeNAS server.

Congratulations, your Minecraft server is now running on your FreeNAS box! Whenever you want to launch your server, remember to enter the jail first before executing the script by running the following commands:

chroot /mnt/Main/MinecraftServer/jail_root
set prompt=”Minecraft &> ”
cd /mnt/Main/server

Most of the jail setup I have done here was learned from: Install JDownloader In A FreeBSD Jail

If you have any questions or comments, please feel free to ping me in the Comments below!

Tagged , ,

It was Bruce Lee who said it best

“Bruce had me up to three miles a day, really at a good pace.

We’d run the three miles in twenty-one or twenty-tow minutes. Just under eight minutes a mile [Note: when running on his own in 1968, Lee would get his time down to six-and-a-half minutes per mile].

So this morning he said to me “We’re going to go five.”

I said, “Bruce, I can’t go five. I’m a helluva lot older than you are, and I can’t do five.”

He said, “When we get to three, we’ll shift gears and it’s only two more and you’ll do it.”

I said “Okay, hell, I’ll go for it.”

So we get to three, we go into the fourth mile and I’m okay for three or four minutes, and then I really begin to give out.

I’m tired, my heart’s pounding, I can’t go any more and so I say to him, “Bruce if I run any more,” — and we’re still running — “if I run any more I’m liable to have a heart attack and die.” He said, “Then die.” It made me so mad that I went the full five miles.

Afterward I went to the shower and then I wanted to talk to him about it. I said, you know, “Why did you say that?” He said, “Because you might as well be dead. Seriously, if you always put limits on what you can do, physical or anything else, it’ll spread over into the rest of your life. It’ll spread into your work, into your morality, into your entire being. There are no limits. There are plateaus, but you must not stay there, you must go beyond them. If it kills you, it kills you. A man must constantly exceed his level.”


Get every new post delivered to your Inbox.