Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

How to install MineOS-node in a jail (alternative to using the MineOS plugin)

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
356
This tutorial is intended to be a simple cookbook for FreeNAS users that would like to set up MineOS in a jail without using the MineOS plugin.

EDIT: The original post was created on FreeNAS-9.10-STABLE; currently FreeNAS uses iocage as the jail manager, and this post has been updated to reflect this. Tested using FreeNAS 11.3-U2

1. Create a jail.
For this exercise, I named the jail mineos-jail. You can use the WebUI to create the jail, but below it is done via the command line. Any network options should work. If you use the webUI, be sure to check the mount_procfs and mount_linprocfs checkboxes in the Custom Properties section. In this example, I'm using NAT so it's also forwarding the proper ports via the nat_forwards property.
Code:
iocage create -n mineos-jail -r 11.3-RELEASE nat=1 vnet=1
iocage set mount_procfs=1 mount_linprocfs=1 boot=on allow_raw_sockets=1 mineos-jail
iocage set nat_forwards="tcp(8443:8443),tcp(25565:25565),tcp(25566:25566),tcp(25567:25567),tcp(25568:25568),tcp(25569:25569),tcp(25570:25570)" mineos-jail
iocage start mineos-jail


2. Shell into your jail & install the necessary packages
Login as root to your jail and run the following commands:
Code:
pkg update
pkg upgrade -y
pkg install -y rdiff-backup rsync gmake screen git-lite python3 py37-supervisor node10 npm-node10 openjdk8-jre wget bash


[note: I added bash & wget, as I needed these to run/instal specific Minecraft servers and scripts related to Spigot and RaspberryJuice]
[note: rdiff-backup has been renamed to py-rdiff-backup on latest]

3. Install MineOS-node
Code:
mkdir -p /usr/compat/linux/proc
mkdir -p /usr/local/games
cd /usr/local/games
git clone git://github.com/hexparrot/mineos-node minecraft
cd minecraft
chmod +x *.sh
./generate-sslcert.sh
cp mineos.conf /etc/mineos.conf
echo "CXX=c++ npm install" | sh


If you do not care to use SSL/HTTPS, you can edit the mineos configuration file /etc/mineos.conf to change parameter use_https to false.

4. Startup MineOS-node when jail starts and start the service

Code:
cat /usr/local/games/minecraft/init/supervisor_conf.bsd >> /usr/local/etc/supervisord.conf
sysrc supervisord_enable="YES"
service supervisord start


5. Add a unprivileged user to use with the MineOS web-ui
Use the adduser command to start the process
Code:
adduser

Follow the prompts; the result should more or less look like the example below. I'm sticking to the same user mcserver as the plugin.
Code:
[root@mineos_jail /usr/local/games/minecraft]# adduser
Username: mcserver
Full name: User for MineOS
Uid (Leave empty for default):
Login group [mcserver]:
Login group is mcserver. Invite mcserver into other groups? []: games
Login class [default]:
Shell (sh csh tcsh git-shell bash rbash nologin) [sh]: bash
Home directory [/home/mcserver]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username   : mcserver
Password   : *****
Full Name  : User for MineOS
Uid        : 1001
Class      :
Groups     : mcserver games
Home       : /home/mcserver
Home Mode  :
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (mcserver) to the user database.
Add another user? (yes/no): no
Goodbye!


6. Exit the jail & go to a browser
You should now be able to access the MineOS webUI using the following URL:
https://<IP address of jail>:8443/admin/login.html

Note 1: If you use NAT, you'll have to use the IP address of the FreeNAS host.
Note 2: Ideally you create a dataset to store your Minecraft server data on your main pool, and then mount it inside your jail, e.g.:
Code:
iocage fstab -a mineos-jail "/mnt/tank/mcdata /var/games/minecraft nullfs rw 0 0"


Many thanks to Joshua Parker Ruehlig and Hexparrot for their excellent instructions and documentation in various threads. For further reference, please see
 
Last edited:

rafadavidc

Member
Joined
Mar 26, 2016
Messages
38
Imma go sandbox this when I get home and see what the difference is between this and the vB MineOS I have up is. Thanks for this.
 

clugo633

Junior Member
Joined
Apr 16, 2015
Messages
18
hello. Im new to using the shell but I continue to get the following fatal message when I enter:
  1. git clone git://github.com/hexparrot/mineos-node minecraft

    fatal: Unable to look up github.com (port 9418) (hostname nor servname provided, or not known)

    Can someone please point me in the right direction. Thanks.
 

clugo633

Junior Member
Joined
Apr 16, 2015
Messages
18
Tried that and still no luck. Not able to resolve
 

tfast500

Member
Joined
Feb 9, 2015
Messages
77
Make sure your dns are set in your jail.

/etc/resolv.conf

Sent from my Nexus 6P using Tapatalk
 

cygnus

Member
Joined
Mar 20, 2012
Messages
70
Hi All, thanks for this after plugin fails to create a server thought this helps unfortunately I get error on the second step after creating the jail as appears to create a jail for 10.3 version.
Updating FreeBSD repository catalogue...
Repository FreeBSD has a wrong packagesite, need to re-create database
pkg: http://pkg.FreeBSD.org/freebsd:10:x86:64/latest/meta.txz: No address record
repository FreeBSD has no meta file, using default settings
pkg: http://pkg.FreeBSD.org/freebsd:10:x86:64/latest/packagesite.txz: No address
record
Unable to update repository FreeBSD
All help greatly appreciated
Rgds
Cygnus
 

cygnus

Member
Joined
Mar 20, 2012
Messages
70
I suspect you don't have networking in your jail. Can you ping 8.8.8.8 ?
Please verify both your global network settings (Network > Global Configuration - make sure you have a default gateway specified) and jail specific network settings.

Thanks that helps but now the blimmin jail is started and can ping but when open http or https://192.168.0.157:8443/admin/login.html never shows the webinterface and times out.

Appears I get Err_Connection_Refused for some reason!
 
Last edited:

cygnus

Member
Joined
Mar 20, 2012
Messages
70
Thanks that helps but now the blimmin jail is started and can ping but when open http or https://192.168.0.157:8443/admin/login.html never shows the webinterface and times out.

Appears I get Err_Connection_Refused for some reason!

Is there a list of things I can check to see if installed correctly?
Many thanks
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
356
So I assume now you can both ping your jail IP from your LAN and ping outside from within your jail.

Logon to your jail and check that the service is running using service supervisord status

Check file /etc/mineos.conf if the parameter use_https = true, then you're supposed to use https, otherwise use http

If all that is OK, look for the following files in directory /var/log/
  • supervisord.log
  • mineos.log
 

cygnus

Member
Joined
Mar 20, 2012
Messages
70
So I assume now you can both ping your jail IP from your LAN and ping outside from within your jail.

Logon to your jail and check that the service is running using service supervisord status

Check file /etc/mineos.conf if the parameter use_https = true, then you're supposed to use https, otherwise use http

If all that is OK, look for the following files in directory /var/log/
  • supervisord.log
  • mineos.log
Thanks Jurgen, unfortunately I get this....
root@mineos_jail:/ # service supervisord status
supervisord is not running.
root@mineos_jail:/ # service supervisord start
Starting supervisord.
Error: .ini file does not include supervisord section
For help, use /usr/local/bin/supervisord -h
/usr/local/etc/rc.d/supervisord: WARNING: failed to start supervisord

on checking var/log I dont have either of those files you mention. So something must have not got installed correctly I'm guessing.

lastly use_https = false

Hope you can help me!
Thanks again
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
356
What is the content of supervisord configuration file? /usr/local/etc/supervisord.conf
It should pretty much look like the default file (/usr/local/etc/supervisord.conf.sample) with the contents from file
/usr/local/games/minecraft/init/supervisor_conf.bsd added at the end.
 

cygnus

Member
Joined
Mar 20, 2012
Messages
70
What is the content of supervisord configuration file? /usr/local/etc/supervisord.conf
It should pretty much look like the default file (/usr/local/etc/supervisord.conf.sample) with the contents from file
/usr/local/games/minecraft/init/supervisor_conf.bsd added at the end.
After your assistance I can now get to the webinterface - My last problem now is I cannot select a runnable Jar file to use. I managed to download the profile for the latest Mojang version but nothing shows on the dropdown for Runnable Jar files!!! Close but yet so far! :) thanks for your help!!

OK so copied my minecraft jar into the server folder and allows me to select it now but just wont start!!

Ever closer!
 
Last edited:

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
356
Hmm... that copying should happen automatically. Check these permissions:
  • Be sure to logon to the MineOS UI using the non-privileged user you created (mcserver) and not via root
  • Make sure that you added that user mcserver to the group games
  • Verify the ownership of the directory /var/games/minecraft and all its sub-directories. They should be owned by root:games.
Code:
root@mineos_3:/var/games/minecraft # ls -al                                     
total 12                                                                       
drwxr-xr-x  7 root  games  7 Feb 12 21:21 .                                     
drwxrwxr-x  3 root  games  3 Feb 12 21:21 ..                                   
drwxrwxr-x  3 root  games  3 Feb 12 21:25 archive                               
drwxrwxr-x  3 root  games  3 Feb 12 21:25 backup                               
drwxrwxrwx  2 root  games  2 Feb 12 21:21 import                               
drwxrwxr-x  3 root  games  3 Feb 12 21:25 profiles                             
drwxrwxr-x  3 root  games  3 Feb 12 21:25 servers                               
root@mineos_3:/var/games/minecraft #  

Also, now that everything seems to be installed stop/restart jail as per the steps in #6 in the guide
 

cygnus

Member
Joined
Mar 20, 2012
Messages
70
Hmm... that copying should happen automatically. Check these permissions:
  • Be sure to logon to the MineOS UI using the non-privileged user you created (mcserver) and not via root
  • Make sure that you added that user mcserver to the group games
  • Verify the ownership of the directory /var/games/minecraft and all its sub-directories. They should be owned by root:games.
Code:
root@mineos_3:/var/games/minecraft # ls -al                                    
total 12                                                                      
drwxr-xr-x  7 root  games  7 Feb 12 21:21 .                                    
drwxrwxr-x  3 root  games  3 Feb 12 21:21 ..                                  
drwxrwxr-x  3 root  games  3 Feb 12 21:25 archive                              
drwxrwxr-x  3 root  games  3 Feb 12 21:25 backup                              
drwxrwxrwx  2 root  games  2 Feb 12 21:21 import                              
drwxrwxr-x  3 root  games  3 Feb 12 21:25 profiles                            
drwxrwxr-x  3 root  games  3 Feb 12 21:25 servers                              
root@mineos_3:/var/games/minecraft # 

Also, now that everything seems to be installed stop/restart jail as per the steps in #6 in the guide
Thanks again Jurgen
my ls -al shows
root@mineos_jail:/var/games/minecraft # ls -al
total 12
drwxr-xr-x 7 root games 7 Feb 12 17:27 .
drwxrwxr-x 3 root games 3 Feb 12 17:27 ..
drwxrwxr-x 4 root games 4 Feb 12 18:01 archive
drwxrwxr-x 4 root games 4 Feb 12 18:01 backup
drwxrwxrwx 2 root games 2 Feb 12 17:27 import
drwxrwxr-x 4 root games 4 Feb 12 17:44 profiles
drwxrwxr-x 3 root games 3 Feb 12 18:01 servers

I have restarted the jail a number of times, but I cant see how to check if mcserver has also been added to games group? I'm 99% sure I requested it on the adduser command. but be great to check.
Many thanks
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
356
I tested on a brand new jail, and it works fine for me. After you download a download a profile/jar and you select that profile in your server, the corresponding "runnable jar" becomes automatically available.

You can use the command id mcserver to see the groups associated with user mcserver.
Code:
root@mineos_2:/ # id mcserver
uid=1006(mcserver) gid=1006(mcserver) groups=1006(mcserver),13(games)


The /var/log/mineos.log file may give you pointers to any problems. If all else fails, it may be faster & easier to scrap your jail and start again, than to try to find what's wrong.
 
Top