Raspberry Pi Tutorial: Host A Minecraft Server On Ubuntu Desktop

· 7 min read
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 vacations. This week, we’ve put together a tutorial that teaches you how to create a fundamental Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you possibly can play locally with your friends.


This is a good afternoon project to work on with a pal or family member!


Hosting a Minecraft server unlocks a tonne of further management over how you play Minecraft with your friends. You possibly can change the sport guidelines and difficulty, the behaviour of enemies and decide how players interact.


Organising a server can be an ideal strategy to be taught more about Linux. Linux is all about tinkering and trying new things. While it will probably appear intimidating at first, the directions you’ll follow for this venture will enable you method extra advanced Linux projects sooner or later!


On this tutorial, we’ll be utilizing a Raspberry Pi four 4GB with a 32GB SD card, but it's also possible to follow along on just about any laptop computer or Computer that has Ubuntu Desktop put in. You possibly can even use a Virtual Machine.


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


Pc tutorial

VirtualBox tutorial

Raspberry Pi tutorial


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


In fact, you’ll also need another Laptop or laptop with Minecraft Java Edition put in so you may hook up with your server once you’ve created it!


Let’s leap in.


Install Ubuntu on your Raspberry Pi and update


If you’ve adopted the Raspberry Pi set up tutorial, you’ll be just about able to go, however whenever we start a brand new project, it’s all the time necessary to ensure every part is updated.


Go forward and open a terminal (ALT+T or click on the Terminal icon in your sidebar) and kind:


Enter your password and press Y when prompted.


This will examine whether your version of Ubuntu is updated and obtain and install any new packages.


Install Java


Minecraft servers are primarily based on Minecraft Java Edition, the original model of Minecraft, so our next step is to install Java on our Raspberry Pi. The default Java on Ubuntu is older than the one used for Minecraft Servers, so we have to particularly set up the latest Java Runtime Atmosphere (jre), which is model 18:


Type your password and press Y when prompted.


Create a folder on your server


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


The above will do precisely the identical factor as utilizing the file supervisor. In actual fact, you'll be able to test the file manager yourself to affirm that the brand new folder has appeared!


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


In the event you sort


You can see that we’re nonetheless in the home directory of our Pc. You’ll see your Paperwork and Downloads folders, as well as the new Minecraft folder you created. To get inside this folder, we want to vary Listing (cd), so kind:


Should you sort ls once more, you'll be able to see that now nothing is returned, as a result of we’re inside an empty folder. You’ll also see that your prompt now consists of the Minecraft folder identify:


Download Minecraft Server!


Leave your terminal open, but now you additionally need to open your internet browser.


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


We want to download the server linked right here, but instead of left-clicking it, let’s Right-Click and choose Copy Link.


This will be sure you at all times get the latest model of the server when following this tutorial!


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


After which Right-Click on and Paste the link to the server. It ought to look one thing like this:


Then press ENTER. This command instructs your Pi to ‘get’ (obtain) whatever file is linked at that net tackle you gave it.


You will note the obtain complete, and when you then type:


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


Start your server!


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


Press ENTER and… Error??


That’s because we simply instructed our Pi to run a file called minecraft_server.1.18.jar, but you may see from our last ls that after we installed the server it was just known as server.jar.


That’s a simple repair.


When you press UP on the keyboard, your final instruction will likely be repeated. Try this now, after which edit the filename to server.jar and press ENTER again.


Success!


Sort of. Now we now have one other error. We have to comply with 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 directory another time. You’ll see the installation course of has created a set of latest files. This is nice, as a result of these files are what permits us to play round with the sport rules! However earlier than we will get to the enjoyable stuff, let’s sign the EULA.


We will do this straight within the terminal (you are able to do the whole lot in the terminal, that’s why it’s so cool) utilizing a text editor referred to as nano. Type:


This will open the eula.txt file in your terminal window. Now  Hypedpvp  need to alter the eula line to true as an alternative of false.


Then we press CTRL+S to avoid wasting and CTRL+X to exit back to the Command Line.


Let’s strive the server once more!


In the event you press UP a number of occasions on your keyboard, we will repeat the instruction from earlier with out typing it out again.


However let’s make one final change before we run things and double the -Xmx1024M and -Xms1024M in our command to -Xmx2048M and -Xms2048. Xmx and Xms check with the quantity of memory the server will use. The extra we give it, the higher the efficiency.


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


This subsequent bit goes to take some time. And also you probably won’t be capable of browse Fb whilst you’re waiting, as most of the Raspberry Pi will be focussed on standing up the server.


As soon as your server has finished setting up, you’ll probably get a number of messages like this depending on how much reminiscence you assigned it within the earlier command. It’s regular to have a number of of these at startup whatever occurs, so don’t fear a lot.


Top Tip: Higher hardware means a greater server. If you’re considering preserving your server round, or utilizing it with a lot of people, an 8GB Raspberry Pi four (with elevated Xmx and Xms numbers) will perform higher. Attaching an SSD by way of a USB3.Zero port will also help.


Finally, as players be part of, you’ll be able to see key occasions seem on the terminal as they happen in the game world.


Ouch.


You may stop your server any time by typing


in the Terminal. This will even save your world so you'll be able to resume again at a later time.


Becoming a member of the Minecraft server over your native network


If you’ve invited your friends to affix your server on their laptops, they’re most likely a bit impatient to get going by now. However we’re lastly prepared!


In your (or your friend’s) laptop or Laptop, be sure that you are operating the Java Version of Minecraft (which you'll install from the official Minecraft site - simply download it and double-click).


Then they should navigate to Multiplayer > Direct Connection.


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


Let’s return to our server terminal!


To seek out out the server’s local IP, it's worthwhile to open a second terminal window, or a brand new tab in the present terminal (or simply cease your server for this bit and restart it after).


This can produce a string of numbers, but you solely need the primary set.


Wanting on the above, my local IP is 192.168.1.222. Yours will probably be similar however not the same.


So that’s what my company ought to add in their games:


As soon as your guests have entered your server IP, they just need to click Be part of Server and they’re in!


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


Modifying your Server Settings


If you wish to play regular Minecraft domestically with your mates, then you’re all accomplished - congratulations! But one of the best a part of running a server is that you may play god with the sport world!


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


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


Sort:


This could deliver up all the configuration options to your server. In case you scroll down there’s quite a couple of!


I won’t go into detail on every choice, however you may read about them on the Minecraft Wiki.


Personally, I just want to turn 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 and then CTRL+X to save lots of and exit!


High Tip: If you would like to start out a brand new Minecraft server, simply delete the World folder from your Minecraft listing, or rename the level-name in server.properties. This may create a brand new gameworld folder with the updated title subsequent time the server begins, and you can change again to the previous one any time!


Connecting to your Minecraft server remotely


In this undertaking, we’ve proven you the right way to set up and customise a Minecraft server in your Raspberry Pi 4, and how gamers on the same Wi-Fi network can join regionally to your gameworld.


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


However what if your mates want to attach remotely, from their very own homes?


When we think about gamers connecting over the internet, we need to speak about more superior ideas like port forwarding. We additionally want to consider safety and what internet strangers might do if they gained entry to your Raspberry Pi.