Setting up CraftBukkit Minecraft Server

CraftBukkit is a modified version of the Minecraft Server that implements a framework for extending the server with plugins. We'll cover a good Bukkit Minecraft server setup in a Debian based distribution.

Join the DevDungeon Minecraft server at:

minecraft.devdungeon.com

Preparation

  • Download the craftbukkit jar
  • Download plugins and put them in the plugins/ folder.

Running

You can run manually with java -jar bukkit.jar. This is OK if you want to quickly test it, but I suggest using the startup script available on the page http://www.minecraftwiki.net/wiki/Tutorials/Server_startup_script. This is intended for systems that use the /etc/init.d/ style of startup like Debian based GNULinux distributions. You can update the rc.d to run minecraft on boot by running update-rc.d minecraft defaults, assuming you already created and configured your /etc/init.d/minecraft script. If you do not know how to customize the script you will need to go do some more homework.

The script requires screen which allows you get in to the virtual console. Don't forget, you might need to su to the minecraft user to reconnect the screen. It's not necessary to reconnect to the screen though. You can send a command directly with service minecraft command "Say Hello, World". You can backup your world, if you set up the directories and permissions properly, by running service minecraft backup. You can also do the standard service type things like status, start, stop, restart and update.

Additional security

If you want to tighten up permissions and isolate the minecraft server permissions you can create a minecraft user and home folder. To prevent anyone except minecraft or root priveliged users from snooping around the minecraft server settings or logs you can run chmod o= -R /home/minecraft. There are also few CraftBukkit plugins that help prevent cheating and griefing on the minecraft server.

Noteworthy Plugins

A couple good plugins to get started with are:

  • PermissionsEx - For ACL type permissions used by many other plugins
  • WorldEdit - edit the world with brushes and commands - good for manipulating large areas
  • WorldGuard - protect areas and anti-grief tool
  • CommandBook - collection of tools including Homes, Teleport, New player equipment kits

Basic Server Commands

You can run server commands by connecting to the screen or by using the /etc/init.d script ot send the command like sudo service minecraft command "say hi". You can also run them in game by typing /command. You will require the priveliges as a regular user in game.

  • say something
  • kick nanodano ur a jerk
  • reload
  • Any commands available from plugins.

Using cron to make backups

Use the init.d script and cron together to make backups specified in the rc.d script location. Add a line like 14 * * * * /etc/init.d/minecraft backup to your /etc/crontab (crontab -e).

Setting up permissions

There are two ways you can set up admin permissions and I suggest using one or the other but not both. Most plugins have an option to grant all permissions to op users. If you turn this option on for all your plugins then you don't need to create an admin group in PermissionsEX you just grant someone op privileges. The advantage is simple management but the drawback is less control over permissions. If you want more control I suggest creating an admin group with pex group admin create. You can then add a user to the group, and grant them all PEX permissions so they can manage groups, users, and permissions from within the game. Add a user to a group with /pex group admin user add nanodano. Grant all PermissionsEx permissions with group admin add permissionsex.*. Add other permissions in a similar way. Don't forget to grant default users permissions, but be careful which permissions they get!

Useful bash tips

If you are managing the server mostly through the command line instead of through the game client, there are a couple things that will make your life easier. First, make an alias for running commands on the server with alias mcdo='sudo service minecraft command'. If you are using the init.d script to run the server it should be running in a detached screen session. Depending on your setup you might find that you can't reconnect to the screen because of /dev/pts permissions. There is a workaround using the script program from bsdutils. You can run sudo -u minecraft script /dev/null, this will essentially run a shell with a pseudotty that will let you run screen -r to get back in to your screen.