Jurgen Segaert
Guru
- Joined
- Jul 10, 2016
- Messages
- 521
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-U5
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.
2. Shell into your jail & install the necessary packages
Login as root to your jail and run the following commands:
[note: I added bash & wget, as I needed these to run/instal specific Minecraft servers and scripts related to Spigot and RaspberryJuice]
3. Install MineOS-node
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
5. Add a unprivileged user to use with the MineOS web-ui
Use the adduser command to start the process
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.
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.:
Many thanks to Joshua Parker Ruehlig and Hexparrot for their excellent instructions and documentation in various threads. For further reference, please see
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-U5
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.4-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 py38-rdiff-backup rsync gmake screen git-lite python38 py38-supervisor node npm openjdk16 wget bash
[note: I added bash & wget, as I needed these to run/instal specific Minecraft servers and scripts related to Spigot and RaspberryJuice]
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 npm install jsegaert/node-userid 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: