Comments on How to install Minecraft Server on Ubuntu 20.04 LTS

Minecraft is an open world and sandbox video game developed by Mojang Studios. In this tutorial, we will show how to setup your own Minecraft server on Ubuntu 20.04 LTS.

17 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: joe

in the first couple of command i keep getting a message that says

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

what do i need to do about this?

By: Jonathan

This whole tutorial is written under the assumption that you are logged in as root while you are executing it. Though it states that having root access is a pre-requisite, it does not state the assumption of the user being logged in as root, and does not address the fact that root access is not enabled in the default Ubuntu installation.

By: Adam

Just enter the command:

sudo -s

to become root user on Ubuntu. The follow the instructions of the tutorial.

By: Xadeone

Might sound like a completly dumb question but when executing the first step at "Create a systemd unit file for minecraft" it says that I don't have permission. Tried logging as root and of course it asked me for a password, but I didn't set any and I don't know what it is.

By: till

@Xadeone: Run the command:

 

sudo -s

 

to become root user. The password that it asks for is the password of your normal Linux user, the one that you use for administrative tasks via sudo.

By: vuk

how do i find the save files? i've been looking into all of the directories that i could think of, but i am guessing i've forgotten something. The reason i need the saves is because i'm trying to update the server to 1.16.4 but i want to keep the world that we've played on so far.

By: Abdul-Hakeem

The "sudo - minecraft" part doesn't seem to work. I have a root password configured, but it doesn't accept it. But if I just do "su" by itself, the password works.

What is the command supposed to do? Are you switching to root user, or to minecraft user? Or giving root privs to the minecraft user?

By: Frank

Hello,

 

using 

gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c

i get 

In file included from /usr/include/string.h:495,

                 from mcrcon.c:28:

In function ‘strncpy’,

    inlined from ‘packet_build’ at mcrcon.c:576:2:

/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]

  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));

      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

which looks like a failed work.

 

Do you have an idea what is missing?

 

Thanks in advance

Frank

By: Das

same

By: Gary Attaway

Thanks for the great tutorial. I had to make one modification to the Systemd Unit File:

ExecStop=/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -p your-password stop

Including the port number caused an error and the minecraft server did not shutdown.

By: iv

i did all the above and everything went as planned but when trying to join the server it sais: Failed to connect to the server

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused:

By: circusafro

The other things I've done with this: 

Create a script that will open the console for you: echo '/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 25575 -p [your-password] -t' > /opt/minecraft/console.shchmod +x /opt/minecraft/console.shUpdate the version of minecraft to the latest paper version (low resource utilisation):cd /opt/minecraft/serverwget https://papermc.io/api/v2/projects/paper/versions/1.16.5/builds/445/downloads/paper-1.16.5-445.jarmv server.jar original.jarln -s ./paper-1.16.5-445.jar ./server.jarsystemctl stop minecraftsystemctl start minecraftReconfigure the server to prefer IPV4 by adding "-Djava.net.preferIPv4Stack=true" to the service file aboveExecStart=/usr/bin/java -Xmx1024M -Xms1024M -Djava.net.preferIPv4Stack=true -jar server.jar nogui

Add the first admin user

./console.sh/op [user_name]This will automatically add the user to the ops.json file

By: Xadeone

I can't access de console. I've checked my password and ip, but it keeps throwing at me "Connection failed.Error 111: Connection refused" and I'm not sure what might be causing it.

By: stun

How do you upgrade server from 1.16 to 1.8?

By: Fred

Great tutorial!

Tank you!

By: Patrick

 

How do I solve this error?

LinkageError occurred while loading main class net.minecraft.server.Main    java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I'm running the lastest version:

java -versionopenjdk version "11.0.11" 2021-04-20OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

By: theo

I set up the server but i can not access it. the server seems to be running. idk what im missing. the server is hosted offsite