Simple Mincraft Server on Ubuntu

My two daughters are becoming gamers as they see their dad gaming from time to time. Besides Roblox, they love Minecraft but just have 1 account. Thus I decided to build a local Minecraft server for them to let their imaginations run wild (aka creative mode=on). As I switched a while back to Proxmos, where I have an Ubuntu template build, I cloned a fresh one and installed and configured as follows;

Minecraft is using Java and, not to make it overcomplicated, I installed [screen] to leave the Minecraft server running after I close my connection on SSH. So after I changed the host name of my template (modify the /etc/hosts file), I installed java and screen and grabbed the latest server version of Minecraft. (just copy the download link to your clipboard)

albert@minecraft:~$sudo apt install openjdk-8-jdk -y
albert@minecraft:~$sudo apt install screen -y
albert@minecraft:~$wget shorturl.at/jGHNW

To see if everything is installed okay, execute the command java -version to check. As you can see I also start a screen session with the last command. You can find all the key combinations in the screen link here. (though I will tell you the most need to know)

albert@minecraft:~$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
albert@minecraft:~$ sudo screen -S "MCServer1"

Do note that from the last command output, I did not press [enter] as you do, a new screen will show and you won’t see the output. Once you do press enter, you will have an empty screen. I used the following line to start the Minecraft server and you will see it result in an error.

albert@minecraft:/home/albert/mcserver1# java -Xmx1024M -Xms1024M -jar server.jar nogui
[10:16:35] [main/ERROR]: Failed to load properties from file: server.properties
[10:16:35] [main/WARN]: Failed to load eula.txt
[10:16:35] [main/INFO]: You need to agree to the EULA in order to run the server.

So we first need to accept the EULA but also the [server.properties] file is created that we need to modify. I love [vi] to in order to accept the EULA, I executed the command [vi eula.txt] and on the third line I changed [eula=false] to [eula=true].

Next up is the settings. Because this is a test environment (ahem) and I did not have multiple Minecraft copies lying around, I used the vi editor to change just one value in the [server.properties] file; [online-mode=false] this is set to true by default to authenticate the accounts that are going to log in to the server.

Now lets launch it again and see what happens.

albert@minecraft:~/mcserver1$ sudo java -Xmx1024M -Xms1024M -jar server.jar nogui
[Server thread/INFO]: Starting minecraft server version 1.15.2
[21:55:51] [Server thread/INFO]: Loading properties
[21:55:51] [Server thread/INFO]: Default game type: SURVIVAL
[21:55:51] [Server thread/INFO]: Generating keypair
[21:55:51] [Server thread/INFO]: Starting Minecraft server on *:25565
[21:55:51] [Server thread/INFO]: Using epoll channel type
[21:55:52] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[21:55:52] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[21:55:52] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[21:55:52] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[21:55:52] [Server thread/INFO]: Preparing level "world"
[21:55:52] [Server thread/INFO]: Reloading ResourceManager: Default
[21:55:52] [Server thread/INFO]: Loaded 6 recipes
[21:55:53] [Server thread/INFO]: Loaded 825 advancements
[21:55:53] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[21:55:54] [Server thread/INFO]: Preparing spawn area: 0%
[21:55:54] [Server thread/INFO]: Preparing spawn area: 0%
[21:55:54] [Server thread/INFO]: Preparing spawn area: 0%
[21:55:55] [Server thread/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-2/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:58] [Server-Worker-3/INFO]: Preparing spawn area: 0%
[21:55:59] [Server thread/INFO]: Time elapsed: 5571 ms

Everything seems to be running and, as you can see from the screen-shot on top, I can connect to it. If you look good, you can also see that I changed the MOTD to “Girls Minecraft Server”. This is also changed in the [server.properties] file. I downloaded a version for the girls PC using TILauncher (just for testing ofc) and they could connect just fine.

Once they where in the game. I executed the command [op Sophinator] (where Sophinator the username is of one of my kids) so in-game they could execute [/gamemode creative]. This way they have all the blocks and can fly for them to let there imagination run wild :-)

To exit the screen where the server is running. Press both the [CTRL] and the letter [A] –> The next letter you will use is to [D] Detach the screen and be in your normal shell again. (With [C] you create a new session inside that screen and if you use the [N] it will go to your next screen) You can now exit the terminal and the server is still running. In order to reconnect, you can use the [screen -r] command to resume the screen. To check if the screen is still running, you can also execute a ls command as displayed below.

albert@minecraft:~$ screen -ls
There is a screen on:
9461.MCServer1 (06/07/2020 07:45:04 PM) (Detached)
1 Socket in /run/screen/S-albert.
albert@minecraft:~$

Next up is to add some plugins to the server but that will be for a next blog. For now, I have to build tunnels and castles :-)

Add a Comment

Your email address will not be published. Required fields are marked *