Install Minecraft Server in a Truenas Jail
Last updated: Apr 27, 2025
Steps
Create the jail from the UI
Install minecraft-server Ports
-
Open in a shell into the running Jail either from the webui with
> Shellbutton or with sshsudo iocage console minecraft2
Jail card with buttons to start Shell
Jail shell opened in the web ui -
Get the Ports repository locally
portsnap fetch extractwill unpack in/usr/ports -
echo "LICENSES_ACCEPTED+= minecraft" >> /etc/make.conf -
cd /usr/ports/games/minecraft-server -
Setup pkg
pkg update -
make install-missing-packagesThis step didn’t work for me, pkg complaining aboutkyuaandpy-wheel044not foundroot@minecraft2:/usr/ports/games/minecraft-server # make install-missing-packages Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. Updating database digests format: 100% pkg-static: No packages available to install matching 'devel/kyua' have been found in the repositories pkg-static: No packages available to install matching 'devel/py-wheel044' have been found in the repositories *** Error code 1 Stop. make: stopped in /usr/ports/games/minecraft-server -
So I installed the 3 dependencies required manually with
pkg install portconfig tmux openjdk21 -
env USE_PACKAGE_DEPENDS_ONLY=yes make installHere the important part isUSE_PACKAGE_DEPENDS_ONLY=yesmaking and installing with pkg dependencies and not compiling everything from sources that would take ages -
Then you will need to choose the run mode for the server, I would recommend to choose Daemon to be able to autostart your server when TrueNas start
TODO
Running minecraft server
- Edit the
/etc/rc.confwithee /etc/rc.conforvimif you prefer (pkg install vim-tiny)
So you can have something like that inWith daemon option: - The service has been installed with the name 'minecraft' - To adjust maximum memory usage (-Xmx), use minecraft_memx= in /etc/rc.conf - To adjust initial memory usage (-Xms), use minecraft_mems= in /etc/rc.conf - To add other java parameters, use minecraft_args= in /etc/rc.conf - To run with a specific version of Java, use minecraft_java_version= in /etc/rc.conf - To see the interactive console, type service minecraft console/etc/rc.conf# Minecraf server minecraft_enable="YES" # minecraft_memx= # minecraft_mems= # minecraft_args= # minecraft_java_version= - make
/tmpwritable for every userschmod a+w /tmp - Start the server for the first time
service minecraft start - Check the logs with
tail /var/log/minecraft-server/latest.log[17:20:28] [ServerMain/WARN]: Failed to load eula.txt [17:20:28] [ServerMain/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info. - Edit
eula.txtwithvim /usr/local/etc/minecraft-server/eula.txt - Then restart the server again with
service minecraft start - Follow the logs
tail -f /var/log/minecraft-server/latest.log - Access the minecraft console
service minecraft console - Quit the console
Ctrl+bthen pressdor you can doCtrl+band type:detachand hitEnter
Upgrade the package to Minecraft 1.21.5
cd /usr/ports/games/minecraft-server- Edit the
Makefilewithvim Makefile
You can the url from the minecraft official server download pagePORTNAME= minecraft-server DISTVERSION= 1.21.5 CATEGORIES= games java MASTER_SITES= https://piston-data.mojang.com/v1/objects/e6ec2f64e6080b9b5d9b471b291c33cc7f509733/ DISTNAME= server EXTRACT_SUFX= .jar DIST_SUBDIR= ${PORTNAME}-${DISTVERSION} - Update the distfile
make clean makesum - Then rebuild and install
env USE_PACKAGE_DEPENDS_ONLY=yes make reinstall - Restart the server to be in 1.21.5
service minecraft restart