25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >

How to Set Up a Dedicated Minecraft Server on Linux

Posted on by Ronald Caldwell | Updated:
Reading Time: 8 minutes

Introduction that answers the question ‘Can You Run a Minecraft Server on Linux?’

Minecraft is a popular sandbox and adventure game that offers creative and survival challenges as you explore an infinite world with endless modification possibilities.  Mojang studios officially released the game on November 18, 2011, and it quickly experienced explosive popularity. 

Worldwide monthly active users for Minecraft reached 40 million in June 2016. That number climbed to 140 million as of March 2021. However, with so many users accessing Minecraft’s server resources, inconvenient glitches and slow gameplay occasionally frustrate users.

Fortunately, savvy Minecraft enthusiasts could bypass these problems by building their own Linux Minecraft server. All it takes is a little coding knowledge and a few easy-to-follow steps.

Previously, you learned how to create a Minecraft server in five steps for your virtual private server (VPS). You will learn how to set up a dedicated Minecraft server using Linux hosting this time.

Why Should You Set Up Minecraft on a Dedicated Linux Server?

With a dedicated Linux Minecraft server, you have sole use and control over server resources. Processing power, memory, and storage are available specifically for your gameplay without noisy neighbors (shared hosting) or running virtualization (cloud dedicated or bare metal servers). 

Your mods (additions to the game), plugins, and security settings are under your control. You can set up your Minecraft server on Linux how you want without other users making changes to your settings. Controlling server resources and security settings maximizes your performance while eliminating in-game errors due to server overload.

Spinning up your own Linux Minecraft server also affords you a new level of security as you play. Since server resources are all your own, you’re less likely to experience cyber threats. Many users are grateful for the increased security since Minecraft does have some in-game purchases that require sensitive financial information.

Server Requirements

Per the Fandom wiki, several configurations are available, including the minimum and optimal server configurations. Here are the minimum Minecraft server requirements for Linux:

  • One to five players.
  • Intel Pentium 4 2.0 GHz or AMD Athlon-based CPUs and better.
  • 512 MB of RAM.
  • 2 GB of available HDD space (5GB if you are doing frequent backups).
  • Internet connection of 3 Mbps upload speed and 2 Mbps download speed.

Here are the optimal server requirements to run a Minecraft server on Linux:

  • Twenty or more players.
  • Intel i5 or i7 CPUs or AMD Ryzen 5 or 7-based CPUs and better.
  • 6 GB of RAM.
  • 35 GB of available HDD space.
  • Internet connection of 30 Mbps upload speed and 15 Mbps download speed.
Note:
It is recommended to use a solid-state drive (SSD) for additional performance due to faster read/write data speeds.

For the purposes of this article, Minecraft was installed on a Liquid Web Dedicated server with the following configuration:

  • Intel Xeon CPU E3-1230 v5.
  • 4 Core @ 3.40GHz.
  • 16 GB RAM.
  • 500 GB SSD.
  • Operating system is CentOS 7 64-bit.

Steps to Set Up a Dedicated Minecraft Server on Linux

Step 1: Connecting to Your Server

Connect to your server’s console or connect remotely via secure shell (SSH). If you are connecting remotely via SSH, use the following command to log in as the root user.

ssh root@serveripaddress
Note:
Replace serveripaddress with your server’s IP address.

If this is your first time connecting to this server, you will be prompted to confirm you want to connect to a new, previously unknown host. Type yes,and you will be prompted for the root password. Once you enter it, you are logged in as root.

It is recommended to create a separate user account so that if your Minecraft server is compromised, the exploiter does not have access to the root user account. Use the following command to create a user named mcuser.

adduser mcuser

The following command is to set the password for the new user.

passwd mcuser

You will be prompted to enter and confirm the password.

minecraft-dedicated-server-1

Step 2: Update Package Repository and Install Java

You will need to install Java. First, ensure that your package repository is updated using the following command.

minecraft-dedicated-server-2

Next, install Java using the following commands.

Note:
Starting with Minecraft 1.17, the new standard for Java has shifted to Java 16.

You can check that it was installed successfully by confirming the Java version.

java -version

You will see the following output.

minecraft-dedicated-server-3

In order to install Java 16, you need to ensure the server is aware the package is available by updating the epel repository. You will update it with the command below.

yum install -y epel-release

If it is not already installed, you will see the following output.

minecraft-dedicated-server-4

Next, you will install the latest version of Java, which is currently Java 16. Use the following command to install the latest version of Java.

yum install -y java-latest-openjdk
minecraft-dedicated-server-5

While Java 16 is installed, you still need to set it as the default in order for the server to run applications using the latest version. You can accomplish this by using the following command.

alternatives --config java

You will be presented with the versions of Java installed on your server, each with a corresponding number. Choose the appropriate number and press Enter.

minecraft-dedicated-server-6

If you run java -version again, it will show the version number you selected.

minecraft-dedicated-server-7

Step 3: Screen Installation

Install Screen, an application for the console that keeps your server running when you are not connected. To install it, use the following command.

sudo yum install screen

You will confirm install as with installing Java. If it is already installed, you will be informed and returned to the prompt.

minecraft-dedicated-server-8

Step 4: Set Up Your Minecraft Server on Linux

Start by switching users and creating a directory for your Minecraft files. You can call your directory mineserver.

su - mcuser
mkdir mineserver

You will move to that directory with the following command.

cd mineserver
minecraft-dedicated-server-9

Next, you will download the needed configuration files for Minecraft. Visit the Minecraft Java Edition server page, right-click on the Minecraft server .jar link, and copy the link address.

To download the files, you need to use the wget command along with the link to the files. It should look like this.

wget https://launcher.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar
Note:
This URL will change with subsequent releases. Always obtain it directly from the Minecraft download page.

After running the command, the output will let you know the files were saved.

minecraft-dedicated-server-10
Note:
Instead of saving the files to minecraft_server.1.17.1.jar, as it appears on the Minecraft download page, the files are saved to server.jar as in the image above.

Step 5: Start Your Minecraft Server and Play

Start your Minecraft server for the first time by running the following command.

java -Xmx1024M -Xms1024M -jar server.jar nogui

Before the server can start, you will need to accept Mojang’s license terms. To do this, you will need to open the document in your chosen text editor. The example below will use Vim. The following command will open the document.

vim eula.txt
  • Press i to enter Insert mode.
  • Change eula=false to eula=true.
  • Press Escape to exit Insert mode.
  • Type :wq to save your changes and exit the editor.

Once you have accepted the terms, you can start a Screen session and start the Minecraft server again. Type the screen command to start a new terminal session within your current session. Then, type the command you used before to start the Minecraft server.

screen
java -Xmx1024M -Xms1024M -jar server.jar nogui
minecraft-dedicated-server-11

A new random world will be created once booting is completed.

You can press Ctrl+A+D to detach from this Screen session, which will place you back into the original terminal session you had while leaving Minecraft running inside the detached screen. You can log out without stopping the process or use screen -r to reattach it and bring it back to the foreground.

To stop your Minecraft server, type the stop command from the Minecraft Screen session and press Enter.

Note:
If you have issues connecting to the server, ensure that the default port for Minecraft (port 25565) is open in your server’s firewall.

Step 6: Adjust Your Firewall Settings

In addition to ensuring the Minecraft port (port 25565) is open, you’ll need to make some additional adjustments for your firewall to accept Minecraft’s incoming connections. 

First, you’ll need to enable port forwarding for ufw with the following command.

sudo ufw allow 25565

Next, you’ll need to use the iptables feature. If you’re using CentOS version 6.X or older, the iptables function should already be included. Use these commands to enable port forwarding for your iptables.

iptables -I INPUT -p tcp --dport 25565 -j ACCEPT
iptables-save >/etc/sysconfig/iptables

If you’re running a newer version of CentOS, like version 7.X or higher, you’ll need these commands.

firewall-cmd --permanent --add-port=25565/tcp
firewall-cmd --reload

Step 7: Port Your Linux Minecraft Server to a Domain

Now that your Linux Minecraft server is up and running, you can point a domain to it and make it easily accessible. Doing this is a simple process and only requires a quick change to the domain’s DNS records.

Add an A record for your new domain. It should contain these variables:

  • Host: @
  • Value: Your Minecraft server’s IP address
  • TTL: Set to Automatic or 30 minutes

Don’t be alarmed if you go to access your new domain right away and things aren’t working. DNS changes can take 24 hours to update, so be patient.

Final Thoughts

You are now ready to play Minecraft on your newly created Linux Minecraft server. Joining the server is easily done by using your direct IP address.

Managed dedicated server hosting is available through Liquid Web for you to set up a Minecraft server in Linux. You can contact us today to get your server and follow this tutorial once it is built.

Minecraft Server FAQs

Which Linux is best for a Minecraft server?

+

How much RAM do I need to run a Minecraft server?

+

What is the best OS for a Minecraft server?

+

About the Author: Ronald Caldwell

Ron is a Technical Writer at Liquid Web working with the Marketing team. He has 9+ years of experience in Technology. He obtained an Associate of Science in Computer Science from Prairie State College in 2015. He is happily married to his high school sweetheart and lives in Michigan with her and their children.

Latest Articles

PHP 7 vs PHP 8: A Comparison

Read Article

How to Create a Symbolic Link

Read Article

What Is A Private VPS Parent?

Read Article

Managed Hosting vs Unmanaged VPS Hosting

Read Article

Why Is Your IP Address Blocked?

Read Article