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 find out how to create a primary Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you can play locally with your pals.


This is a superb afternoon challenge to work on with a buddy or family member!


Hosting a Minecraft server unlocks a tonne of further management over the way you play Minecraft with your mates. You possibly can change the game guidelines and issue, the behaviour of enemies and determine how players interact.


Setting up a server can be an awesome method to learn extra about Linux. Linux is all about tinkering and trying new issues. Whereas it will probably seem intimidating at first, the directions you’ll comply with for this challenge will assist you to strategy extra complicated Linux initiatives sooner or later!


On this tutorial, we’ll be using a Raspberry Pi four 4GB with a 32GB SD card, however you may as well follow along on just about any laptop computer or Computer that has Ubuntu Desktop installed. You might even use a Digital Machine.


Try these tutorials for getting started with Ubuntu Desktop on these platforms:


Laptop 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 together with Ubuntu Desktop 21.10 on whatever device you employ.


In fact, you’ll also want another Computer or laptop computer with Minecraft Java Edition installed so you''ll be able to hook up with your server once you’ve created it!


Let’s bounce in.


Set up Ubuntu in your Raspberry Pi and replace


If you’ve followed the Raspberry Pi installation tutorial, you’ll be pretty much ready to go, but whenever we start a new challenge, it’s at all times necessary to ensure everything is updated.


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


Enter your password and press Y when prompted.


This will examine whether or not your version of Ubuntu is updated and obtain and set up any new packages.


Install Java


Minecraft servers are based mostly on Minecraft Java Version, the unique version of Minecraft, so our next 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 particularly install the latest Java Runtime Environment (jre), which is model 18:


Type your password and press Y when prompted.


Create a folder on your server


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


The above will do exactly the same thing as utilizing the file manager. Actually, you''ll be able to check the file supervisor your self to confirm that the new folder has appeared!


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


In case you type


You possibly can see that we’re still in the house listing of our Computer. You’ll see your Documents and Downloads folders, as well as the new Minecraft folder you created. To get inside this folder, we need to vary Directory (cd), so type:


When you sort ls again, you''ll be able to see that now nothing is returned, as a result of we’re inside an empty folder. You’ll additionally see that your immediate now consists of the Minecraft folder title:


Download Minecraft Server!


Leave your terminal open, but now you also must open your web browser.


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


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


It will ensure you at all times get the most recent model of the server when following this tutorial!


Depart that page open, as we’ll come again to it shortly. Now return to the terminal window, ensuring we’re nonetheless within the Minecraft folder, and tell the terminal to obtain the server to this folder.


After which Right-Click and Paste the hyperlink to the server. It ought to look something like this:


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


You will notice the download full, and when you then type:


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


Start your server!


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


Press ENTER and… Error??


That’s because we just advised our Pi to run a file called minecraft_server.1.18.jar, however you can see from our final ls that once we installed the server it was just known as server.jar.


That’s an easy repair.


If you 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!


Type of. Now we now have one other error. We need to comply with the end Consumer License Settlement (EULA) earlier than we will get began.


So where’s the EULA?


Well let’s use our trusty


on our Minecraft listing yet another time. You’ll see the installation course of has created a set of recent recordsdata. This is good, because these recordsdata are what allows us to play round with the game guidelines! But earlier than we are able to get to the enjoyable stuff, let’s signal the EULA.


We are able to do this immediately in the terminal (you can do all the pieces within the terminal, that’s why it’s so cool) utilizing a text editor known as nano. Type:


It will open the eula.txt file in your terminal window. Now you simply need to change the eula line to true as a substitute of false.


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


Let’s attempt the server again!


In case you press UP just a few occasions in your keyboard, we can repeat the instruction from earlier without typing it out again.


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


Now we press ENTER once more and the server ought to start correctly!


This next bit is going to take some time. And you in all probability won’t be capable of browse Facebook whilst you’re ready, as a lot of the Raspberry Pi will probably be focussed on standing up the server.


As soon as your server has finished organising, you’ll most likely get a couple of messages like this depending on how much reminiscence you assigned it within the previous command. It’s regular to have a number of of these at startup whatever happens, so don’t fear an excessive amount of.


High Tip: Better hardware means a better server. If you’re contemplating protecting your server round, or utilizing it with a lot of people, an 8GB Raspberry Pi four (with increased Xmx and Xms numbers) will perform higher. Attaching an SSD via a USB3.Zero port will even help.


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


Ouch.


You possibly can stop your server any time by typing


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


Joining the Minecraft server over your native network


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


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


Then they should navigate to Multiplayer > Direct Connection.


Now they need to enter the native IP deal with of the server which is… hmmm. We don’t know.


Let’s go back to our server terminal!


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


This can produce a string of numbers, however you only want the first set.


Looking at the above, my local IP is 192.168.1.222. Yours will likely be similar but not the identical.


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


Once your visitors have entered your server IP, they only have to click on Join Server and they’re in!


Sadly for my server, I spawned proper subsequent to a spider. And it was raining.


Modifying your Server Settings


If you want to play regular Minecraft regionally with your friends, then you’re all done - congratulations! However the very best part of working a server is that you may play god with the game world!


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


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


Type:


This could bring up all the configuration choices to your server. If you happen to scroll down there’s fairly a number of!


I won’t go into element on every choice, but you''ll be able to read about them on the Minecraft Wiki.


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


Just as before, we press CTRL+S after which CTRL+X to save lots of and exit!


Prime Tip: If you would like to start a new Minecraft server, just delete the World folder from your Minecraft directory, or rename the level-title in server.properties. This will create a new gameworld folder with the up to date name next time the server begins, and you can swap back to the previous one any time!


Connecting to your Minecraft server remotely


On this project, we’ve proven you how you can set up and customise a Minecraft server on your Raspberry Pi 4, and the way players on the identical Wi-Fi network can connect domestically to your gameworld.


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


However what if your folks need to connect remotely, from their own homes?


When we predict about gamers connecting over the web, we have to speak about more superior ideas like port forwarding. We also want to think about safety and what internet strangers may do in the event that they gained entry to your Raspberry Pi.