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:

1.You must have Alibaba Cloud Elastic Compute Service (ECS). To get free $300 credits in your Alibaba Cloud account "Click Here".
2.You must have a version of game client from https://www.minecraft.net to use your Minecraft server.
3.You should setup your server's hostname.
4.Follow the general instructions to secure your server e.g. activating firewalls.

Minimum Requirements for these settings:

1.Ubuntu 16.04 installed or Debian 8 installed on server
2.2GB RAM required (4GB Recommended)
3.Fast Internet (Provided with every ECS on Alibaba Cloud)

Before you begin:

Before you begin installation of Minecraft on your server, you will have to follow steps below:

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:

To install GNU Screen Packages in Debian or Ubuntu, use the following commands:

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:

Use the following command for installing OpenJDK with GNU Screen Package in Debian 8.

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

In Ubuntu 16.04:

Use the following command for installing OpenJDK with GNU Screen Package 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:

In Debian, sudo is not enabled by default. You have to install sudo first. Use the following command:

# apt install sudo

Now add user using the following command:

# adduser minecraft

Now give root privileges to added user:

# adduser minecraft sudo

In Ubuntu:

In Ubuntu, you don't need to install sudo manually. Just add the user using the following command:

# 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:

1.To install Minecraft, first of all logout from your "root" account by ending SSH session in your SSH client that you are using (In my case, I used putty SSH client.).
2.Login back to via SSH client or VNC console available in your Alibaba Cloud account dashboard as user "minecraft" that we created with root privileges.
3.Now you have to download latest version of the Minecraft Multiplayer Server from https://www.minecraft.net using the following command:

# 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 from https://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.

1. 1. #!/bin/sh
2. 2. BINDER=$(dirname "$(readlink -fn "$0")")
3. 3. cd "$BINDIR"
4. 4. java -Xms1024M -Xmx1536M -jar minecraft_server.1.12.jar -o true

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:

1.When you will run Minecraft server first time using the following command, EULA file will be created and it will exit from running state.

# ./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:

1.Now open your Minecraft client and login. After logging in, select Multiplayer option.
2.Then select Add Server and enter your Alibaba Cloud Elastic Compute Service (ECS) instance IP address or domain name. Then select done.
3.Your server is available now for incoming connections. Select Join Server to connect to the server.

时间: 2024-08-27 00:17:06

How to Setup a Minecraft Server on Debian or Ubuntu OS的相关文章

教你在 Debian 和 Ubuntu 上升级 MySQL

系统管理员的日常工作之一就是升级服务,为服务打上补丁包或升级一些花哨的功能.2013年初,最新的 MySQL 5.6发布,目标是提供更好的性能和扩展能力.如果你对此有点兴趣,倒是可以看看我写的这篇 如何在 Debian 和 Ubuntu 上升级 MySQL. 在这篇教程中,我会假设你已经通过 apt-get 安装了 MySQL.写这篇文章的时候,大部分 Linux 发行版上部署的都是 MySQL 5.5.这里我将向你们介绍如何从 MySQL 5.5升级到5.6. 步骤1:备份 MySQL 配置文

Linux有问必答:如何在Debian或Ubuntu上安装完整的内核源码

Linux有问必答:如何在Debian或Ubuntu上安装完整的内核源码 问题:我需要为我的Debian或Ubuntu下载并安装完整树结构的内核源码以供编译一个定制的内核.那么在Debian或Ubuntu上有什么可行的方法来下载完整的内核源码呢? 在给你的Linux安装完整内核源码之前,先问问自己是否真的需要这样做.如果你仅仅是尝试去编译一个内核模块或是为内核定制驱动,你并不需要完整的内核源码树.你只需要安装一些与内核对应的头文件,这样就足够了. 只有在你需要生成一个定制的内核,而且内核源码中的

Debian和ubuntu软件安装deb包制作指南

deb 格式是 http://www.aliyun.com/zixun/aggregation/33836.html">Debian 系专用安装包格式,配合 APT 软件管理系统,成为了当前在 linux 软件中非常流行的一种安装包.Debian和ubuntu软件安装用的都是deb包. 但是很多人制作deb包时,都是从rpm转为 deb,或者使用dpkg -b 进行转换.虽然这两种方法可以制作出来deb,但是显然很粗糙,今天介绍一下正规方法:使用 debhelper 制作 deb.今天用一

如何在Debian和Ubuntu上安装MariaDB 10

MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个自由开源的分支.它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源. 它被设计来实现 MySQL 的高兼容性.对于初学者,可以阅读 MariaDB vs MySQL 来了解关于它们的特性的更多信息.更重要的是,它被一些大公司/组织使用,比如 Wikipedia.WordPress.com 和 Google plus ,除此之外还有更多的. 在这篇文章中,我将向你们展示如何在 Debian 和

如何在 Debian 和 Ubuntu 上安装 MariaDB 10

MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个自由开源的分支.它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源. 它被设计来实现 MySQL 的高兼容性.对于初学者,可以阅读 MariaDB vs MySQL 来了解关于它们的特性的更多信息.更重要的是,它被一些大公司/组织使用,比如 Wikipedia.WordPress.com 和 Google plus ,除此之外还有更多的. 在这篇文章中,我将向你们展示如何在 Debian 和

阿里云 Linux 系统挂载数据盘:适用系统:Linux(Redhat , CentOS,Debian,Ubuntu)

阿里云 Linux 系统挂载数据盘:   适用系统:Linux(Redhat , CentOS,Debian,Ubuntu)   Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区 Linux 系统挂载数据盘:   适用系统:Linux(Redhat , CentOS,Debian,Ubuntu) *  Linux的云服务器数据盘未做分区和格式化,可以根据以下步骤进行分区以及格式化操作. 下面的操作将会把数据盘划分为一个分区来使用. 1.查看数据盘.在没有分区和格式化数据盘之前

在 Debian 和 Ubuntu 系统上自动安装安全更新

之前已经说过,一些最优秀的系统管理员看上去(注意这里使用的词是 seem(看上去))总是很"懒"的,这句话我再同意不过了. 虽然这句话听起来有点荒谬,但我敢打赌在大多数情况下它是对的-不是因为他们不去做他们原本应该做的事情,而是因为他们已经让系统自动去完成这样的事情了. 对于 Linux 系统来说,一个最关键的需求是为相应的 Linux 版本保持更新最新的安全补丁. 在这篇文章中,我们将讨论如何在 Debian 和 Ubuntu 系统上进行设置,从而实现自动安装或更新重要的安装包或补丁

Debian或Ubuntu等linux发型版上安装完整Linux内核源码教程

我需要为我的Debian或Ubuntu下载并安装完整树结构的内核源码以供编译一个定制的内核.那么在Debian或Ubuntu上有什么可行的方法来下载完整的内核源码呢? 在给你的Linux安装完整内核源码之前,先问问自己是否真的需要这样做.如果你仅仅是尝试去编译一个内核模块或是为内核定制驱动,你并不需要完整的内核源码树.你只需要安装一些与内核对应的头文件,这样就足够了.     只有在你需要生成一个定制的内核,而且内核源码中的一些内核默认设置要被你调整了的情况下,你才需要完整的内核源码树. 这里将

如何在 Debian 和 Ubuntu 系统上自动安装安全更新

之前已经说过,一些最优秀的系统管理员看上去(注意这里使用的词是 seem(看上去))总是很"懒"的,这句话我再同意不过了. 虽然这句话听起来有点荒谬,但我敢打赌在大多数情况下它是对的-不是因为他们不去做他们原本应该做的事情,而是因为他们已经让系统自动去完成这样的事情了. 对于 Linux 系统来说,一个最关键的需求是为相应的 Linux 版本保持更新最新的安全补丁. 在这篇文章中,我们将讨论如何在 Debian 和 Ubuntu 系统上进行设置,从而实现自动安装或更新重要的安装包或补丁