How to Install and run Minecraft on a Linux VPS

Debian based distributions are recommended for easiest installations.

Prerequisites

Start by installing the latest version of java.

You can check if you already have the latest version by running java -version

Debian, Ubuntu

sudo apt-get update
sudo apt-get install openjdk-7-jre screen

CentOS, Redhat, Fedora

yum update
yum install java-1.7.0-openjdk screen

You should also install screen so you can access the console as needed without having to worry about keeping the console open

Spigot Server

Run the following commands:

cd /home
wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar
export MAVEN_OPTS="-Xmx2G"
java -Xmx2G -Dmac.supported=true -jar BuildTools.jar
rm -f BuildTools.jar

To start the Spigot Service in a screen session:

screen -S spigot
java -Xmx1024M -Xms1024M -jar spigot.jar

Once it has been started, press ctrl+a+d to detach from the screen.

You can reattach to the console by running:

screen -r spigot

Minecraft Classic

Run the following commands:

cd /home
wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.8.1/minecraft_server.1.8.1.jar

Before you can start using Minecraft, you must edit the eula.txt file and change false to true.

To start the Minecraft service in a screen session:

screen -S minecraft
java -Xmx1024M -Xms1024M -jar minecraft_server.jar

Once it has been started, press ctrl+a+d to detach from the screen.

You can reattach to the console by running:

screen -r minecraft