MinecraftServer

Minecraft is a game about placing blocks to build anything you can imagine. At night monsters come out, make sure to build a shelter before that happens. The MinecraftServer module implements the Minecraft server to play in multiplayer mode.

Until the MinecraftServer module becomes available, this page shows how to run Minecraft server on your NAS.

Requirements

To run Minecraft you will need

  • a compatible NAS (see below)
  • the OracleJRE6 module
  • shell access to the NAS (through FaJoSSHD, HiSSH or the builtin SSH server)
  • internet access

Compatible NAS models

You should be able to run the Minecraft server on the following models.

1U4200XXX, N2800, 1U4500, N4510U, 1U4600, M3800, N4800, N0503, N4800Eco, N2200XXX, N5550, N3200PRO, N6850, N3200XXX, N7510, N4100PRO, N7700PROv2, N4200, N8800PROv2, N4200Eco, N8900, N4200PRO, N8850, N8900V, N10850, N12000, N5200, N5200PRO, N12000V, N5200XXX, N16000, N5500, N7700, N16000V, N7700+, N7700PRO, N7700SAS, N8200XXX, N8800, N8800+, N8800PRO, N8800SAS

Please note that the numbers of parallel players possible much depends on the memory available and the speed of your network connection. To get an idea what should be possible with your NAS model please check out canihostaminecraftserver.com.

Port Forwarding

To play over the WAN you need to forward port 25565 (tcp) on your router (providing you use the default port). To use a host name instead of the WAN IP of your router you may want to use one of the dynamic DNS provider.

Installing Minecraft Server

The first thing to do is to install and enable the OracleJRE6 module. Instructions can be found on the modules home page.

The next thing to do is to either enable the built in SSH daemon or to install one of the SSH server modules (see Requirements). If you aready have shell access you can skip this step.

Now, that we have shell access, we can log on to the NAS. Here we first create a folder to hold the application files and data. You can choose what ever folder you like and even a sub folder on a share will do (just make sure that write access to the share is well restricted). In my example I will use /raid/data/minecraft. (just do not use /raid/data/module/MinecraftServer since this will become the home of the module later on).

mkdir /raid/data/minecraft

Now we download the server application into the newly created directory (if your NAS does not have access to the web you will have to download the application file from a PC and manually copy it to the NAS:

wget -O /raid/data/minecraft/minecraft_server.jar \
http://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar

Now, lets create a small start/stop script to make live a bit easier:

cat >/raid/data/minecraft/minecraft <<END
#!/bin/sh

JAVA=/raid/data/module/OracleJRE6/system
PIDF=server.pid

mx=\$(awk '\$1=="MemTotal:"{print int(\$2/1024/100)*100}' /proc/meminfo)
ms=\$(awk '\$1=="MemTotal:"{print int(\$2/1024/100)*50}' /proc/meminfo)

cd \$(dirname \$0)

case \$1 in
start)
\$JAVA/bin/nohup -- \$JAVA/jre/bin/java -Xms\${ms}M -Xmx\${mx}M -jar minecraft_server.jar nogui &
printf "%d" \$! > \$PIDF
;;

stop)
if [ -e \$PIDF ]; then
  kill -TERM \$(head -1 \$PIDF)
  rm -f \$PIDF
fi
;;
esac
END

chmod 0755 /raid/data/minecraft/minecraft

Next we create a server configuration file to override some default values (see here for more details):

cat >/raid/data/minecraft/server.properties <<END
allow-flight=true
allow-nether=true
; difficulty: 0 = Peaceful, 1 = Easy, 2 = Normal, 3 = Hard
difficulty=0
enable-query=false
; enable-rcon: to enable the remote console set to "true"
enable-rcon=false
rcon.password=some-strong-password
rcon.port=25575
; gamemode: 0 = Survival, 1 = Creative, 2 = Adventure
gamemode=0
generate-structures=true
generator-settings=
hardcore=false
; a subdirectory called SomeName will be created (do not use spaces here)
level-name=SomeName
level-seed=
; level-type:
; DEFAULT - Standard world with hills, valleys, water, etc.
; FLAT - A flat world with no features, meant for building.
; LARGEBIOMES - Same as default but all biomes are larger.
level-type=DEFAULT
max-build-height=256
; max-players: maximum number of players that can connect simultanously
max-players=5
; motd: the name of the world as it is displayed to clients (spaces allowed)
motd=SomeName
; online-mode: check users against minecraft.net account
online-mode=true
; pvp: player versus player
pvp=false
; server-ip: the local ip we listen on for client connections (blank for any interface)
server-ip=
; server-port: the port we listen on for client connections
server-port=25565
snooper-enabled=false
spawn-animals=true
spawn-monsters=true
spawn-npcs=true
spawn-protection=16
texture-pack=
view-distance=10
; white-list: use a white list to restrict access
white-list=false
END

Restrict access

To restrict access to the server

  • set "white-list=true" in the server.properties file
  • create a file called white-list.txt that should contain the user names of all players allowed to access this instance

Operators

To have some users act as operators create a file called ops.txt containing all their user names (one per line).

Starting and Stopping the Server

To start or stop the Minecraft server all you need to do is to execute:

/raid/data/minecraft/minecraft start

or

/raid/data/minecraft/minecraft stop

Please note that if you start the server for the first time for a specific world it may take some seconds for it to become ready.

Anhänge

AnhangGröße
[file] minecraft
Minecraft server start script
526 Bytes
[file] server.properties
Minecraft server settings
1.37 KB