How to install minecraft server on ubuntu

The Minecraft craze began in 2009, and while it may not be as popular as it once was, it still has some influence. It continues to rank among the most widely played video games in history. But installing a Minecraft server isn’t just for entertainment; it’s also a great way to show new administrators how to use Linux and bring fun to your local area network.

In this tutorial, I’ll walk you through setting up a Minecraft server on Ubuntu Server 22. 04 in order to put your staff’s young Linux administrators to the test and give them a way to let off steam inside of your local network.

You must have an active instance of Ubuntu Server 22 in order to follow along. 04 and a user with sudo privileges. That’s it.

Set up your Minecraft server on Linux: Step-by-step (Ubuntu 20.04)
  1. Step 1: Install additional software components. …
  2. Step 2: Enable Minecraft server port. …
  3. Step 3: Install Minecraft server application (Java edition) …
  4. Step 4: Running the server application for the first time. …
  5. Step 5: Configure server.

Not using Ubuntu 204 ?Choose a different version or distribution. Ubuntu 204

The author selected the Tech Education Fund to receive a donation as part of the Write for DOnations program.

Minecraft is a popular sandbox video game. Originally released in 2009, it allows players to build, explore, craft, and survive in a block 3D generated world. As of early 2022, it was the best-selling video game of all time. In this tutorial, you will create your own Minecraft server so that you and your friends can play together. Specifically, you will install the necessary software packages to run Minecraft, configure the server to run, and then deploy the game.

Alternative installation options include the One-Click Minecraft: Java Edition Server from DigitalOcean.

This tutorial uses the Java version of Minecraft. If you purchased your version of Minecraft through the Microsoft App Store, you will be unable to connect to this server. Most versions of Minecraft purchased on gaming consoles such as the PlayStation 4, Xbox One, or Nintendo Switch are also the Microsoft version of Minecraft. These consoles are also unable to connect to the server built in this tutorial. You can obtain the Java version of Minecraft here.

In order to follow this guide, you’ll need:

  • A server with a fresh installation of Ubuntu 22. 04, a non-root user with sudo privileges, and SSH enabled. You can complete these steps and initialize your server by following this guide. When choosing the size of your server, keep in mind that Minecraft can be resource-intensive. You can always resize your Droplet to add more CPUs and RAM if you use DigitalOcean and need more resources.
  • an instance of Minecraft Java Edition running locally on a Mac, Windows, or Linux computer

Step 1 — Installing the Necessary Software Packages and Configure the Firewall

With your server initialized, your first step is to install Java; you’ll need it to run Minecraft. By default, Ubuntu 22.04 does not provide a recent enough version of Java in order to run the newest releases of Minecraft. Fortunately, there are third-party maintainers who continue to build newer Java packages for older Ubuntu releases, and you can install them by adding their PPA, or Personal Package Archives, to your own list of package sources. You can do that with the following command:

Next, update your package sources to reflect this addition:

Press Y when prompted to confirm. Press ENTER to accept the defaults and carry on if you’re asked to restart any services.

Finally, install the OpenJDK version 17 of Java, specifically the headless JRE. This is a minimal version of Java that removes the support for GUI applications. This makes it ideal for running Java applications on a server:

In order to create detachable server sessions, you also need to use the program screen. Create a terminal session using screen, then disconnect from it to continue the process you started there. This is crucial because if you start your server and then close your terminal, the session would end and your server would stop. Install screen now:

Once the packages have been installed, we must enable the firewall so that traffic can reach our Minecraft server. When you first set up the server, you only let ssh traffic through. Now you must permit traffic to enter the system through port 25565, which is the standard port that Minecraft uses to accept connections. ufw will occasionally use named traffic rules, such as for ssh, which always uses port 22, but in less frequent circumstances, like this one, we’ll manually specify the port number. Add the necessary firewall rule by running the following command:

Once Java is set up and your firewall is configured properly, you can download the Minecraft server application from the Minecraft website.

Step 2 — Downloading the Latest Version of Minecraft

Now you need to download the current version of the Minecraft server. You can do this by navigating to Minecraft’s Website and copying the link that says Download minecraft_server.X.X.X.jar, where the X’s are the latest version of the server.

The server application can now be downloaded to your server using wget and the copied link:

The server app will be downloaded as server. jar. It might be useful to rename the downloaded server if you ever need to manage different versions of Minecraft or if you want to update your Minecraft server. jar to minecraft_server_1. 18. 2. jar, comparing the version numbers in bold to the one you just downloaded:

If you want to download an older version of Minecraft, you can find them archived at mcversions.net. But this tutorial will focus on the current latest release. Now that you have your download, let’s start configuring your Minecraft server.

Step 3 — Configuring and Running the Minecraft Server

You are now prepared to launch Minecraft after downloading its jar file.

First, start a screen session by running the screen command:

Press the Spacebar after reading the displayed banner. screen will present you with a terminal session like normal. As of right now, this session is detachable, allowing you to run a command and leave it running.

You can now perform your initial configuration. Do not panic if the following command returns an error. The way that Minecraft is installed requires users to first agree to the company’s licensing terms. You will do this next:

Let’s take a closer look at all these command-line arguments that are tuning your server before examining the output of this command:

  • Xms1024M – Sets the server to launch with 1024 MB or 1 GB of RAM running. If you want your server to start with more RAM, you can increase this cap. The supported options are M for megabytes and G for gigabytes. The server will start with 2 gigabytes of RAM, for instance: Xms2G
  • Xmx1024M – This instructs the server to only use 1024M of RAM at a time. If you want your server to run at a larger size, enable more players, or if you think it is operating slowly, you can raise this limit. Java programs are distinctive in that you must always specify the amount of memory they can use at a time.
  • jar – The server jar file to run is specified by this flag.
  • Given that this is a server and you lack a graphical user interface, nogui instructs the server not to launch a GUI.

When you run this command for the first time, which normally starts your server, you will see the following output:

These errors were caused by the server’s inability to locate two crucial files: the EULA (End User License Agreement), located in eula txt, and the configuration file server. properties. The server created these files in your current working directory because it couldn’t find them elsewhere. Intentionally, Minecraft does this to confirm that you have read and accepted its EULA.

Open eula.txt in nano or your favorite text editor:

There is a link to the Minecraft EULA in this file. Copy the URL: ~/eula. txt.

Read the agreement by accessing the URL in your web browser. Afterward, go back to your text editor and locate the final line of eula. txt. Here, change eula=false to eula=true. Then, save and close the file. To do this in nano, press “Ctrl X” to exit, “Y” to save, then “Enter” when prompted.

You can now configure the server to your preferences after agreeing to the EULA.

In your current working directory, you will also find the newly created server.properties file. This file contains all of the configuration options for your Minecraft server. You can find a detailed list of all server properties on the Official Minecraft Wiki. You should modify this file with your preferred settings before starting your server. This tutorial will cover some fundamental settings:

Your file will appear like this: ~/server.properties

Let’s examine some of the most significant characteristics on this list in more detail:

  • Setting the game’s difficulty determines factors like how much damage is dealt and how the environment affects your character. difficulty (default easy) The options are peaceful, easy, normal, and hard.
  • gamemode (default survival) – This sets the gameplay mode. The options are survival, creative,adventure, and spectator.
  • level-name (default world) sets the server name that will be displayed in the client for you. Backslashes may be required to be used before special characters like apostrophes. When special characters might not otherwise be parsed correctly in context, this is known as escaping characters and is a common practice.
  • The message that appears in the server list of the Minecraft client is called motd (default A Minecraft Server).
  • pvp (default true) – Enables Player versus Player combat. Players can engage in conflict and inflict damage on one another if the value is set to true.

Once you have chosen your preferences, save and exit the file.

Now you can successfully start your server.

Let’s start your server with 1024M of RAM, just like last time. You should this time allow Minecraft to use up to 4G of RAM if necessary. Remember that you are free to change this number to accommodate any server or user requirements:

Give the initialization a few moments. Your new Minecraft server will soon begin generating output resembling this:

When the server is operational, you will see the output listed below:

Your server is now operational, and the server administrator control panel has been displayed to you. Try typing help:

Output like this will appear:

You can manage your Minecraft server and issue administrator commands from this terminal. After you log out of the terminal, you will learn how to use screen to keep your Minecraft server running. You can then launch the Minecraft client and begin a new game.

Step 4 — Keeping the Server Running

Now that your server is running, you want it to continue doing so even after you end your SSH session. You can end this session since you previously used screen by pressing Ctrl A D. You should see that you’re back in your original shell:

Run this command to see all of your screen sessions:

To resume that session, you’ll need the output containing the session ID:

Pass the -r flag to the screen command and then type your session ID to resume your session:

Make sure to disconnect from the session with Ctrl A D before logging out of the terminal once more when you’re prepared to do so.

Step 5 — Connecting to Your Server from the Minecraft Client

Let’s connect to your server using the Minecraft client now that it is operational. Then you can play!.

Launch the Minecraft Java Edition program and choose Multiplayer from the menu.

After that, click the Add Server button to add a server to connect to.

Give your server a name and enter its IP address in the Edit Server Info screen that appears. The IP address you used to connect via SSH is still the same one.

You will be returned to the Multiplayer screen where your server will now be listed after entering your server name and IP address.

Your server will now consistently show up on this list going forward. Select it and click Join Server.

You are in your server and ready to play!

You now have a Minecraft server running on Ubuntu 22. Enjoy exploring, creating, and surviving in a basic 3D world with all of your friends on version 04! And remember: watch out for griefers.

Thanks for learning with the DigitalOcean Community. View our services for managed databases, networking, storage, and computing.

Try DigitalOcean for free

To sign up and receive $200 in credit to try our products over a 60-day period, click here.

Join the Tech Talk

Please complete your information!

Ubuntu 20.04 | Install & Setup a Minecraft Server

FAQ

How to install a Minecraft server on Linux?

Step 1: Connecting to Your ServerHow to Set Up a Dedicated Minecraft Server on Linux Step 2: Update Package Repository and Install Java. Step 3: Screen Installation. Step 4: Set Up Your Minecraft Server on Linux. Step 5: Start Your Minecraft Server and Play. Step 6: Adjust Your Firewall Settings.

How do I create a 1.17 Minecraft server Ubuntu?

Install MinecraftClose the SSH session you’re in now, then sign back into your Linode account as the minecraft user. Create a script to run the Minecraft server: File: /home/minecraft/run. sh. 1 2 3. #!/bin/sh java -Xms1024M -Xmx1536M -jar minecraft_server. 1. 17. jar -o true. Note. Make run. sh executable: chmod +x /home/minecraft/run. sh.

How do I open a port on my Minecraft server Ubuntu?

How to Port Forward Minecraft?Set the Port on Minecraft Configuration. Open the Minecraft server directory and locate the server. properties file: . Allow the Port on Your Firewall. Forward the Port on the Router. Restart the Minecraft Server and Connect.

How to setup Ubuntu server?

Install Ubuntu ServerRequirements. Boot from install media. Choose your language. Choose the correct keyboard layout. Choose your install. Configure storage. Select a device. Confirm partitions.

Leave a Comment