HOW TO CREATE A MINECRAFT SERVER ON UBUNTU 20.04


The creator chosen the Tech Schooling Fund to receive a donation as part of the Write for DOnations program.


Introduction


Minecraft is a popular sandbox video sport. Originally released in 2009, it allows players to construct, discover, craft, and survive in a block 3D generated world. As of late 2019, it was the second best-promoting video game of all time. On this tutorial, you'll create your own Minecraft server so that you just and your friends can play together. Particularly, you'll install the required software packages to run Minecraft, configure the server to run, after which deploy the game.


Alternately, you'll be able to discover DigitalOcean’s One-Click Minecraft: Java Version Server as another set up path.


This tutorial uses the Java model of Minecraft. If you happen to bought your version of Minecraft via the Microsoft App Store, you'll be unable to connect to this server. Most variations of Minecraft purchased on gaming consoles such as the PlayStation 4, Xbox One, or Nintendo Swap are additionally the Microsoft model of Minecraft. These consoles are also unable to connect to the server constructed on this tutorial. You possibly can obtain the Java version of Minecraft here.


Conditions


To be able to comply with this information, you’ll want:


- A server with a contemporary set up of Ubuntu 20.04, a non-root user with sudo privileges, and SSH enabled. You possibly can comply with this information to initialize your server and complete these steps. Minecraft could be resource-intensive, so keep that in mind when choosing your server measurement. If you are utilizing DigitalOcean and want more assets, you can all the time resize your Droplet so as to add more CPUs and RAM.


- A duplicate of Minecraft Java Edition installed on a local Mac, Home windows, or Linux machine.


Step 1 - Putting in the mandatory Software Packages and Configure the Firewall


Along with your server initialized, your first step is to put in Java; you’ll need it to run Minecraft.


Update the package deal index for the APT package manager:


sudo apt replace

Subsequent, install the OpenJDK version 16 of Java, particularly the headless JRE. This is a minimal model of Java that removes the help for GUI purposes. This makes it ideally suited for running Java applications on a server:


sudo apt set up openjdk-16-jre-headless

You also need to use a software known as display screen to create detachable server classes. display lets you create a terminal session and detach from it, leaving the method began on it running. That is necessary because in case you have been to start your server and then shut your terminal, this would kill the session and cease your server. Set up screen now:


sudo apt install display

Now that you have the packages put in we have to allow the firewall to allow traffic to come in to our Minecraft server. In the preliminary server setup that you simply carried out you only allowed traffic from SSH. Now you need to permit for site visitors to come in through port 25565, which is the default port that Minecraft uses to permit connections. Add the required firewall rule by working the following command:


sudo ufw allow 25565

Now that you've Java put in and your firewall correctly configured, you will obtain the Minecraft server from the Minecraft website.


Step 2 - Downloading the most recent Model of Minecraft


Now you might want to obtain the current version of the Minecraft server. You may do that by navigating to Minecraft’s Web site and copying the hyperlink that says Download minecraft_server.X.X.X.jar, the place the X’s are the newest model of the server.


You can now use wget and the copied hyperlink to download the server:


wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar

When you intend to improve your Minecraft server, or if you wish to run totally different versions of Minecraft, rename the downloaded server.jar to minecraft_server_1.15.2.jar, matching the highlighted model numbers to whatever version you simply downloaded:


mv server.jar minecraft_server_1.15.2.jar

If you wish to obtain an older version of Minecraft, yow will discover them archived at mcversions.net. But this tutorial will concentrate on the present newest launch. Now that you've your download let’s begin configuring your Minecraft server.


Step three - Configuring and Running the Minecraft Server


Now that you've got the Minecraft jar downloaded, you're ready to run it.


First, begin a display session by running the screen command:


screen

Upon getting learn the banner that has appeared, press the Area bar. display will current you with a terminal session like normal. This session is now detachable, which implies that you’ll be ready to begin a command right here and go away it operating.


You can now perform your preliminary configuration. Don't be alarmed when this subsequent command throws an error. Minecraft has designed its installation this fashion so that customers should first consent to the company’s licensing settlement. You'll do this subsequent:


1. java -Xms1024M -Xmx1024M -jar minecraft_server_1.15.2.jar nogui


Earlier than inspecting this command’s output, let’s take a closer look at all these command-line arguments, that are tuning your server:


- Xms1024M - This configures the server to begin working with 1024MB or 1GB of RAM running. You may elevate this restrict if you would like your server to start out with more RAM. Both M for megabytes and G for gigabytes are supported choices. For instance: Xms2G will begin the server with 2 gigabytes of RAM.


- Xmx1024M - This configures the server to make use of, at most, 1024M of RAM. You possibly can increase this limit in order for you your server to run at a larger size, allow for more players, or if you are feeling that your server is running slowly.


- jar - This flag specifies which server jar file to run.


- nogui - This tells the server not to launch a GUI since it is a server, and also you don’t have a graphical user interface.


The first time you run this command, which normally starts your server, it is going to as an alternative generate the next error:


These errors had been generated as a result of the server couldn't find two vital information required for execution: the EULA (Finish User License Agreement), found in eula.txt, and the configuration file server.properties. Fortunately, because the server was unable to search out these information, it created them in your current working directory.


First, open eula.txt in nano or your favourite text editor:


nano eula.txt

Inside this file, you will notice a link to the Minecraft EULA. Copy the URL:


Open the URL in your internet browser and browse the agreement. Then return to your textual content editor and find the final line in eula.txt. Here, change eula=false to eula=true. Now save and shut the file.


Now that you’ve accepted the EULA, it's time to configure the server to your specifications.


In your present working directory, you will also find the newly created server.properties file. This file contains all of the configuration options for your Minecraft server. Yow will discover a detailed listing of all server properties on the Official Minecraft Wiki. You'll modify this file along with your preferred settings before starting your server. This tutorial will cover the fundamental properties:


nano server.properties

Your file will appear like this:


Let’s take a better take a look at some of crucial properties in this list:


- difficulty (default easy) - This sets the issue of the sport, reminiscent of how much harm is dealt and how the elements affect your participant. The options are peaceful, simple, normal, and exhausting.


- gamemode (default survival) - This sets the gameplay mode. The choices are survival, creative,journey, and spectator.


- level-identify (default world) - This units the name of your server that can seem in the client. Characters such as the apostrophe might have to be escaped with a backslash.


- motd (default A Minecraft Server) - The message that's displayed in the server checklist of the Minecraft shopper.


- pvp (default true) - Permits Player versus Player combat. If set to true, gamers will probably be in a position to interact in fight and harm one another.


After you have set the choices that you want, save and close the file.


Now that you have modified EULA to true and configured your settings, you can efficiently begin your server.


Like final time, let’s start your server with 1024M of RAM. Only now, let’s also Minecraft adventure servers to use as much as 4G of RAM if it wants it. Remember, you're welcome to regulate this number to suit your server limitations or person needs:


1. java -Xms1024M -Xmx4G -jar minecraft_server_1.15.2.jar nogui


Give the initialization a number of moments. Soon your new Minecraft server will start producing an output similar to this:


As soon as the server is up and operating, you will note the following output:


Your server is now running, and you've got been dropped into the server administrator control panel. Now kind help:


help

An output like it will appear:


From this terminal you possibly can execute administrator commands and management your Minecraft server. Now let’s use screen to maintain your new server operating, even after you log out. Then you possibly can connect to your Minecraft client and start a brand new game.


Step 4 - Keeping the Server Operating


Now that you've got your server up, you want it to remain working even after you disconnect from your SSH session. Since you used display earlier, you can detach from this session by urgent Ctrl + A + D. Now you’re again in your unique shell.


Run this command to see all of your display screen periods:


display -record

You’ll get an output with the ID of your session, which you’ll need to resume that session:


To resume your session, go the -r flag to the screen command and then enter your session ID:


display -r 26653

When you find yourself able to log out of your server, make sure you detach from the session with Ctrl + A + D after which log out.


Step 5 - Connecting to Your Server from the Minecraft Shopper


Now that your server is up and operating, let’s hook up with it via the Minecraft shopper. Then you can play!


Launch your copy of Minecraft Java Edition and choose Multiplayer in the menu.


Next, you will want to add a server to connect to, so click on the Add Server button.


Within the Edit Server Data display that reveals up, give your server a name and kind within the IP address of your server. This is similar IP deal with that you used to attach by SSH.


Upon getting entered your server identify and IP address, you’ll be taken again to the Multiplayer screen where your server will now be listed.


From now on, your server will at all times seem on this list. Select it and click on Be part of Server.


You're in your server and ready to play!


You now have a Minecraft server working on Ubuntu 20.04 for you and all of your friends to play on! Have enjoyable exploring, crafting, and surviving in a crude 3D world. And remember: watch out for griefers.


Created: 07/07/2022 00:36:58
Page views: 60
CREATE NEW PAGE