Raspberry Pi Tutorial: Host A Minecraft Server On Ubuntu Desktop

Raspberry Pi Tutorial: Host A Minecraft Server On Ubuntu Desktop

Welcome to the second in our sequence of Linux gaming posts within the run as much as the vacations. This week, we’ve put together a tutorial that teaches you the right way to create a basic Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you can play domestically with your folks.


This is a good afternoon challenge to work on with a good friend or household member!


Internet hosting a Minecraft server unlocks a tonne of further control over the way you play Minecraft with your friends. You can change the sport guidelines and difficulty, the behaviour of enemies and determine how players interact.


Establishing a server can also be an excellent solution to be taught extra about Linux. Linux is all about tinkering and trying new things. While it will possibly appear intimidating at first, the directions you’ll comply with for this challenge will enable you to method more complicated Linux projects sooner or later!


In this tutorial, we’ll be using a Raspberry Pi 4 4GB with a 32GB SD card, but it's also possible to follow alongside on just about any laptop computer or Pc that has Ubuntu Desktop put in. You can even use a Digital Machine.


Check out these tutorials for getting began 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 on this tutorial, and recommend you follow together with Ubuntu Desktop 21.10 on whatever machine you use.


In fact, you’ll additionally need another Computer or laptop with Minecraft Java Edition put in so you possibly can hook up with your server as soon as you’ve created it!


Let’s leap in.


Install Ubuntu on your Raspberry Pi and replace


If you’ve followed the Raspberry Pi installation tutorial, you’ll be pretty much able to go, but each time we begin a new venture, it’s all the time important to verify all the things is up to date.


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


Enter your password and press Y when prompted.


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


Set up Java


Minecraft servers are based mostly on Minecraft Java Edition, the unique model 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 have to particularly install the newest Java Runtime Atmosphere (jre), which is version 18:


Sort your password and press Y when prompted.


Create a folder to your server


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


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


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


Should you sort


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


For those who kind ls again, you may see that now nothing is returned, because we’re inside an empty folder. You’ll additionally see that your immediate now includes the Minecraft folder title:


Download Minecraft Server!


Depart your terminal open, however now you additionally must open your internet browser.


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


We need to obtain the server linked here, however instead of left-clicking it, let’s Proper-Click and select Copy Link.


This may ensure you at all times get the most recent version of the server when following this tutorial!


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


After which Proper-Click and Paste the hyperlink to the server. It ought to look one thing 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 note the download complete, and for those who then kind:


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


Begin your server!


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


Press ENTER and… Error??


That’s because we just told our Pi to run a file referred to as minecraft_server.1.18.jar, but you'll be able to see from our final ls that once we installed the server it was simply called server.jar.


That’s a simple fix.


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


Success!


Form of. Now we have now one other error. We have to agree to the top Person License Settlement (EULA) before we can get started.


So where’s the EULA?


Effectively let’s use our trusty


on our Minecraft directory yet one more time. You’ll see the set up course of has created a set of latest files. This is sweet, as a result of these files are what permits us to play round with the game rules! But before we are able to get to the fun stuff, let’s signal the EULA.


We will do this immediately within the terminal (you are able to do every part in the terminal, that’s why it’s so cool) using a textual content editor referred to as nano. Type:


This will open the eula.txt file in your terminal window. Now you just want to change 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 attempt the server again!


In case you press UP a couple of occasions in your keyboard, we are able to repeat the instruction from earlier without typing it out again.


But let’s make one last change before we run issues and double the -Xmx1024M and -Xms1024M in our command to -Xmx2048M and -Xms2048. Xmx and Xms discuss with the quantity of reminiscence the server will use. The more we give it, the better the performance.


Now we press ENTER again and the server ought to start properly!


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


As soon as your server has completed establishing, you’ll in all probability get a number of messages like this relying on how a lot reminiscence you assigned it in the previous command. It’s normal to have a number of of those at startup no matter happens, so don’t fear an excessive amount of.


High Tip: Higher hardware means a greater server. If you’re contemplating protecting your server round, or utilizing it with lots of people, an 8GB Raspberry Pi 4 (with increased Xmx and Xms numbers) will carry out higher. Attaching an SSD via a USB3.Zero port will also assist.


Ultimately, as players be part of, you’ll have the ability to see key occasions appear on the terminal as they happen in the sport world.


Ouch.


You may cease your server any time by typing


within the Terminal. This will also save your world so you can resume once more at a later time.


Joining the Minecraft server over your native network


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


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


Then they should navigate to Multiplayer > Direct Connection.


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


Let’s go back to our server terminal!


To find out the server’s local IP, you should open a second terminal window, or a new tab in the current terminal (or just stop your server for this bit and restart it after).


This may produce a string of numbers, however you only need the primary set.


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


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


Once your visitors have entered your server IP, they just need to click Be a part of 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 domestically with your friends, then you’re all accomplished - congratulations! However the best part of operating a server is that you can play god with the game world!


Let’s close the server (cease, remember?) and do  Minecraft-servers .


This time, we need to do the identical factor as we did to signal the EULA but this time we’re going to edit a file called server.properties (you may need spotted it the last time we used ls).


Type:


This should carry up all of the configuration choices on your server. If you scroll down there’s fairly a few!


I won’t go into detail on every option, but you may 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:


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


High Tip: If you need to begin a new Minecraft server, just delete the World folder out of your Minecraft directory, or rename the level-name in server.properties. This will create a new gameworld folder with the up to date title subsequent time the server begins, and you'll swap back to the previous one any time!


Connecting to your Minecraft server remotely


On this undertaking, we’ve proven you find out how to set up and customise a Minecraft server in your Raspberry Pi 4, and the way gamers on the identical Wi-Fi community can connect locally to your gameworld.


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


However what if your folks want to connect remotely, from their very own properties?


When we expect about players connecting over the internet, we need to talk about extra superior ideas like port forwarding. We additionally want to think about security and what internet strangers may do in the event that they gained access to your Raspberry Pi.