How to Setup a Minecraft Server on Debian or Ubuntu OS

Image for post
Image for post

By Arslan Ud Din Shafiq Alibaba Cloud Tech Share Author

Minecraft is one of the most played games worldwide, with more than 100 million users from all over the world. In a 3D generated place, players explore & build anything that they want. You can play as single player or you can invite your friends to join your server in multiplayer mode.

To setup your own Minecraft server on Debian or Ubuntu, follow the tutorial below. This tutorial is compatible with The World of Color release 1.12.

Note: This guide is tested for Ubuntu 16.04 LTS & Debian 8.

Prerequisites:

Minimum Requirements for these settings:

Before you begin:

1.Login as root user with your root username & password via SSH client (e.g. Putty) or VNC console available in your AliBaba Cloud account dashboard.

2.You will have to update & upgrade your Debian or Ubuntu to latest packages using the following commands:

# sudo apt update && sudo apt upgrade

Image for post
Image for post

Select “install the package maintainer’s version” option and then select OK.

Image for post
Image for post

3.Now you have to setup Java JDK environment & GNU Screen. For this, install OpenJDK & GNU Screen Package. OpenJDK is an open source available implementation of Java.

Install GNU Screen Packages:

1.Update the packages using the following commands:

# sudo apt-get update

Image for post
Image for post

# sudo apt-get upgrade

Image for post
Image for post

2.Now install screen using the following commands:

# sudo apt-get install screen

Image for post
Image for post

Install OpenJDK:

In Debian 8:

# sudo apt install openjdk-8-jre-headless screen

Image for post
Image for post

In Ubuntu 16.04:

# sudo apt install openjdk-8-jre-headless screen

Image for post
Image for post

4.Now you have to create a user with root privileges:

In Debian:

# apt install sudo

Image for post
Image for post

Now add user using the following command:

# adduser minecraft

Image for post
Image for post

Now give root privileges to added user:

# adduser minecraft sudo

Image for post
Image for post

In Ubuntu:

# adduser Minecraft

Image for post
Image for post

Now give root privileges to added user:

# adduser minecraft sudo

Image for post
Image for post

5.If you have activated firewalls, you will have to define a rule in AliBaba Cloud security group for your cloud server to add exception for port 25565. By default, this port is blocked by the firewalls.

To do this follow the given instructions in snapshots:

Go to your Elastic Compute Service section:

Image for post
Image for post

Click on more button for ECS you are making ready for Minecraft Server:

Image for post
Image for post

Click on Configure Rules:

Image for post
Image for post

Click on Quickly Create Rules:

Image for post
Image for post

Add the configurations as shown in screenshot below & click OK.

Image for post
Image for post

Installation of Minecraft:

# wget https://s3.amazonaws.com/Minecraft.Download/versions/1.12/minecraft_server.1.12.jar

Image for post
Image for post

Note: You can replace the above URL with latest release URL. You can check latest release fromhttps://minecraft.net/en/download/server

4.Now you have to create a script to run your Minecraft Server. You can do this as below:

• Open file using the command below:

# sudo nano /home/minecraft/run.sh

Image for post
Image for post
  • Add the following lines in opened file.
Image for post
Image for post
Image for post
Image for post

Note: Xmx & Xms are the flags that are used to define maximum and minimum RAM respectively that will be used by your Minecraft server. Above settings are recommended for AliBaba Cloud’s Elastic Compute Service (ECS) with 2GB RAM. If you have more available RAM, you can modify flag settings according to your desire.

5.Now Press “Ctrl+x”.
6.Now Press “Y”.
7.Now Press Enter Key to save the file.
8.Now make run.sh an executable file by using the following command:

# sudo chmod +x /home/minecraft/run.sh

Image for post
Image for post

Now Run Minecraft:

# ./run.sh

Image for post
Image for post

2.Open eula.txt file using the following command:

# sudo nano /home/minecraft/eula.txt

Image for post
Image for post

3.Now change the value of eula in opened file to “true”.
4.Now Press “Ctrl+x”.
5.Now Press “Y”.
6.Now Press Enter Key to save the file.
7.Now to ensure that your Minecraft Server runs without SSH connection, use the following command to execute run.sh within your GNU Screen session:

# screen /home/minecraft/run.sh

Minecraft Server will create required configurations files & generate Minecraft World.
8.To disconnect yourself from server session without stopping the server, Press “Ctrl+a” & then press “d”. You can resume the screen session using command:
# screen -r

Now Connect to your Minecraft Server:

Reference:

https://www.alibabacloud.com/blog/How-to-Setup-a-Minecraft-Server-on-Debian-or-Ubuntu-OS_p293660?spm=a2c41.11204243.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store