How to install Minecraft server on Ubuntu

How to install Minecraft server on Ubuntu


Ready to embark on a Minecraft adventure right from your own Ubuntu machine? This cheerful guide will walk you through the quick steps of setting up your very own Minecraft server using simple command lines. Whether you’re a Java aficionado or a CLI newbie, you’ll find everything you need to know about adding repositories, installing the right Java version, and launching your Minecraft server. Let’s dive into the fun part and get your server up and running in no time!

This is a very simple task. You"ll need 3 things: a machine with Ubuntu, Java and the Minecraft server .jar file

In this tutorial we will use command lines, which is much better than GUI! 😉

Before you begin, one last note: the PPA repository of Java8 and 9 is maintained by the Webudp8 Team. They take care to get the new releases and make it all easy for you.

If you"re not already on a terminal window, press Ctrl+Alt+T to open it.

Part 1: Installing Java.

Add the new repository:

<pre class="toolbar:2 lang:default highlight:0 decode:true">sudo add-apt-repository ppa:webupd8team/java

Update index packages:

<pre class="toolbar:2 lang:default highlight:0 decode:true">sudo apt update

Install Java:

<pre class="toolbar:2 lang:default highlight:0 decode:true">sudo apt install oracle-java8-installer

Check the installed version:

<pre class="toolbar:2 lang:default highlight:0 decode:true">javac -version

This repository also comes with a package that set the environment variables for you. (Handy, isn"t it?)

<pre class="toolbar:2 lang:default highlight:0 decode:true">sudo apt install oracle-java8-set-default

Note: For some reason, if you want to install Java9 instead of 8, just change java8 to java9 on the above commands.

Part 2: Installing the actual Minecraft server.

First of all, you have to decide which Minecraft “distro” you want to install. We have 3 suggestions, but you"re free to chose another:

  • CraftBukkit: Modified version. Has support for plugins;
  • Spigot: by far, one of the most widely used versions of the server;
  • Vanilla: official version. Pristine, not modified edition… that doesn"t support plugins;

Create a directory for the server and go to it:

<pre class="toolbar:2 lang:default highlight:0 decode:true">mkdir minecraft_server
cd minecraft_server

Place the downloaded server .jar file in the directory we just created. For this example we will supose that the server file is named minecraft_server.jar

<pre class="toolbar:2 lang:default highlight:0 decode:true">java -Xms1024M -Xmx2024M -jar minecraft_server.jar

In the above command, the -Xms1024M and -Xmx2048M indicate, respectively, the minimum and maximum amount of RAM the server can occupy. Remember that Minecraft does not require that much memory. The important thing to keep in mind is the latency of the connection.

Once you"ve ran that command, the server will start and display several lines of texts that looks something like this:

<pre class="toolbar:2 lang:default highlight:0 decode:true">Loading libraries, please wait...
[20:37:40 INFO]: Starting minecraft server version 1.11.2
[20:37:41 INFO]: Loading properties
[20:37:41 INFO]: Default game type: SURVIVAL
[20:37:41 INFO]: This server is running CraftBukkit version git-Spigot-6de2fbc-16b5116 (MC: 1.11.2) (Implementing API version 1.11.2-R0.1-SNAPSHOT)
[20:37:41 INFO]: Server Ping Player Sample Count: 12
[20:37:41 INFO]: Using 4 threads for Netty based IO
[20:37:41 INFO]: Debug logging is disabled
[20:37:41 INFO]: Generating keypair
[20:37:41 INFO]: Starting Minecraft server on *:25565
[20:37:42 INFO]: Using default channel type
[20:37:42 INFO]: View Distance: 32
[20:37:42 INFO]: Zombie Aggressive Towards Villager: true
[20:37:42 INFO]: Experience Merge Radius: 3.0
[20:37:42 INFO]: Nerfing mobs spawned from spawners: false
[20:37:42 INFO]: Preparing start region for level 0 (Seed: 2119701282465403294)
[20:37:43 INFO]: Preparing spawn area: 2%
[20:37:44 INFO]: Preparing spawn area: 18%
[20:37:45 INFO]: Preparing spawn area: 53%
[20:37:46 INFO]: Preparing start region for level 1 (Seed: 2119701282465403294)
[20:37:47 INFO]: Preparing spawn area: 54%
[20:37:48 INFO]: Preparing start region for level 2 (Seed: 2119701282465403294)
[20:37:49 INFO]: Server permissions file permissions.yml is empty, ignoring it
[20:37:49 INFO]: Done (7.200s)! For help, type "help" or "?"

At this time, a command prompt will be available to you. Your server is now ready to use.

If you want to stop it, use the command stop on the prompt.

It is highly recommended that you change the file and use the whitelist. json.

Next Steps? How about making the server autostart with your machine?

Did I miss something? Please, tell me in the comments bellow.