This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

[HOWTO] Install Minecraft Server Inside Jail

Jails with XigmaNAS
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
tfast500
NewUser
NewUser
Posts: 12
Joined: 30 Aug 2013 22:25
Status: Offline

[HOWTO] Install Minecraft Server Inside Jail

Post by tfast500 »

So ill start off by saying I am fairly new to both nas4free and minecraft, that being said if you have questions I may not be able to answer all of them. Also if there's better ways of doing this please correct me. I Hope someone finds this useful :D .

1. Create jail
please read this post: viewtopic.php?f=79&t=3894
CaptureJAIL.PNG


2. Connect to your jail
I use putty for this

to see your current jails:

Code: Select all

nas4free: ~ # jls
   		JID  IP Address      Hostname                      Path
     		1  192.168.2.225   Plex.local                    /mnt/Pool/Jail/Plex
     		2  192.168.2.200   http://www.local              /mnt/Pool/Jail/www
     		3  192.168.2.230   owncloud.local                /mnt/Pool/Jail/owncloud
     		4  192.168.2.215   MineCraft.local               /mnt/Pool/Jail/MineCraft
Find the JID of your newly created mincraft jail and input the following command

Code: Select all

jexec {JID} csh 
(in my case {JID} = 4)

3. Get the ports

Code: Select all

portsnap fetch extract
4. Install nano editor
not needed but I found it easier to use

Code: Select all

pkg_add -r nano
5. Install java

Code: Select all

cd /usr/ports/java/openjdk7
make install clean
1hr 30min later....
(choose all defaults and hit "ok" a million times)

6. Create minecraft directory

Code: Select all

mkdir -p /srv/minecraft
cd /srv/minecraft
fetch https://s3.amazonaws.com/Minecraft.Download/versions/1.7.2/minecraft_server.1.7.2.jar
7. Run the server by running the following

Code: Select all

java -Xmx1024M -Xms1024M -jar minecraft_server.1.7.2.jar nogui
After initial startup it should build your directory structure as such:

Code: Select all

/srv/minecraft # ls

	banned-ips.txt                  ops.txt
	banned-players.txt              server.properties
	logs                            white-list.txt
	minecraft_server.1.7.2.jar      world
8. Time to test make sure you use the same client game version as the sever version in this case client game version is 1.7.2

---------------------------------------------------------------------
CONFIGURE SERVER
---------------------------------------------------------------------

Code: Select all

nano server.properties
#Minecraft server properties
#(File modification datestamp)
generator-settings=
op-permission-level=4
allow-nether=true
level-name=world
enable-query=false
allow-flight=false
announce-player-achievements=true
server-port=25565
level-type=DEFAULT
enable-rcon=false
level-seed=
force-gamemode=false
server-ip=
max-build-height=256
spawn-npcs=true
white-list=false
spawn-animals=true
hardcore=false
snooper-enabled=true
online-mode=true
resource-pack=
pvp=true
difficulty=1
enable-command-block=false
gamemode=0
player-idle-timeout=0
max-players=20
spawn-monsters=true
generate-structures=true
view-distance=10
motd=A Minecraft Server
---------------------------------------------------------------------
OPTIONAL
---------------------------------------------------------------------
Allowing outside connections to your minecraft server (I recommend not running the server as root)
-open tcp port 25565 on your jail IP from in your router

Automatic Startup
STILL TO COME
You do not have the required permissions to view the files attached to this post.

LrdBate
NewUser
NewUser
Posts: 13
Joined: 02 Jun 2013 11:18
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by LrdBate »

In the minecraft wiki is an usable guide for the automatic startup

http://minecraft.gamepedia.com/Tutorial ... tup_script
Wiki wrote: This is an example of a possible Minecraft server rc.d startup script for FreeBSD.
Installation

Use adduser to create a new user named minecraft. When asked to select the new user's home directory, use /srv/minecraft.
Ensure that your /srv filesystem has enough free space (around ~100-200MB depending on your needs) - df -h will show how much space is available.
Install Java if necessary. The port is available at /usr/ports/java/jdk16.
As root, run the following:

Code: Select all

# cd /usr/ports/sysutils/screen && make install clean
# cd /srv/minecraft
# fetch https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
# chown minecraft:minecraft *
# fetch -o /usr/local/etc/rc.d/minecraft http://vidya.dyndns.org/stuff/minecraft
# chmod 0555 /usr/local/etc/rc.d/minecraft
If you have existing server configuration files, world files, etc., copy them into /srv/minecraft and give ownership to your minecraft user.
Edit /etc/rc.conf.local (create if it doesn't exist) and add the following line:

Code: Select all

minecraft_enable="yes"
The server should now start on boot. To launch, check status, and shut down, use the following commands:

Code: Select all

# /usr/local/etc/rc.d/minecraft start
# /usr/local/etc/rc.d/minecraft status
# /usr/local/etc/rc.d/minecraft stop
Or:

Code: Select all

# service minecraft start
# service minecraft status
# service minecraft stop
Script

Code: Select all

#!/bin/sh
#
# PROVIDE: minecraft
# REQUIRE: LOGIN DAEMON NETWORKING mountcritlocal
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local to enable the minecraft server:
#
# minecraft_enable="YES"
# minecraft_user="<run server as this user>"
# minecraft_chdir="<run server in this directory>"
# minecraft_path="<path to minecraft_server.jar>"
# minecraft_flags="<set as needed>"
#
# For default setup, create a user named 'minecraft', set its home directory
# to /srv/minecraft, and place minecraft_server.jar into /srv/minecraft
#
# See minecraft_server.jar for flags

. /etc/rc.subr

name=minecraft
rcvar=`set_rcvar`

load_rc_config ${name}

command=/usr/local/bin/screen
pidfile=/var/run/minecraft.pid

start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"

: ${minecraft_enable="NO"}
: ${minecraft_session="minecraft-session"}
: ${minecraft_user="minecraft"}
: ${minecraft_chdir="/srv/minecraft"}
: ${minecraft_path="/srv/minecraft/minecraft_server.jar"}
: ${minecraft_flags=""}
: ${minecraft_args="/usr/local/bin/java -Xmx1024M -Xms1024M \
                    -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing \
                    -XX:ParallelGCThreads=4 -XX:+AggressiveOpts \
                    -jar ${minecraft_path} ${minecraft_flags} nogui"}

minecraft_start() {
    unset "${rc_arg}_cmd"
    minecraft_flags="-d -m -S ${minecraft_session} ${minecraft_args}"
    if minecraft_running; then
        echo "minecraft already running?"
    else
        run_rc_command "start"
    fi
}

minecraft_stop() {
    local cmd
    cmd="${command} -p 0 -S ${minecraft_session} -X eval 'stuff stop\015'"
    if minecraft_running; then
        echo "Stopping minecraft."
        su -m ${minecraft_user} -c "${cmd}"
    fi
}

minecraft_status() {
    if minecraft_running; then
        echo "minecraft is running."
    else
        echo "minecraft is not running."
    fi
}

minecraft_running() {
    local check ses
    ses="${minecraft_session}"
    check=`su -m ${minecraft_user} -c "${command} -list" | grep ${ses}`
    if [ "$check" ]; then
        return 0
    else
        return 1
    fi
}

run_rc_command "$1"

Oh, and thanks for your howto :)

FlummN
NewUser
NewUser
Posts: 2
Joined: 20 Dec 2013 13:32
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by FlummN »

Hi,

I struggle with installing java. I do not have the folders mentioned in /usr/...And don't even know if that is the problem but I guess my problem is for setting up the jail in thebrig faulty?? could someone make a "howto" starting from how to setup minecraft in thebrig (not setting up thebrig itself)

mrjrussell
Starter
Starter
Posts: 48
Joined: 26 Jun 2012 04:31
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by mrjrussell »

I am no expert but can I suggest changing openjdk7 "make install clean" to "make -DBATCH install clean "

-DBATCH really speeds up things and lets you walk away

:)
SGI Rackable NM46X, x64 Dual Processor - embedded on Dual-Core AMD Opteron(tm) Processor 8216 HE 16GB Ram -9.2.0.1 - Shigawire (rev 925)
My setup posting.php?mode=edit&f=63&t=179&p=363

mrjrussell
Starter
Starter
Posts: 48
Joined: 26 Jun 2012 04:31
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by mrjrussell »

I was able to get this to install but it does not work with Tablets . Does anyone know how to get the PE server to work in a jail ?

for now my work around was to create another Virtualbox server just for it. PE minecraft server
SGI Rackable NM46X, x64 Dual Processor - embedded on Dual-Core AMD Opteron(tm) Processor 8216 HE 16GB Ram -9.2.0.1 - Shigawire (rev 925)
My setup posting.php?mode=edit&f=63&t=179&p=363

mrjrussell
Starter
Starter
Posts: 48
Joined: 26 Jun 2012 04:31
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by mrjrussell »

mrjrussell wrote:I was able to get this to install but it does not work with Tablets . Does anyone know how to get the PE server to work in a jail ?

for now my work around was to create another Virtualbox server just for it. PE minecraft server

That did not work either because the PE Minecraft server needs version 7.0 or 7.5 and the kindles have version 8.1 erg not sure what route to go now to get this to work.
SGI Rackable NM46X, x64 Dual Processor - embedded on Dual-Core AMD Opteron(tm) Processor 8216 HE 16GB Ram -9.2.0.1 - Shigawire (rev 925)
My setup posting.php?mode=edit&f=63&t=179&p=363

simonszu
NewUser
NewUser
Posts: 10
Joined: 07 Jan 2014 14:06
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by simonszu »

FlummN wrote:Hi,

I struggle with installing java. I do not have the folders mentioned in /usr/...
You need to execute "portsnap fetch" and after that "portsnap extract" in your jail.

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4865
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by raulfg3 »

good news, if you upgrade "TheBrig" to latest 0.7 version, you have an embeded GUI to manage Ports and maintain it updated.
12.1.0.4 - Ingva (revision 7743) on SUPERMICRO X8SIL-F 8GB of ECC RAM, 11x3TB disk in 1 vdev = Vpool = 32TB Raw size , so 29TB usable size (I Have other NAS as Backup)

Wiki
Last changes

HP T510

User avatar
zambogiulio
experienced User
experienced User
Posts: 82
Joined: 15 Sep 2012 22:36
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by zambogiulio »

Unfortunately, I see that the creator of this guide does not connect for a while '
being that I can not install the minecraft server, I would like to ask everyone if anyone has succeeded.
I always stop at "java: command not found"
my version is embedded x64 9.1 (847) I create a small jail with the brig, do not write anything in fstab and do not know where I'm wrong.
only detail I noticed is that as JID, am connected via ssh, the system tells me "6" despite being the only jail that I have created.
If you can help me ..
Sorry for my english.
Edit:I could, I had to create a jail "full"

Danswan
NewUser
NewUser
Posts: 5
Joined: 28 Jun 2012 01:00
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by Danswan »

This is working perfectly for me, which is a surprise as I'm a total n00b :) One question, how to I connect to the minecraft server console within the jail?

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4865
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by raulfg3 »

Danswan wrote:One question, how to I connect to the minecraft server console within the jail?
not sure I understand, but perhaps you need to conect to your jailIP:port

in the example 192.168.2.215:25565
12.1.0.4 - Ingva (revision 7743) on SUPERMICRO X8SIL-F 8GB of ECC RAM, 11x3TB disk in 1 vdev = Vpool = 32TB Raw size , so 29TB usable size (I Have other NAS as Backup)

Wiki
Last changes

HP T510

Danswan
NewUser
NewUser
Posts: 5
Joined: 28 Jun 2012 01:00
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by Danswan »

Sorry, should have been clearer. If I start Minecraft server in the standard way, i.e by typing 'java -Xmx1024M -Xms1024M -jar minecraft_server.1.7.2.jar nogui', the minecraft console launches, from where I can administer the server, kick, ban etc. However if I run it as a service so it automatically launches on boot, as per the second post, I can't work out how to get into the console to administer the server. Hope that makes more sense!

Danswan
NewUser
NewUser
Posts: 5
Joined: 28 Jun 2012 01:00
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by Danswan »

Ignore the previous, seems it's not possible.

Another question which I hope is not too complicated - I've got minecraft running as a service and it's been fine, however I had a power cut this morning and since starting back up again, can't access the server. 'service minecraft status' shows it as running, but when I type 'service minecraft stop' I get:

Stopping minecraft.
There is a screen on:
16261.minecraft-session (Dead ???)
Remove dead screens with 'screen -wipe'.
No screen session found.

I guess there's something still hanging around due to the unceremonious shutdown, but how can I clear it? I tried screen -wipe, it says "No Sockets found in /tmp/screens/S-root"

jj69
NewUser
NewUser
Posts: 6
Joined: 06 Feb 2014 10:46
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by jj69 »

Danswan wrote:Ignore the previous, seems it's not possible.
It's not impossible, I did that several time before switching from 'screen' to 'tmux'.
Chances are that you try to list the opened sessions using the wrong user conneted : remember that the rc script in OP launch the screen sessions as 'minecraft' user.
simply try

Code: Select all

su minecraft
screen -ls
BTW, I can dump my own rc script to launch minecraft server with tmux if someone is interested.

Impulse1
Starter
Starter
Posts: 37
Joined: 06 Jul 2012 06:01
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by Impulse1 »

jj69 wrote: BTW, I can dump my own rc script to launch minecraft server with tmux if someone is interested.
Can you explain more about tmux? whats the benefit of it and are there any downsides to it? From what I understand, does it allow you to automatically start the server, and then at a later time login to a terminal window via ssh to administer the server?

Impulse1
Starter
Starter
Posts: 37
Joined: 06 Jul 2012 06:01
Status: Offline

Re: [HOWTO] Install Minecraft Server Inside Jail

Post by Impulse1 »

Also does anyone have a new link to the file referenced here:

Code: Select all

fetch -o /usr/local/etc/rc.d/minecraft http://vidya.dyndns.org/stuff/minecraft

Post Reply

Return to “Jails”