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 collection of Linux gaming posts within the run up to the vacations. This week, we’ve put collectively a tutorial that teaches you the way to create a basic Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you possibly can play regionally with your pals.


This is a superb afternoon project to work on with a pal or household member!


Hosting a Minecraft server unlocks a tonne of extra control over the way you play Minecraft with your pals. You possibly can change the game rules and issue, the behaviour of enemies and determine how players work together.


Setting up a server can be an incredible solution to learn more about Linux. Linux is all about tinkering and making an attempt new things. Whereas it could actually seem intimidating at first, the directions you’ll observe for this undertaking will aid you strategy more complex Linux initiatives in the future!


On this tutorial, we’ll be utilizing a Raspberry Pi four 4GB with a 32GB SD card, however you may as well follow along on pretty much any laptop computer or Laptop that has Ubuntu Desktop put in. You might even use a Digital Machine.


Check out these tutorials for getting started with Ubuntu Desktop on these platforms:


Computer tutorial

VirtualBox tutorial

Raspberry Pi tutorial


Notice: We’ll be using Ubuntu Desktop 21.10 for Raspberry Pi on this tutorial, and suggest you follow together with Ubuntu Desktop 21.10 on no matter device you utilize.


After all, you’ll additionally want another Pc or laptop with Minecraft Java Version installed so you'll be able to connect to your server once you’ve created it!


Let’s soar in.


Install Ubuntu in your Raspberry Pi and replace


If you’ve followed the Raspberry Pi set up tutorial, you’ll be just about ready to go, however whenever we begin a new venture, it’s always vital to ensure every little thing is up to date.


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


Enter your password and press Y when prompted.


This may check whether your model of Ubuntu is up to date and obtain and install any new packages.


Install Java


Minecraft servers are based on Minecraft Java Edition, the original model of Minecraft, so our subsequent 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 specifically set up the newest Java Runtime Environment (jre), which is version 18:


Kind your password and press Y when prompted.


Create a folder in your server


Now you want a spot to place the Minecraft server on your Pi. We may do it the ‘Windows’ method 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 right here!


The above will do precisely the same thing as utilizing the file supervisor. In actual fact, you'll be able to verify the file manager your self to confirm that the new folder has appeared!


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


If you happen to sort


You possibly can see that we’re still in the house directory of our Laptop. You’ll see your Paperwork and Downloads folders, in addition to the new Minecraft folder you created. To get inside this folder, we want to change Directory (cd), so type:


For those who sort ls once more, you possibly can see that now nothing is returned, as a result of we’re inside an empty folder. You’ll additionally see that your prompt now includes the Minecraft folder name:


Download Minecraft Server!


Go away your terminal open, but now you also 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, however as an alternative of left-clicking it, let’s Right-Click on and select Copy Link.


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


Depart that web 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 Right-Click on and Paste the link to the server. It should look one thing like this:


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


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


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


Begin your server!


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


Press ENTER and… Error??


That’s as a result of we just advised our Pi to run a file referred to as minecraft_server.1.18.jar, but you possibly can see from our final ls that after we put in the server it was simply called server.jar.


That’s a straightforward fix.


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


Success!


Form of. Now we've one other error. We need to comply with the end User License Agreement (EULA) earlier than we will get began.


So where’s the EULA?


Properly let’s use our trusty


on our Minecraft directory yet one more time. You’ll see the installation process has created a set of latest recordsdata. This is good, because these recordsdata are what allows us to play round with the sport guidelines! However before we are able to get to the fun stuff, let’s sign the EULA.


We can do this straight in the terminal (you are able to do every little thing within the terminal, that’s why it’s so cool) using a textual content editor called nano. Type:


This can open the eula.txt file in your terminal window. Now you simply want to vary the eula line to true instead of false.


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


Let’s try the server once more!


If you happen to press UP a few times in your keyboard, we are able to repeat the instruction from earlier with out typing it out once more.


However 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 seek advice from the amount of memory the server will use. The more we give it, the better the efficiency.


Now we press ENTER again and the server should begin properly!


This next bit is going to take a while. And you probably won’t have the ability to browse Fb while you’re waiting, as many of the Raspberry Pi will be focussed on standing up the server.


Once your server has finished establishing, you’ll in all probability get a couple of messages like this depending on how a lot reminiscence you assigned it within the previous command. It’s normal to have a few of these at startup no matter happens, so don’t worry too much.


Prime Tip: Higher hardware means a greater server. If you’re considering retaining your server around, or using it with a lot of people, an 8GB Raspberry Pi 4 (with elevated Xmx and Xms numbers) will perform better. Attaching an SSD by way of a USB3.Zero port may also help.


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


Ouch.


You'll be able to cease your server any time by typing


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


Becoming a member of the Minecraft server over your native community


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


On your (or your friend’s) laptop or Pc, be certain that you might be operating the Java Edition of Minecraft (which you'll be able to install from the official Minecraft site - simply download it and double-click).


Then they need to navigate to Multiplayer > Direct Connection.


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


Let’s go back to our server terminal!


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


This will produce a string of numbers, however you only want the primary set.


Looking at the above, my local IP is 192.168.1.222. Yours will be comparable but not the same.


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


Once your guests have entered your server IP, they only must click Join Server and they’re in!


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


Modifying your Server Settings


If you want to play regular Minecraft locally with your folks, then you’re all accomplished - congratulations! But one of the best a part of working a server is that you could play god with the sport world!


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


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 known as server.properties (you might need noticed it the final time we used ls).


Sort:


This should convey up all the configuration options for your server. Should you scroll down there’s quite just a few!


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


Personally, I simply need to turn off the spiders and change the server’s message of the day, so I’m going to make the following tweaks:


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


High Tip: If you need to start a new Minecraft server, just delete the World folder out of your Minecraft directory, or rename the extent-title in server.properties.  dj w360  may create a new gameworld folder with the up to date title subsequent time the server begins, and you may change again to the old one any time!


Connecting to your Minecraft server remotely


In this challenge, we’ve proven you the right way to set up and customise a Minecraft server on your Raspberry Pi 4, and how players on the same Wi-Fi community can connect regionally to your gameworld.


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


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


When we predict about gamers connecting over the web, we need to speak about more advanced concepts like port forwarding. We also want to contemplate security and what web strangers may do if they gained access to your Raspberry Pi.