How to Setup a Minecraft Server on Debian or Ubuntu OS

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

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

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

# sudo apt-get upgrade

2.Now install screen using the following commands:

# sudo apt-get install screen

Install OpenJDK:

In Debian 8:

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

In Ubuntu 16.04:

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

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

In Debian:

# apt install sudo

Now add user using the following command:

# adduser minecraft

Now give root privileges to added user:

# adduser minecraft sudo

In Ubuntu:

# adduser Minecraft

Now give root privileges to added user:

# adduser minecraft sudo

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:

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

Click on Configure Rules:

Click on Quickly Create Rules:

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

Installation of Minecraft:

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

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

  • Add the following lines in opened file.

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

Now Run Minecraft:

# ./run.sh

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

# sudo nano /home/minecraft/eula.txt

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.