Introduction: RPI Minetest Server 4.15
This is the very first SIMPLIFIED 1-2-3 step styled tutorial on how to start a Minetest server 4.15 on the Raspberry Pi!
INFO: Minetest is a open-source Minecraft inspired game that is based largely on mods. (Mods=plugins for you MC fans!) I know from personal experience that starting a Minetest server is one of the most annoying and troublesome tasks for Linux noobs. So today, I want to fix that and make this task a fun past time for those who want a Minetest server.
This project will be taking place on a Raspberry Pi running Minibian. (Baiscally a server edition of Raspbian) I'll show you how to install Minibian, configure it for our Minetest server and then get your server up and running.
In this tutorial we'll cover:
1. Installing Minibian.
2. Configuring Minibian.
3. Installing minetest-server
4.Configuring the server.
5. Adding mods to the server.
6. Tips for a successful server.
Step 1: What You'll Need
For this undertaking you'll need the following:
1. A computer running Mac OS, Linux or Windows.
2. An Ethernet cable and a connection to the Internet.
3. A micro SD card of about 16-32 Gigabytes preferably. If you only have say a 4 GB SD card, you can use a USB flash drive to boot from. Find it HERE
4. A copy of Minibian. Get it HERE
5. If you're using Windows, you'll need Win32 Disk Imager. You can download it HERE
Step 2: Why Use Minibian?
I want you to know why I chose Minibian for this project. First, Minibian is a server version of debian for the Raspberry Pi. Second, Being a server version, this means there is no GUI (You can always use Raspbian if you're not comfortable using the terminal. I will walk you through every step if you decide to use the Minibian terminal) Third, because there is no GUI (Graphical User Interface) The Raspberry Pi's RAM and CPU are more dedicated to running our server than keeping the Desktop running. No GUI=3-5x the speed in my case.
So if you decided to follow these steps and use Minibian, let's get going. Remember, I'll walk you through every step if you use Minibian, so not to fear.
Why Use Minibian:
1. 3-5x Speed vs Raspbian
2. It is meant to run a server, so Minibian is designed to be fast.
3. Impress your friends by using a terminal rather than a "For Noobs" GUI!
Step 3: Format the SD Card
Before you burn the Minibian.img file to your SD card, you must format the card. Since there are so many different ways to format Removable Media on so many Operating Systems, you have to find an Internet tutorial on how to format the card.
Example: (In search box) "How to format SD card on Windows"
Note: It's best in my experience that you format the card in the NTFS file system. I've had the least amount of trouble using this system.
Step 4: Burn!
So you should have downloaded Minibian from the link provided in step 2. Once you have that, extract the file (If applicable) and burn it to your SD card. If you're on windows, use Win32 Disk Imager. There are plenty of Win32 Disk Imager tutorials online so I'm not going to write one here.
Basically, if you use Windows, Linux or Mac OS, I'll leave you to your own devices on burning the image to the SD card.
To find a tutorial on how to burn an OS image to the card, go to your web browser and search for:
(In search box) "How to burn ISO img to SD card on [Your OS] eg: Ubuntu"
Follow the best tutorial you find, and you should have the Image burnt to your card!
Step 5: Boot Up
Now it's time to put the SD card in your Pi and boot! But first, you MUST make sure you've completed this checklist:
1. You formatted the SD card BEFORE burning the .img file onto it.
2. You followed a creditable tutorial on how to burn .img files to an SD card.
3. Your Raspberry Pi is unplugged when you insert the SD card.
4. The Pi is plugged into an Ethernet cable and is connected to the internet.
Once all that is done, you can go ahead and plug the Pi in...
Step 6: First Boot
On Minibian's first boot, it should take about 20 seconds to finish the boot up sequence. If you do not have an Internet connection, you'll get stuck on a repeating cycle where Minibian is looking for an Ethernet connection. Once past that, you will see highlighted in red letters your IP address. Once all of this is done, you will get a login prompt. For the username, type "root", leaving out the quote marks, no CAPS. The password is "raspberry", again no quote marks and no CAPS.
If you have successfully logged into Minibian "root" user, move along to the next step.
Step 7: HACKERS!
Well, you've made it this far so what happens if you get a hacker from the server? That would be VERY bad! so you need to change the "root" user password. At the "root" user prompt, type in the following commands:
passwd (Type in your new password, and retype it)
- This will change your password to whatever you want it to be. Remember, this will be the password that you use from now on for root commands and to login to the "root" user account.
apt-get install raspi-config
- This will install the Raspberry Pi configuration menu. Here you have many options, one of which we will discuss in the next step.
This will show the Pi's local IP address. Remember this!
(By the way, sorry to the kiddies if they get nightmares from my friend Troll above...)
Step 8: Expand the File System
In the "root" user account, type the following command:
This will open the Raspberry Pi configuration menu. Once in the menu, the first option should be to "Expand File System" Which is exactly what it sounds like. Press Enter over that option. It will flash through a couple of screens and then go back to the menu. Press the right arrow key and select finish. If it wants to reboot the Pi, go ahead.
If you did not get a request to reboot your Pi, type in the following command:
This will reboot the Raspberry Pi causing your file system to be expanded to the full capacity of the SD card.
Step 9: Make a New User
Remember our resident hacker mentioned earlier? Well, he can still get in, but with more trouble to him. So we need to take an extra security measure to prevent hacking. We need a new user account! "But why a new user account?" you may ask. Well, the "root" account you logged into is the root user. In this account, you can run ANY command you type! You don't need a password to verify that you are the owner of the computer. If you do have a hacker, this can run you into some serious problems if he gets access to your root account.
To add another account that is NOT ROOT, and that requires the password that you changed earlier to run root commands, type and run the following command. This is an example!
"adduser" [Your new user name] eg: "minetest" remember to never add quote marks when typing a command. So, to run the command with the user "minetest", do this:
"Enter new UNIX Password". Add a password, preferably different than the root account for added security. Retype your password. Press enter until you reach "Is this information correct?" answer "y", press Enter and you are done.
Step 10: Enable Jessie-backports
jessie-backports are a repository that you can install more up-to-date programs with. Without enabling jessie-backports, you cannot install Minetest Server version 4.15, but you would get 4.10, which is REALLY OUTDATED!
Type in the following commands to enable jessie backports:
apt-get install nano
Once you've reached the text file, you should see a few lines of text with different colors. DO NOT EDIT THESE! When you're at the bottom of the page, add these lines of text exactly as they are:
deb http://ftp.de.debian.org/debian jessie main contrib non-free
deb-src http://ftp.de.debian.org/debian jessie main non-free contrib
deb http://httpredir.debian.org/debian jessie-backports main contrib non-free
When done, press Ctrl+O at the same time, press Enter. Now, press Ctrl+x and Enter. That will save the file.
After that, type:
Step 11: Install Minetest Sever
Getting exited? Don't be just yet. You have to install the Minetest server package in order to have a server running 4.15. Go ahead and run the following command:
apt -t jessie-backports install minetest-server
That will install the server. Agree to the install and continue on to the next step.
Step 12: Granting Permissions
If you desire to ever start the server, run the following command:
chmod -R a+w /var/log/minetest/minetest.log
That will enable you to start the server and use the log file!
Step 13: Editing Minetest.conf
The minetest.conf file is what the server reads and sets its parameters by on each startup. You must edit this file in order to use your server to the max. In the "root" user account, run the following command:
This will bring up the Minetest server configuration file. Edit this file to set your "privs" (op) as an administrator. The following is a part of the configuration file:
# configuration file for minetestserver
# Admin name
# Server stuff
# Network port to listen (UDP)
port = 30000
# Bind address
#bind_address = 0.0.0.0
# Name of server
server_name = (The Server Name)
# Description of server
server_description = (This is where your discription goes)
# Domain name of server
#server_address = game.myserver.net
# Homepage of server
#server_url = http://example.com
# Automaticaly report to masterserver
# set to true for public servers
server_announce = true
# Announce to this masterserver. if you want to announce your ipv6 address
# use serverlist_url = v6.servers.minetest.net
serverlist_url = servers.minetest.net
# Default game (default when creating a new world)
default_game = minetest
Edit these options to customize your server. There are a lot of more options, this was only a fragment of the file.
Did you notice all of those little # number/hashtag symbols? Well, whatever line of text those #'s are behind, the server will ignore them at startup. These #'s comment the line of text, making the server ignore that line. For instance, if I wanted to make my player name an "op", I would uncomment and edit this line:
# Admin name
#name = snowdrop1101
Wait! what went wrong? I started the server and typed /privs and I wasn't admin! Well, notice that little # in front of name =, I didn't remove that so the server ignored that my player name was to be admin. So it would be more like this:
# Admin name
name = snowdrop1101
That's better! But what, you may ask, would happen if I did something like this:
name = snowdrop1101
There was no # in front of "Admin name" so the server would try to read that line as an uncommented line and would execute the line at startup. So if I tried to run the server without that # in front of "Admin name", The server might crash. That "Admin name" was a discription of what my option was, so it should remain commented. (This is a comment -> #)
Now that the "Admin name" is commented, the server will ignore it and will not crash due to a minetest.config error.
Remember to check your port. The default Minetest server port is 30000, it is best to leave it that way. However, if another server or something else is running on port 30000, when you start the server you will get a crash. SO edit that port and use a port scanner if you must. If the 30000 port is in use, just change it to something else.
Once done editing the minetest.conf file, type and run:
Test to make sure you didn't screw anything up. Type:
That will log you out of the root user account. Now log into the non-root account you created earlier so you can start the service. Once you've logged in, type:
This will start the server. If you did it right, the server should start and be quiet.
To stop the server, press
At the same time.
Step 14: Adding Mods (Plugins)
What next? You have a configured OS and a even more configured server ready to run, but something's missing. Aha! Mods! Mods are what make up Minetest. Without mods, Minetest would be a boring vanilla game with 40-50 blocks to choose from, if that. Add mods to enable some pretty cool things like the Technic Mod which adds force fields and Nuclear reactors, Morefoods that add a variety of food to choose from, Mesecons which add everything you'd want and more from redstone, plus hundreds of more mods to choose from.
First, if you are logged into the "root" user, log out and join on the user account you made earlier. Now once in the account, type su and enter the sudo "root" account password. This will take your new user up to the root user level for a temporary time. I'll tell you why later.
Now, to add mods to your server, type and run the following commands:
This will take you to the main Mod folder. This folder is protected do you'll need to be in the "root" user account or use the:
Command to sun as sudo. Now to find mods. On the same computer that you burned the SD card with, go to THIS WEBSITE to find mods for your game. Use the "Minetest Mod Search" to find things in specific. Once you've found a mod you wish to try out, right click on the download link and click "Open in new tab". Ignore any download prompts and look at the web address in the search bar. Also check the mod info page for a "Dependencies" tab. This will contain a list of mods that the one you are about to download cannot run without. Make sure to come back later and download those mods.
The web address should look something like this: https://github.com/Jeija/minetest-mod-mesecons/zi...
It's best to have your GUI PC that you looked up the mods on next to your Pi's display, because you will need it there. Make sure that you have your Pi open at:
This as I mentioned is the Mod folder. Use wget to download the mod you want, like this:
Remember to substitute my https:// address with the one you found while opening the new tab, using:
wget https://... (Whatever the address is)
Once all that is done, you should type:
In the folder to see if your mod downloaded successfully.
Step 15: Unzip
Most Minetest mods come in a .zip folder, so you have to unzip the file for it to work. Run:
apt-get install unzip
That will add a tool for, well, unzipping files. Lets say I used wget to download a file that shows up as "master.zip". To unzip the file, I would type:
And so goes the extraction process. When you have extracted the file you want, make sure to delete the .zip with:
rm -r master.zip (Replace "master.zip" with your file name)
Most of the time, you'll get unzipped files that look like this:
The server doesn't like names like this, so you must rename the file. Use:
mv minetest-mod-extrafood-master0173v47 extrafood
This will rename the loooong file into a more compact name, extrafood. Obviously, use the mv command with whatever your file name is that you wish to rename. Also, it's best to keep the name as close to the origonal while still being simple, for ease of finding later.
Step 16: Testing Mods
Whenever you install a new mod, YOU MUST TEST IT OUT!!! If you installed say 30 mods and then went to start your server, and say 3 mods failed and made the server crash, you'd have a hard time tracing down the culprit. So each time you install a mod, test it out and make sure that it doesn't crash the server. If the server runs, join the game and test out the mod in-game. A mod might be nice when running in terminal but may just as well turn ugly when you go to use it. To join the game, use the Pi's IP address and the server port to join.
To test mods, you must back out of sudo and become a normal user. To exit sudo, type:
That will return the user "minetest" back to normal. This is where the new user can come in handy. You can't start minetest-server in root. To start the server, type:
That will load the server and all of the mods, default and the ones that you added. Of your mod loads up fine, then good! go ahead and add more, testing one by one to make sure that a mod isn't bad or has conflicts with other mods. Also remember that I said to check on the mod info page to see if it had Dependencies. If there are dependencies, download, unzip and try them out. Many times a mod won't load due to unmet dependencies.
Step 17: Port Forwarding
If you ever plan on joining your server publicly, you have to port forward it.
1. On your Pi and type in "ifconfig", don't add the quote marks.
2. Look for the "eth0" tab. It should have an IP that looks like this: 192.168.1.149
3. Open up your browser and type in 'Whats my ip' into the address bar. Copy the IP shown
4. Now in the URL bar, paste that IP you just copied. This should take you to the wifi router page. If it has a login go ahead and login if not continue to the next step.
5. Look for the virtual servers/port forwarding/applications/gaming tab. The name may vary depending on the wifi router.
6. Once you have opened up the virtual servers page, you will see that it will ask you to enter a port, ip, and a name. For the port you will type in 30000, (Or whatever port you selected in the minetest.conf file) the inbound and private port. Name the server and you are set. Type in the IP that you looked for earlier with ifconfig next to the port. Just save the settings.
Step 7. To connect to your own server you will always connect by typing in the IP you found in the web browser, and in the next box typing the port you set for the server.
Step 18: Finish Up
When you have tried and tested your new server and all of its mods, you might consider making it public! (An option in the minetest.conf) This will announce to the players that your server is on and they will start joining. Try new mods, experiment a little and when you've found what you want, enjoy it!
Please leave comments below if I left anything out and thanks for reading.
Enjoy your server!