Skip to main content

Minecraft Server on Debian

Running Minecraft Server on a Linode Debian Instance

If you are having issues following the official wiki then you are not alone - I found it much too generic and could not get the 'init.d' startup script to work. Following is a step by step guide to quickly set up your on game server running on Debian/Ubuntu distribution.

Install Java

We are going to install OpenJDK which for all intents and purposes is equivalent to Sun java but without licensing issues. Execute below commands under root or using sudo.

# aptitude update
# aptitude install openjdk-6-jre-headless

Download and Install Minecraft Server

We are going to download and install into '/usr/local/minecraft' as per the Debian FilesystemHierarchyStandard.

# mkdir /usr/local/minecraft
# cd /usr/local/minecraft/
# wget

We are installing the bukkit minecraft version rather then the vanilla one, it is fully comptabible with the vanilla server but lets your run plugins to effectivley manage your server

Server Settings

Create the server's file. I suggest you at least modify the 'motd', and 'level-seed' so that your world is a little personal to you.

# cd /usr/local/minecraft/
# nano

#Danols Minecraft Server properties
level-seed=Artomix #
motd=you must survive

Automatic Startup

Compared that what is posted on the Minecraft Wiki the below is a simple startup script using Debians/Ubuntus start-stop-deamon utility, it does not have the update server, or run file system in memory option; in my opinion Java+Linux do a good job system caching on demand and any speeds from running in memory

The server is run under user 'minecraft-server' and group 'daemon' to increase security - this account and group is created as follows:

# useradd --home-dir /usr/local/minecraft-server --no-create-home -g daemon --shell /bin/false minecraft-server
# groupadd daemon

Create the startup script as follows

# cd /etc/init.d/
# touch minecraft-server
# chmod +x minecraft-server

Paste the following code into the script and make sure to modify the DAEMON_ARGS setting to reflect your memory allocation.

# Provides:          minecraft_server
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Minecraft server debian init script.
# Author: Daniel Sokolowski

# You can use this as a template or symbolic link it into `/etc/init.d` on Debian system

# PATH should only include /usr/* if it runs after the script
DESC="Minecraft Server"
SCREENNAME=minecraft-server # the session screen game given

# the -Xincgc options enable incremental garbage collector which slows 
# execution but makes  more memory efficient. 
# -Xmx1024M is the recommended minimum

DAEMON_ARGS="-DmS $SCREENNAME java -Xincgc -Xms32M -Xmx304M -jar /usr/local/minecraft-server/$NAME nogui" 
 # Lowest memory limit used was about 80M on fresh start.
 # For screen we use `-DmS` instead of -dmS since -D dosen't detach the screen so our pid 
 # file created by start-stop-deamon is correct. 

# Exit if the package is not installed
#[ -f "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Function that starts the daemon/service
  # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        start-stop-daemon -c $DAEMONUSER -g $DAEMONGROUP -u $DAEMONUSER --start --verbose --background --chdir /usr/local/minecraft-server/ --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- $DAEMON_ARGS
        echo "start-stop-daemon -c $DAEMONUSER -g $DAEMONGROUP --start --verbose --background --chdir /usr/local/minecraft-server/ --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- $DAEMON_ARGS"
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.

# Function that stops the daemon/service
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        sleep 5s
        return "$RETVAL"

# Function that sends a SIGHUP to the daemon/service
do_reload() {
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
        return 0

case "$1" in
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        # If do_reload() is not implemented then leave this commented out
        # and leave 'force-reload' as an alias for 'restart'.
        #log_daemon_msg "Reloading $DESC" "$NAME"
        #log_end_msg $?
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        log_daemon_msg "Restarting $DESC" "$NAME"
        case "$?" in
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                # Failed to stop
                log_end_msg 1
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3

Activate the startup script and start the server by executing the following commands:

# update-rc.d minecraft-server defaults
# /etc/init.d/minecraft-server start

More Resources

Visit Bukkit for a wealth of information and plugins and feel free to contact me at


  1. this is not a good solution as the server gets killed and not shutdown!
    it can end in a loss of the world file or chunks


Post a Comment

Popular posts from this blog

How to child proof a fireplace

DIY - Do it yourself fireplace child guard Our wonderful 8.5 month old Sofia has become a crawling race car with an untamed thirst for exploration. And so with the cold nights approaching we needed to child proof the fireplace. This however proved to be more difficult than would reasonably expect, I've checked the local Toys "R" Us, Walmart, and even a Canadian Tire with no success for a ready to use product. Internet search was more fruitful and returned a few online stores one could order from, however in all honestly they didn't look too sturdy to me. So I build my own relatively quickly and inexpensively. Materials needed is a privacy plastic lattice - the smallest hole pattern - a few screws and anchors; tools needed are a drill, and a handsaw if you don't have the lattice cut at the store - that’s it. The construction consits of screwing the lattice into the wall and the final product is easiest explained through following pictures. Feel free to +1 this po…

Duplicate value found: duplicates value on record with id: <unknown>.

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>.The above error is triggered in the database layer and caused by a trigger or workflow outside of your main code of block that is bubbling this exception. This is rather difficult to track down especially if you are unfamiliar with the code, I am sharing my procedure in the hopes this saves you time - if you find this helpful drop me a line or follow me on twitter @danielsokolows. This error is caused by unique field constraint on the object, so the first step is to examine the object and locate the API names of all unique fieds. You can do this through SF direclty 'Setup < Customize &lt <object being inserted> &lt Fields' or by downloading the `src/objects` metadata information and searching for <unique>; I preffer the latter and actually download ALL matadata information f…

Setting up ZOTAC ZBOX nano AD Remote for XBMC

Getting the Windows, Info and Colored buttons to workThe included Zotac remote is Windows MCERemote compatible but the additional buttons (Windows, Info, Colored buttons) will not work out of the box. The XBMC MCERemote add-on will fail with: * Warning * The ReportMappingTable registry key is not present * No Microsoft remote is installed Good NewsBut before I begin, if this helps you please do +1 or share it as that helps me.So take the MCERemote registry files, this, this,0 and this thread and a 3 hours and you get a tweaked Zotac Remote Registry Fix below; it labels all keys I could discover and maps some as follow:The Windows remote key to Win keyboard key (perfect if you are running Windows 8)The Colored Buttons to Ctrl 1 through 4The Info button to 'Ctrl D' - XBMC display info[T] Teletext? key to send 'T' - XBMC toggles subtitliesThe '≡' right of 'T' to send 'C' - XBMC display contextual menuCopy and paste the below into a file on your …