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 series of Linux gaming posts within the run up to the vacations. This week, we’ve put collectively a tutorial that teaches you the best way to create a primary Minecraft Server on a Raspberry Pi with Ubuntu Desktop, so you may play locally with your mates.


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


Internet hosting a Minecraft server unlocks a tonne of extra control over the way you play Minecraft with your folks. You may change the sport rules and issue, the behaviour of enemies and decide how players work together.


Setting up a server can be a fantastic way to be taught more about Linux. Linux is all about tinkering and attempting new things. Whereas it may possibly appear intimidating at first, the instructions you’ll comply with for this project will help you method extra complicated Linux tasks sooner or later!


In this tutorial, we’ll be utilizing a Raspberry Pi four 4GB with a 32GB SD card, however you may as well observe along on just about any laptop computer or Laptop that has Ubuntu Desktop put in. You can even use a Virtual Machine.


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


Laptop tutorial

VirtualBox tutorial

Raspberry Pi tutorial


Observe: We’ll be utilizing Ubuntu Desktop 21.10 for Raspberry Pi in this tutorial, and advocate you observe along with Ubuntu Desktop 21.10 on no matter machine you use.


In fact, you’ll additionally want another Pc or laptop with Minecraft Java Version put in so you'll be able to hook up with your server as soon as you’ve created it!


Let’s soar 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, but every time we start a brand new challenge, it’s at all times necessary to make sure every little thing 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 may check whether your model of Ubuntu is updated and obtain and install any new packages.


Set up Java


Minecraft servers are based on Minecraft Java Version, the unique 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 need to particularly set up the most recent Java Runtime Environment (jre), which is model 18:


Sort your password and press Y when prompted.


Create a folder for your server


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


The above will do precisely the identical thing as utilizing the file manager. The truth is, you possibly can test the file manager your self to verify that the brand new folder has appeared!


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


Should you type


You can see that we’re still in the house listing of our Laptop. 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 Listing (cd), so kind:


If you happen to sort ls again, you may see that now nothing is returned, as a result of we’re inside an empty folder. You’ll also see that your immediate now includes the Minecraft folder name:


Download Minecraft Server!


Depart your terminal open, however now you also need to open your internet browser.


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


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


It will be sure you always get the latest 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, making sure we’re nonetheless within the Minecraft folder, and inform the terminal to obtain the server to this folder.


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


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


You will see the obtain full, and should you then sort:


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


Start your server!


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


Press ENTER and… Error??


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


That’s a simple fix.


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


Success!


Form of. Now we have one other error. We have to agree to the end Person License Settlement (EULA) earlier than we can get started.


So where’s the EULA?


Nicely let’s use our trusty


on our Minecraft directory one more time. You’ll see the set up process has created a set of latest files.  Minecraft java  is sweet, because these recordsdata are what allows us to play around with the game rules! But before we are able to get to the fun stuff, let’s sign the EULA.


We are able to do that directly in the terminal (you can do the whole lot within the terminal, that’s why it’s so cool) utilizing a text editor known as nano. Kind:


It will open the eula.txt file in your terminal window. Now you simply want to alter the eula line to true instead of false.


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


Let’s strive the server again!


If you happen to press UP a number of occasions in your keyboard, we can repeat the instruction from earlier with out typing it out again.


However let’s make one last change earlier than we run issues and double the -Xmx1024M and -Xms1024M in our command to -Xmx2048M and -Xms2048. Xmx and Xms confer with the amount of reminiscence the server will use. The extra we give it, the higher the efficiency.


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


This subsequent bit is going to take some time. And also you in all probability won’t have the ability to browse Fb whilst you’re waiting, as most of the Raspberry Pi might be focussed on standing up the server.


As soon as your server has completed establishing, you’ll most likely get a couple of messages like this depending on how a lot memory you assigned it in the earlier command. It’s normal to have just a few of those at startup whatever happens, so don’t fear an excessive amount of.


High Tip: Better hardware means a better server. If you’re considering maintaining your server round, or using it with lots of people, an 8GB Raspberry Pi four (with elevated Xmx and Xms numbers) will perform better. Attaching an SSD via a USB3.Zero port will even assist.


Ultimately, as gamers be part of, you’ll be capable to see key events seem on the terminal as they occur in the game world.


Ouch.


You can stop your server any time by typing


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


Becoming a member of the Minecraft server over your local network


If you’ve invited your friends to affix your server on their laptops, they’re in all probability a bit impatient to get going by now. However we’re finally ready!


On your (or your friend’s) laptop computer or Laptop, ensure that you are operating the Java Version of Minecraft (which you'll set up from the official Minecraft site - simply obtain it and double-click).


Then they should navigate to Multiplayer > Direct Connection.


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


Let’s return to our server terminal!


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


This will produce a string of numbers, but you only need the primary set.


Wanting on the above, my native IP is 192.168.1.222. Yours can be comparable but not the identical.


So that’s what my friends ought to add of their games:


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


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


Modifying your Server Settings


If you want to play regular Minecraft domestically with your folks, then you’re all done - congratulations! But the best a part of operating a server is you could play god with the sport world!


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


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


Type:


This could convey up all of the configuration options for your server. For those who scroll down there’s fairly a few!


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


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


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


Top Tip: If you want to begin a brand new Minecraft server, just delete the World folder out of your Minecraft listing, or rename the extent-title in server.properties. This can create a new gameworld folder with the up to date title next time the server begins, and you can switch again to the previous one any time!


Connecting to your Minecraft server remotely


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


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


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


When we think about gamers connecting over the web, we have to talk about more superior concepts like port forwarding. We also want to contemplate safety and what internet strangers might do if they gained entry to your Raspberry Pi.