Raspberry Pi Tutorial: Host A Minecraft Server On Ubuntu Desktop

Welcome to the second in our sequence of Linux gaming posts within the run up to the holidays. This week, we’ve put collectively a tutorial that teaches you learn how to create a basic Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you possibly can play domestically with your pals.


This is a good afternoon venture to work on with a buddy or household member!


Hosting a Minecraft server unlocks a tonne of further management over the way you play Minecraft with your mates. You can change the game guidelines and problem, the behaviour of enemies and decide how players work together.


Setting up a server is also a fantastic strategy to study extra about Linux. Linux is all about tinkering and attempting new things. While it may appear intimidating at first, the instructions you’ll follow for this venture will aid you approach more complicated Linux tasks in the future!


On this tutorial, we’ll be utilizing a Raspberry Pi 4 4GB with a 32GB SD card, however you may as well follow alongside on just about any laptop computer or Pc that has Ubuntu Desktop installed. Cubepack88 You possibly can even use a Digital Machine.


Take a look at these tutorials for getting started with Ubuntu Desktop on these platforms:


Computer tutorial

VirtualBox tutorial

Raspberry Pi tutorial


Note: We’ll be using Ubuntu Desktop 21.10 for Raspberry Pi in this tutorial, and recommend you comply with along with Ubuntu Desktop 21.10 on whatever device you utilize.


Of course, you’ll also want one other Laptop or laptop computer with Minecraft Java Version installed so you can hook up with your server as soon as you’ve created it!


Let’s jump in.


Set up Ubuntu in your Raspberry Pi and update


If you’ve adopted the Raspberry Pi installation tutorial, you’ll be pretty much able to go, but whenever we begin a new venture, it’s at all times essential to make sure every little thing is up to date.


Go ahead and open a terminal (ALT+T or click the Terminal icon in your sidebar) and sort:


Enter your password and press Y when prompted.


This may verify whether or not your model of Ubuntu is up to date and download and install any new packages.


Set up Java


Minecraft servers are based on Minecraft Java Version, the original version of Minecraft, so our subsequent step is to put in Java on our Raspberry Pi. The default Java on Ubuntu is older than the one used for Minecraft Servers, so we need to specifically install the most recent Java Runtime Surroundings (jre), which is model 18:


Type your password and press Y when prompted.


Create a folder in your server


Now you want a place to place the Minecraft server on your Pi. We might do it the ‘Windows’ means by opening the file manager, right-clicking, and creating a brand new Folder named Minecraft. However we’re already within the terminal, so let’s keep typing right here!


The above will do exactly the identical factor as using the file manager. In actual fact, you may check the file manager yourself to affirm that the new folder has appeared!


Since we’re going to install our server inside the new folder, we need to inform our terminal that we’re going to work there.


In case you kind


You possibly can see that we’re nonetheless in the house listing of our Pc. You’ll see your Documents and Downloads folders, as well as the brand new Minecraft folder you created. To get inside this folder, we'd like to change Directory (cd), so sort:


If you happen to kind ls again, you can see that now nothing is returned, because we’re inside an empty folder. You’ll additionally see that your immediate now consists of the Minecraft folder title:


Download Minecraft Server!


Depart your terminal open, but now you also must open your net browser.


In your browser, go to this page: https://www.minecraft.web/en-us/download/server


We wish to obtain the server linked right here, but as an alternative of left-clicking it, let’s Right-Click on and select Copy Link.


This will be sure to all the time get the most recent version of the server when following this tutorial!


Leave that page open, as we’ll come again to it shortly. Now return to the terminal window, ensuring we’re still within the Minecraft folder, and inform the terminal to download the server to this folder.


And then Proper-Click on and Paste the hyperlink to the server. It should look something like this:


Then press ENTER. This command instructs your Pi to ‘get’ (download) no matter file is linked at that web tackle you gave it.


You will note the obtain complete, and should you then kind:


You’ll see we now have a server.jar file in our Minecraft folder!


Start your server!


Return to https://www.minecraft.net/en-us/download/server, and this time copy the Java directions listed into your terminal.


Press ENTER and… Error??


That’s as a result of we just informed our Pi to run a file known as minecraft_server.1.18.jar, but you'll be able to see from our final ls that after we installed the server it was simply called server.jar.


That’s a simple fix.


If you happen to press UP on the keyboard, your last instruction can be repeated. Do this now, after which edit the filename to server.jar and press ENTER again.


Success!


Sort of. Now we have now another error. We need to conform to the tip Consumer License Settlement (EULA) earlier than we can get started.


So where’s the EULA?


Well let’s use our trusty


on our Minecraft listing another time. You’ll see the installation course of has created a set of recent information. This is nice, as a result of these files are what allows us to play around with the game guidelines! However before we will get to the fun stuff, let’s sign the EULA.


We are able to do that instantly within the terminal (you can do everything within the terminal, that’s why it’s so cool) utilizing a text editor referred to as nano. Sort:


This may open the eula.txt file in your terminal window. Now you simply want to vary the eula line to true as an alternative of false.


Then we press CTRL+S to save lots of and CTRL+X to exit again to the Command Line.


Let’s try the server again!


In case you press UP a number of occasions on your keyboard, we are able to repeat the instruction from earlier without typing it out once more.


However let’s make one final change before we run issues and double the -Xmx1024M and -Xms1024M in our command to -Xmx2048M and -Xms2048. Xmx and Xms consult with the amount of memory the server will use. The more we give it, the higher the performance.


Now we press ENTER once more and the server should start properly!


This next bit goes to take a while. And you in all probability won’t be able to browse Fb whilst you’re waiting, as most of the Raspberry Pi can be focussed on standing up the server.


Once your server has finished organising, you’ll probably get a few messages like this depending on how much reminiscence you assigned it in the previous command. It’s normal to have a few of these at startup whatever happens, so don’t fear too much.


Prime Tip: Better hardware means a better server. If you’re contemplating holding your server around, or using it with a lot of people, an 8GB Raspberry Pi 4 (with elevated Xmx and Xms numbers) will carry out better. Attaching an SSD through a USB3.0 port can even help.


Eventually, as players be part of, you’ll be capable of see key occasions appear on the terminal as they occur in the game world.


Ouch.


You can stop your server any time by typing


within the Terminal. This may even save your world so you possibly can resume again at a later time.


Joining the Minecraft server over your local community


If you’ve invited your pals to affix your server on their laptops, they’re probably a bit impatient to get going by now. But we’re finally ready!


On your (or your friend’s) laptop computer or Laptop, ensure that you are running the Java Edition of Minecraft (which you can install from the official Minecraft site - just obtain it and double-click on).


Then they need to navigate to Multiplayer > Direct Connection.


Now they should enter the local IP tackle of the server which is… hmmm. We don’t know.


Let’s return to our server terminal!


To search out out the server’s native IP, it's essential open a second terminal window, or a brand new tab in the current terminal (or simply stop your server for this bit and restart it after).


This can produce a string of numbers, however you solely need the first set.


Trying at the above, my local IP is 192.168.1.222. Yours will likely be similar however not the same.


So that’s what my guests should add of their games:


As soon as your company have entered your server IP, they just need to click on Join Server and they’re in!


Unfortunately for my server, I spawned right next to a spider. And it was raining.


Modifying your Server Settings


If you want to play common Minecraft regionally with your friends, then you’re all executed - congratulations! But the very best a part of operating a server is you can play god with the game world!


Let’s shut the server (stop, remember?) and do some tweaking.


This time, we need to do the same thing as we did to sign the EULA but this time we’re going to edit a file called server.properties (you might have noticed it the last time we used ls).


Type:


This should deliver up all the configuration options on your server. In the event you scroll down there’s quite a few!


I won’t go into element on every option, but you can read about them on the Minecraft Wiki.


Personally, I just need to show off the spiders and change the server’s message of the day, so I’m going to make the next tweaks:


Simply as earlier than, we press CTRL+S after which CTRL+X to avoid wasting and exit!


Top Tip: If you need to start out a new Minecraft server, simply delete the World folder from your Minecraft listing, or rename the extent-identify in server.properties. It will create a new gameworld folder with the up to date title subsequent time the server starts, and you'll switch back to the old one any time!


Connecting to your Minecraft server remotely


In this project, we’ve proven you find out how to arrange and customise a Minecraft server on your Raspberry Pi 4, and how players on the identical Wi-Fi network can connect regionally to your gameworld.


You’ve additionally learned some helpful Linux commands, like ls, nano, and mkdir!


But what if your mates want to connect remotely, from their very own houses?


When we predict about gamers connecting over the internet, we have to discuss extra advanced concepts like port forwarding. We also need to think about safety and what web strangers could do in the event that they gained entry to your Raspberry Pi.