"Amigos y nadie más. El resto, la selva"
-- Jorge Guillén

Minecraft server on Ubuntu

From the minecraft-server-properly dept. (9239) (0) by Luis

Minecraft Logo

This is a short article describing how to properly setup a Minecraft server running under Ubuntu desktop under an upstart session for an unprivileged user. For clarity, and brevity, here is the current setup:

After you've downloaded the necessary items, follow these simple steps:

  • You'll need to create a Debian package for Oracle's Java by doing the following from Gnome Terminal:
sudo apt-get install java-package # installs Java packager
cd ~/Downloads # goes to the directory where you downloaded Java tarball
make-jpkg jre-7u60-linux-x64.tar.gz # create .deb package
sudo dpkg -i oracle-java7-jre_7u60_amd64.deb # installs Java
java -version # verifies current version. Be sure this returns a string like java version "1.7.0_60"
  • Create a user account "familia" and set it to automatically login to its desktop (Gnome -> Users. Create user and select to auto-login). Or you may use sudo adduser familia from the Gnome Terminal and then switch to this user account to continue setup
  • Create a directory ~familia/Minecraft and copy the minecraft server .jar into this directory: mkdir ~familia/Minecraft
  • Create a file ~familia/.config/upstart/minecraft.conf with the following content:
cat > ~familia/.config/upstart/minecraft.conf <<-EOF
description "Minecraft server on port 25565"
author "Luis Mondesi <lemsx1@gmail.com>"
start on desktop-start
exec ${XDG_CACHE_HOME:-$HOME}/Minecraft/minecraft_server
  • You may optionally create the following text files: touch ~familia/Minecraft/{ops.txt,white-list.txt}
  • You will also need to agree to the end-user license by editing the eula.txt file with eula=true

At this point your server installation is setup. All we need is the wrapper scripts to allow easy access to the service:

  • Create a wrapper script for the minecraft_server.jar:
cd ~familia/Minecraft
ln -sf minecraft_server.1.7.10.jar  minecraft_server.jar
cat > minecraft_server <<-EOF
cd /home/familia/Minecraft && \
# append "nogui" if you want to run it from the terminal without a GUI
java -Xmx1024M -Xms1024M -jar minecraft_server.jar 2>&1 |zenity --timeout=90 --text-info -
cd -
  • Make the script executable: chmod a+rx minecraft_server
  • Create a .desktop file:
cat > MinecraftServer.desktop <<-EOF
# Minecraft
[Desktop Entry]
Name=Minecraft Server
Name[es]=Servidor de Minecraft
Comment=Serve Minecraft
Comment[es]=Sirve Minecraft
GenericName=Minecraft Server
  • Be sure to download a nifty icon for your .desktop file and call it mc.png. Example Minecraft icon Minecraft server icon
  • Make the .desktop file executable: chmod a+rx MinecraftServer.desktop
  • Make a link to the desktop with: ln -s ~familia/Minecraft/MinecraftServer.desktop ~/Desktop/


New Comment

* optional