How to setup Minecraft server on Ubuntu 18.04 Bionic Beaver Linux - LinuxConfig.org

The following article will describe a Minecraft server configuration procedure on Ubuntu 18.04 Bionic Beaver Linux. Let's start by installation of all prerequisites including the nmap command which we can later use for some basic troubleshooting purposes:
$ sudo apt update
$ sudo apt install wget screen default-jdk nmap 

This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-setup-minecraft-server-on-ubuntu-18-04-bionic-beaver-linux
NOTE: SOME OF THE COMMENTS BELOW TRANSFERRED FROM THE LINUXCONFIG DISQUS COMMENTS.

Poster Guy
How can I open the console for the server? Hopefully this is a quick and easy question. Thank you :slight_smile:

Flan OBrien

nmap -p 25565 localhost
Starting Nmap 7.70 ( https://nmap.org ) at 2018-06-02 10:14 WITA
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000087s latency).

PORT STATE SERVICE
25565/tcp closed minecraft

Thanks for the article.
Any idea why the STATE might be closed?

AndreEnderMC

I followed the guide and got the server to start, but whenever I try to join it it says: Authentication Servers are down for maintenance. (This usually only happens when mojang’s servers are down) I found this weird because I could still connect to 5 different servers which meant I was the one with the problem. I also got my friend to try to connect and he said that the authentication server failing was also displayed on his screen. I have been able to get a server to work successfully in Kubuntu 17.04 and 17.10 but with 18.04 I am encountering this problem.

What I have found to allow me to access it is to set online-mode=false in server.properties; however, this does allow me to join but not my friend, and this leaves the server open for access by “pirate” versions of Minecraft according to what I have read as well as failing to load in player skins. Since 18.04 has been released recently I am not able to find information online to help, so I came here hoping I can find a response.

AndreEnderMC -> AndreEnderMC

So far the only work around that I have found is to use a virtual machine on an older version of Kubuntu to get it to work. I hope this gets fixed soon though, as I don’t really like the limitations this creates.

James Lex -> AndreEnderMC
Finally got mine running! Remove Java using the top answer from this link:

https://askubuntu.com/quest...

Then install Java 8 JDK:

sudo apt-get install openjdk-8-jdk

Started up the server again and it was working.

Lubos Rendek Mod -> James Lex

Hi James,

thank you for your input! Are you saying that the issue is with the open-jdk version. Your suggestion is that instead the default jdk version ( currently 11 ) and you suggest that Minecraft server only works properly with open-jdk 8?

thanks

James Lex -> Lubos Rendek

Yes, I believe that is what I’m saying. :stuck_out_tongue: I’m new to Ubuntu, so I’m not sure what version (or versions) of Java was installed by default.

I followed the instructions listed on this How To, and when it didn’t work, I checked my Java version (I think I used sudo java -version) and found I had both 8 and 11 installed. I tried removing only 11, but still had the Authentication issue.

Once I completely removed all versions of Java and ran the command listed in my previous comment, it worked fine.

Ben Povey -> AndreEnderMC

I’m having the same problem. all i could find that seemed relevant was this (https://www.minecraftforum....

but it didn’t work for me. I’m stuck. i have 2 separate minecraft server installs via different install methods. firewalls off, ports forwarded. tried running as root.

If i run a server on windows, everyone authenticates just fine.

My difference is i did have friends connect when in offline mode.

Usually you can do this by logging in as the user that is running the server. and then enter “screen -r”

FWIW, I have an ESXi 6.7 host in my garage and created a Ubuntu 18.04 Server build for the sole intent of running minecraft for my kids and their friends.

I followed various other tutorials, this one is the only one to use a system account for the user minecraft, which is why someone cannot "screen -r " to the instance. No biggie for me. I was having the external (internet) side kids get disconnected and timeouts after connecting for a few seconds. It turned out that my gateway VM wasn’t sending their packets through quick enough, so I had to put their minecraft port in bypass mode. Strange, since the physical box didn’t need that attention. Either way, it works and they’re happy. Cheers.

Using the wget command with 1.13 in place of version I get a forbidden 403. Tried to put whole command I use but got rejected since I’m a new user for including a link. Ubuntu server 18.04

One of the thing i was able to do to access the server was to change the server.properties find the line that says “online-mode=true” to “online-mode=false” and I was able to login and play with no problem. It seems that there is a cert issue or perhaps you have to white list plays I am not sure but I know what I was able to play once I made those changes

How exactly does one sign into “minecraft” to view the console?

I’m trying to get a server up with creative. How would one go about that? I changed “gamemode=survival” to “gamemode=1” or “gamemode=creative” in the server.properties file and restarted the server but when I connect it is still in survival mode. Help?

Error on stop service (IOException) because the interrupting server process before it exit.
Then, I add the a line to sleep after line to stop server, according this:

ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval ‘stuff “say SERVER SHUTTING DOWN IN 8 SECONDS. SAVING ALL MAPS…”\015’
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval ‘stuff “save-all”\015’
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval ‘stuff “say SERVER SHUTTING DOWN IN 3 SECONDS…”\015’
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval ‘stuff “stop”\015’
ExecStop=/bin/sleep 3

I’m very late to the party (in COVID quarantine), but Google brought me here to build a Minecraft server and I happened to have the same issue as “Flan OBrien” where port 25565 is in a “closed” state when running the server through systemctl. It was fine if I run the java command directly, however.

The issue is with the “minecraft” user that is being created. I actually don’t know why the guide’s method to create the “minecraft” user doesn’t work, but the result is the listening port never opens. I did find another method which did work for me. The differences are that the command in this guide doesn’t use the -U switch (which creates the “minecraft” group… but without the -U switch it automatically creates it). I also added the -s switch with /bin/bash. Without that switch, it would choose whatever shell is in the variable ‘SHELL’ in the “/etc/default/useradd” file or leave it blank. Mine is set to /bin/sh which in Ubuntu is just a symbolic link to /bin/dash. I’ve never heard of the “dash” shell - you can google it, but I’m wondering if that’s the issue. I actually am not sure, but maybe by specifying /bin/bash on my system gave it the environment it needed to open the listening port. I really don’t know, but below is what worked for me:

This is what I did:
sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft

If you had already created the minecraft user from this guide, and the above command tells you that there is already a user named “minecraft”, you can do this to remove it:

sudo deluser --remove-home minecraft

If you try to delete the user, but you had already launched the minecraft server via systemctl (which uses the minecraft user and also has “Restart=always” in the “minecraft@.service”) - it will tell you that the user is being used to run a process and will give you a proccess ID (PID).

First, edit the minecraft@.service file:
ex. sudo vim /etc/systemd/system/minecraft@.service

Find “Restart=always” and put a # in front of it:
#Restart=always

Save the file, then restart the minecraft server using systemctl:
ex. systemctl restart minecraft@survival

Now you can delete the user, then create it again.

Lastly, go back to the /etc/system/system/minecraft@.service file and remove the comment from #Restart=always so that it looks like this again:
Restart=always

Hope this helps someone. This worked on Ubuntu 18.04 and also 20.04 on June 30, 2020.

Hi,

Thanks for your tutorial, it works perfecty on my proxmox server. I just want to ask? how to add custom world that already save. And where I can find auto save settings on the server?