[Tutorial] Setting up a Forge Minecraft server under DietPi v6.31.2 (reachable via www)

Setting up a Forge Minecraft server (Java)
under DietPi v6.31.2 (64bit) on RaspberryPi 4

  • making it a little more secure with no root access via ssh
  • and maybe taking this little extra security away again by installing Java 8
    (some older minecraft versions need their corresponding Java version)
  • plus making it accessable through IPv4 and IPv6 and a Portmapper with a very cheap service called feste-ip.net


    Do you have kids who play minecraft? And do your kids have friends (in real life) who would like to play minecraft, too?
    Would you like to let those kids experience playing minecraft together online without the dangers of the internet?
    Then a RaspberryPi 4 4GB (or even the latest with 8GB) and the DietPi 64bit-version are the right choice for you.
    This SBC is very affordable and also a good starting point if you want to know and learn more about computers and linux and how it all works together.
    When you have finally found out what to do it is super easy to setup.
    That’s why I decided to make this tutorial - to put all the information I had to collect in many places into one single thread.

Let’s get started:

  • First flash your DietPi image on the SD card you want to use. It has to be the 64bit (beta) image of the latest DietPi version.
    Here is the official link on how to:
    How to install DietPi - DietPi.com Docs
  • The next tool we need will automatically launch when you first boot your Raspberry Pi using DietPi after the initial configuration process has completed. You can also launch it manually by typing
dietpi-software

in the terminal. Use Putty to connect to it using the right IP address and port 22. You can find the IP address in the network settings of your router for example.
terminal.png

Select Software Optimised and on the next screen choose MineOS by hitting space when it is highlighted.


Also install proFTP as your file server - you’ll need it to put your mods on the server.

Then hit Install and Ok.

  • Another tool we need is “dietpi-config”, which you can launch by typing
dietpi-config

in the terminal.


Here we can adjust some general settings like language and timezone in the Language/Regional Options,
but also the GPU/RAM Memory Split to give the server all the RAM possible in the Display Options.
In the Network Options we can setup the wifi adapter and turn IPv6 “on” if it is not already.

If you want to, you can set these adjustments before the installation of your DietPi image.
There are two .txt files you can edit accordingly:
dietpi.txt and dietpi-wifi.txt can be found in the boot-directory of your image.
Both are self-explanatory.
You even can turn off HDMI completely, if you want to do the setup via Putty (ssh) - then you don’t even need to worry about the GPU/RAM Memory Split anymore.

  • Now lets make everything a litle more secure by disabling remote-login as root.
nano /etc/default/dropbear


change

DROPBEAR_EXTRA_ARGS=

to

DROPBEAR_EXTRA_ARGS=-g
  • Next up is Java 8. We need to install the corresponding Java version to the forge/minecraft server we are about to set up.
    Because Debian has kicked any older Java version out of their repositories due to security issues doing so will be at your own risk!
    The user Joulinar (Thank you so much!) provided me with the knowledge I am going to pass on now:

We are starting with setting up an additional package source (3rd party). AdoptOpenJDK offers the file we need for free.

  1. add the key
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
  1. create a new source list
nano /etc/apt/sources.list.d/java.list
  1. add the following and save the file
deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb buster main
  1. run the following
apt update
apt install adoptopenjdk-8-hotspot
reboot

Lets check the java version with

java -version

in the terminal.
You should see something like this:

openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

You now have two Java versions installed. You can switch between them system wide with the “update-alternatives” command:

update-alternatives --config java


.

  • Now lets setup the server in MineOS:
    After you chose MineOS to be installed in dietpi-software it starts with the boot of your Pi - so there is no extra command needed for that, it is already running.
    Find out your local IP by typing
ip a

in the terminal.
You reach the webui via https://your.local.net.work:8443.
You can login with root as user and your password for the dietpi login.
mineos.png
Once you are logged in you click on Create New Server on the left and set the parameters you want to set.

It is a good idea to set the max number of players, so that everyone still can have a smooth experience while playing. You’ll find out by testing how many players are possible for your server (probably something about 8 to 10) because it also depends on how many mods (if any) are installed.


When you are done click on the Create New Server button.

Then change to Profiles and select the version you want to install - most and best supported mods are still on 1.12.2.


Download it and change to Server Status

  • In the pull-down-menus select the minecraft version on the left and then the forge-1.12.2-14.23.5-installer.jar installation file on the right.
  • now hit the grey Accept EULA button. In the appearing box hit “Accept EULA” again and then “Start”.
    -The first run of the server isn’t going to last very long, because this was just the installer. Clicking on the pull-down-menu on the right now shows three entries: “forge-1.12.2-14.23.5-installer.jar”, “forge-1.12.2-14.23.5.jar” and “minecraft_server.1.12.2”.
    This time we choose “forge-1.12.2-14.23.5.jar”, accept the EULA again and start the server, which should now stay up and running until you hit the “Stop” button.
    Do that now, because we are about to install some mods…
  • To put some mods on our forge server we will need the mods (obviously) but also an FTP-client to push them over.

We installed proFTP on the server and will use FileZilla as our client, which you can get here https://filezilla-project.org/ .
Once installed, you can connect to the server. Remember that root login is disabled. So we choose the unix username (which by default is “dietpi”).


Clicking on the server-icon on the left opens the Servermanager. Here you set your parameters:
Use FTP as your protocol, only plain FTP as encryption, use the IP we found out earlier with

ip a

the port is 21, the user is the unix user (by default it is “dietpi”) and the password is the one you set during installation.
Don’t worry about security, we are transferring files over LAN.

When you are connected it should look something like this


On the left is your computer, on the right the server.
The downloads folder is the place where we’ll put our mods at first. For security reasons this is the only folder we can put files into.
The others we can only access and read. This is useful if you want to check on the server log for example.
You can find it under /mineos/serverdata/servers/NiJoFeBo/logs/latest.log .

Drag and drop or select the files and right-click → “Upload” them to the downloads folder.

From there we need to move them to the right folder:
connect to the terminal via Putty again and type the following

mv /mnt/dietpi_userdata/downloads your-modfile.jar /var/games/minecraft/servers/NiJoFeBo/mods

or

mv /mnt/dietpi_userdata/downloads your_modfile.jar your_other_mod.jar your_other_other_mod.jar /var/games/minecraft/servers/NiJoFeBo/mods

if there is more than one mod.
(Obviously you’ll need to replace my .jar filenames with the real ones)

Last thing to do is starting the server again via webui in MineOS.
Eh Voila - your forge minecraft server with mods should be up and running and awaiting some players now.
.

  • Setting up internet access

But if you want someone to join from outside your LAN, there is still one thing to be done: set up a portmapper or DynDNS if you are lucky to still have a dedicated IPv4 address. More and more people nowadays have DS-Lite, so I will look at both possibilities:

IPv4:
Choose a provider like https://www.noip.com/ .
They offer one dynamic address in their free plan. Follow the instructions on the site to get your address up and running.
Then go to your server via Putty and install No-IP through dietpi-config under “8 : Network Options: Misc” and type in the username and password provided on the no-ip-site. Now set a port forwarding in your router. You need to forward port 25565 to your server.
In minecraft hit “add server” and type in the address: for example

no-ip.myserver.ddns.net:25565

IPv6:
First check your IP again in the terminal using Putty.

ip a

This will produce something like this:

root@Minecraft:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.xxx.xx/24 brd 192.168.xxx.255 scope global dynamic wlan0
       valid_lft 587044sec preferred_lft 587044sec
    inet6 xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/64 scope global dynamic mngtmpaddr
       valid_lft 4885sec preferred_lft 2185sec
    inet6 fe80::xxxx:xxxx:xxxx:xxxx/64 scope link
       valid_lft forever preferred_lft forever

I x-ed out all the numbers leaving the structure the global IPv6 has intact (usually it consists of numbers and letters, e.g. d654:a876:dea7:f78e: etc.):
in my case you can see it under 3: wlan0 → inet6 … scope global dynamic mngtmpaddr.
That is the global IPv6 address for your server, which now needs to be mapped with a portmapper to become available from outside your providers NAT (here is a link to a german Lexikon, explaining it very well Der Dual-Stack Lite (DS-Lite) - DasHeimnetzwerk.de).

Again you need to forward the address in your router. I have a Fritzbox, so here is what I did:
First of all you I activatede IPv6 in my Fritzbox.
Then I created a so called “Fritzbox-forwarding” instead of a normal port-forwarding: you will see what that means when you do it - it is self-explanatory.

For every other router out there you will have to google yourself on how to make an IPv6 forwarding.

Then you go to https://www.feste-ip.net/ , make an account and choose the Portmapper.


Put in the alias for your server, the global IPv6 address you obtained above and the port(s), in our case 25565.

When you are done you have again a simple IPv4 with a port you enter in minecraft by adding a server.
As you can see it is the alias you chose combined with feste-ip.net and then a random port that translates to 25565 through the portmapper:

youralias.feste-ip.net:58403 (for example)

Sadly feste-ip.net is not a free service: a portmapper costs 1 credit per day, 365 credits cost 5,-€, meaning you’ll have to invest 5,-€/year.
Lets see: A RaspberryPi 4 4GB costs about 80,-€. Add 5,-€ for one year portmapping. That is 85,-€.
Minecraft servers online start about 5,-€/month. So after 17 months the Pi-server has paid for itself.

Now hit the Start button in MineOS.
That’s it. You should now be able to play in your LAN as well as via internet with a few friends on a modded minecraft server, hosted by yourself at home, with no noise and very little power consumption, making it a very affordable alternative to online hosted servers!
I hope someone will have found in this little tutorial what he/she/it was looking for - I know I did :slight_smile:!

Cool!!!Thanks!!

Neat, it’s a really comprehensive tutorial anybody can follow!
I love the fact you used MineOS as well.

Hey,
I am stuck at the webui login for mineos and cant figure out how to log in, it would be amazing if anybody could help me with that

did you tried login data as describe on our online docs https://dietpi.com/docs/software/gaming/#mineos

Same to me, when i try to Login nothing happend, just kick back to Loginpage.
This is in my logs from mineos
{“level”:“info”,“message”:“Starting up server, using commit: c04a177 fix misslabled class initialization (#430)\n”,“timestamp”:"2021-08-24T1>

greetz

I’m seeing this exact same issue. Reported it in another thread: “Can’t log into MineOS - Software password incorrect

Hi! Nice tutorial.

However, I am currently stuck and I think there might be others with the same problem:

I have everything set up, except for my Fritz!Box: I am not able to forward a UDP Port via MyFritz and am curious as to how you did that. Did you use the regular (Fritz!) forwarding? Because that doesn’t work for me as well. The TCP forwarding works fine though

MyFritz is a DDNS service and should not have any effect on port forwarding

Inside your FritzBox, you should be able to set port forwarding for TCP as well as UDP.

Port Forwading is hidden in the Menu Internet > Permit Access (Internet > Freigaben)-

Hi Metryk,

on the FritzBox you can choose between MyFritz-Freigabe and Portfreigabe (I don’t know how they translate to the english UI, sorry - but the pics should explain):

You have to choose Portfreigabe. Under “Protokoll” you’ll also find UDP ;).

1 Like

My son uses a Minecraft management panel called Pterodactyl
I think it is capable of running multiple type distro’s of minecraft
Introduction | Pterodactyl

im having an issue loging into the http site

Nobody will be able to assist without further information on what exactly is not working.

when i try to login to MineOS it doesnt log me in. its like i hit refresh.
i also tried the: chpasswd -c SHA512 <<< 'root:password
all it did was this: >

here is my logs.

Jan 08 19:50:32 DietPi systemd[1]: Started MineOS (DietPi).
Jan 08 19:50:37 DietPi MineOS[890]: (node:890) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
Jan 08 19:50:37 DietPi MineOS[890]: (Use `node --trace-warnings ...` to show where the warning was created)
Jan 08 19:50:37 DietPi MineOS[890]: (node:890) [DEP0128] DeprecationWarning: Invalid 'main' field in '/mnt/dietpi_userdata/mineos/minecraft/node_
modules/node-getopt/package.json' of './lib'. Please either fix that or report it to the module author
Jan 08 19:50:37 DietPi MineOS[890]: first mineos configuration identified as /etc/mineos.conf
Jan 08 19:50:37 DietPi MineOS[890]: using base_directory:  /var/games/minecraft
Jan 08 19:50:37 DietPi MineOS[890]: (node:890) [DEP0128] DeprecationWarning: Invalid 'main' field in '/mnt/dietpi_userdata/mineos/minecraft/node_
modules/fireworm/package.json' of 'fireworm.js'. Please either fix that or report it to the module author
Jan 08 19:50:37 DietPi MineOS[890]: MineOS webui listening on HTTPS://0.0.0.0:8443
Jan 08 19:50:37 DietPi MineOS[890]: info: Starting up server, using commit: 1e040bb update ISO url

this is not working?

chpasswd -c SHA512 <<< 'root:new.password'

Just did a test and this was allowing me to login. Can't log into MineOS - Software password incorrect - #18 by Joulinar