Setting up a CraftBukkit Minecraft Server on CentOS


1. Download CraftBukkit's latest build: CraftBukkit - Recommended Build
2. Put the .jar in a folder, for this example we'll use a generic one: ~/craftbukkit
3. Move to the above directory in terminal with 'cd ~/craftbukkit'
4. Create a new file in the minecraft folder and name it
5. Edit the file and paste this into it:
 BINDIR=$(dirname "$(readlink -fn "$0")")
 cd "$BINDIR"
 java -Xms1024M -Xmx1024M -jar craftbukkit.jar -o true
6. Make the file executable, either by running "chmod +x ~/craftbukkit/" in a terminal, or by changing the permissions in the file's properties.
7. Then, in terminal, type '~/craftbukkit/' to run to start the server. 
8. When you're done playing around, issue the "stop" command in console.

If you plan to run the server more permanently an init script like this one (recommended) found here:

Instructions for the server setup:


  1. Symlink the minecraft file to /etc/init.d/minecraft, set the required premissions and update rc.d.

    sudo ln -s ~/minecraft-init/minecraft /etc/init.d/minecraft
    chmod 755  ~/minecraft-init/minecraft
    sudo update-rc.d minecraft defaults
  2. Edit the variables in config.example to your needs and rename it to config (leaving it in the same folder as the original minecraft script)

  3. Move your worlds to the folder specified by WORLDSTORAGE

  4. Edit crontab

    As the server user:

    crontab -e

    Add these lines:

    #m  h   dom mon dow command
    02  05  *   *   *   /etc/init.d/minecraft backup
    55  04  *   *   *   /etc/init.d/minecraft log-roll
    */30    *   *   *   *   /etc/init.d/minecraft to-disk
  5. To load a world from ramdisk run:

    /etc/init.d/minecraft ramdisk WORLDNAME

    to disable ramdisk, run the same command again.

For more help with the script, run

/etc/init.d/minecraft help