Install Minecraft Ubuntu Java

Installing Minecraft on Ubuntu and derivatives Download the Package. First of all, visit the official website. Select the.DEB package, among others, and let it download. NOTE: Make no mistake; this is not the full version of the game. As most of you probably already know, the full version is to be paid for.

Install Java Minecraft is written in Java language, so you will need to install the headless version of Java in your system. You can install it with the following command: apt. Install Minecraft on Hyper-V Ubuntu JAVA. Get the best of STH delivered weekly to your inbox. We are going to curate a selection of the. Minecraft is a sandbox type game that allows other players to explore and build an endlessly generated 3D world. By owning a Minecraft server you can set the rules of the game to create personalized experiences. This guide will allow you to configure a server for Minecraft on Ubuntu 18.04. First, connect to your server via an SSH connection.

Posted by ARwebhosting on Mar 29, 2019 in linux | 0 comments

Minecraft is one of the most popular games of all time. It is a sandbox video game about placing blocks and going on adventures.

This tutorial covers the installation and configuration of the Minecraft Server on Ubuntu 18.04. We’ll use Systemd to run the Minecraft server and the mcrcon utility for connecting to the running instance. We’ll also show you how to create a cron job that performs regular server backups.

The same instructions apply for Ubuntu 16.04 and any Ubuntu based distribution, including Linux Mint and Elementary OS.

Prerequisites

The user you are logged in as must have sudo privileges to be able to install packages.

Install the packages required to build the mcrcon tool:

sudo apt update
sudo apt install git build-essential

Installing Java Runtime Environment

Minecraft requires Java 8 or greater. Because the Minecraft Server doesn’t need a graphical user interface, we’ll install the headless version of the JRE. This version is more suitable for server applications since it has less dependencies and uses less system resources.

The installation of Java is pretty simple. Start by updating the package index:

Install the headless OpenJRE 8 package by running:

sudo apt install openjdk-8-jre-headless

Verify the installation by printing the java version:

openjdk version “1.8.0_191”
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Creating Minecraft User

For security purposes, Minecraft should not be run under the root user. We will create a new system user and group with home directory /opt/minecraft that will run the Minecraft server:

sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft

We are not going to set password for this user. This is good security practice because this user will not be able to login via SSH. To change to the minecraft user you’ll need to be logged in to the server as root or user with sudo privileges.

Installing Minecraft on Ubuntu

Before starting with the installation process, make sure you switch to minecraft user.

Run the following command to create three new directories inside the user home directory:

mkdir -p ~/

  • The backups directory will store your server backup. You can later synchronize this directory to your remote backup server.
  • The tools directory will be store the mcrcon client and the backup script.
  • The server directory will contain the actual Minecraft server and its data.

Downloading and Compiling mcrcon

RCON is a protocol that allows you to connect to the Minecraft servers and execute commands. mcron is RCON client built in C.

We’ll download the source code from GitHub and build the mcrcon binary.

Start by navigating to the ~/tools directory and clone the Tiiffi/mcrcon repository from GitHub using the following command:

cd ~/tools && git clone https://github.com/Tiiffi/mcrcon.git

When the cloning is finished, switch to the repository directory:

Start the compilation of the mcrcon utility by typing:

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

Once completed, you can test it by typing:

The output will look something like this:

Usage: mcrcon [OPTIONS]… [COMMANDS]…
Sends rcon commands to minecraft server.

Option:
-h Prints usage.
-s Silent mode. Do not print data received from rcon.
-t Terminal mode. Acts as interactive terminal.
-p Rcon password. Default: “”.
-H Host address or ip.
-P Port. Default: 25575.
-c Do not print colors. Disables bukkit color printing.

Individual commands must be separated with spaces.

Example:
mcrcon -c -H 192.168.1.42 -P 9999 -p password cmd1 “cmd2 with spaces”

minecraft rcon (mcrcon) 0.0.5.
Report bugs to tiiffi_at_gmail_dot_com.

Downloading Minecraft Server

Install minecraft ubuntu java edition

There are several Minecraft server mods like Craftbukkit or Spigot that allows you to add features (plugins) on your server and further customize and tweak the server settings. In this tutorial we will install the latest Mojang’s official vanilla Minecraft server.

The latest Minecraft server’s Java archive file (JAR) is variable for download from the Minecraft download page.

At the time of writing, the latest version is 1.13.2. Before continuing with the next step you should check the download page for a new version.

Run the following wget command to download the Minecraft jar file in the ~/server directory:

wget https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar -P ~/server

Configuring Minecraft Server

Once the download is completed, navigate to the ~/server directory and start the Minecraft server:

cd ~/server
java -Xmx1024M -Xms512M -d64 -jar server.jar nogui

When you start the server for the first time it executes some operations and creates the server.properties and eula.txt files and stops.

[03:33:56] [main/INFO]: Loaded 0 recipes
[03:33:56] [main/INFO]: Loaded 0 advancements
[03:33:56] [Server thread/INFO]: Starting minecraft server version 1.13.2
[03:33:56] [Server thread/INFO]: Loading properties
[03:33:56] [Server thread/WARN]: server.properties does not exist
[03:33:56] [Server thread/INFO]: Generating new properties file
[03:33:56] [Server thread/WARN]: Failed to load eula.txt
[03:33:56] [Server thread/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
[03:33:56] [Server thread/INFO]: Stopping server
[03:33:56] [Server thread/INFO]: Saving worlds
[03:33:56] [Server Shutdown Thread/INFO]: Stopping server
[03:33:56] [Server Shutdown Thread/INFO]: Saving worlds

As you can see from the output above we need to agree to the Minecraft EULA in order to run the server. Open the eula.txt file and change eula=false to eula=true:

~/server/eula.txt

#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
#Thu Dec 27 03:33:56 PST 2018
eula=true

Close and save the file.

Next, we need to edit the server.properties file to enable the rcon protocol and set the rcon password. You can use this settings to connect to the Minecraft server using the mcrcon tool.

nano ~/server/server.properties

~/server/server.properties

rcon.port=23888
rcon.password=strong-password
enable-rcon=true

Do not forget to change the strong-password to something more secure. Alternatively you can specify another port.
If you dont want to connect to the Minecraft server from remote locations make sure the rcon port is blocked by your firewall.

While here, you can also adjust the server’s default properties. For more information about the possible settings visit the server.properties page.

Creating Systemd Unit File

To run Minecraft as a service we will create a new Systemd unit file.

Switch back to your sudo user by typing exit.

Open your text editor and create a file named minecraft.service in the /etc/systemd/system/:

sudo nano /etc/systemd/system/minecraft.service

Paste the following configuration:

/etc/systemd/system/minecraft.service

[Unit]
Description=Minecraft Server
After=network.target

Install

[Service]
User=minecraft
Nice=1
KillMode=none
SuccessExitStatus=0 1
ProtectHome=true
ProtectSystem=full
PrivateDevices=true
NoNewPrivileges=true
WorkingDirectory=/opt/minecraft/server
ExecStart=/usr/bin/java -Xmx1024M -Xms512M -jar server.jar nogui –noconsole
ExecStop=/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 23888 -p strong-password stop

[Install]
WantedBy=multi-user.target

Modify the Xmx and Xms flags according to your server resources. The Xmx flag defines the maximum memory allocation pool for a Java virtual machine (JVM), while Xms defines the initial memory allocation pool. Also make sure that your are using the correct rcon port and password.

Save and close the file and notify systemd that we created a new unit file:

sudo systemctl daemon-reload

Now you can start the Minecraft server by executing:

sudo systemctl start minecraft

The fist time you start the service it will generate several configuration files and directories including the Minecraft world.

Check the service status with the following command:

sudo systemctl status minecraft* minecraft.service – Minecraft Server
Loaded: loaded (/etc/systemd/system/minecraft.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2018-12-27 04:52:51 PST; 3s ago
Main PID: 15997 (java)
Tasks: 552 (limit: 2319)
CGroup: /system.slice/minecraft.service
`-15997 /usr/bin/java -Xmx1024M -Xms512M -jar server.jar nogui –noconsole

If there are no errors enable the Minecraft service to be automatically started at boot time:

sudo systemctl enable minecraft

Adjusting Firewall

If your server is protected by a firewall and you want to access Minecraft server from the outside of your local network you need to open port 25565.

To allow traffic on the default Minecraft port 25565 type the following command:

Configuring Backups

In this section we’ll create a backup shell script and cron job to automatically backup the Minecraft server.

Start by switching to minecraft user:

Open your text editor and create the following file:

nano /opt/minecraft/tools/backup.sh

Paste the following configuration:

/opt/minecraft/tools/backup.sh

Install Minecraft Ubuntu Java

#!/bin/bash

function rcon {
/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 23888 -p strong-password “$1”
}

rcon “save-off”
rcon “save-all”
tar -cvpzf /opt/minecraft/backups/server-$(date +%F_%R).tar.gz /opt/minecraft/server
rcon “save-on”

## Delete older backups
find /opt/minecraft/backups/ -type f -mtime +7 -name ‘*.gz’ -delete

Save the file and make it executable:

chmod +x /opt/minecraft/tools/backup.sh

Next, create a cron job that will run once in a day automatically at a fixed time.

Open the crontab file by typing:

To run the backup script every day at 23:00 paste the following line:

Install Java Ubuntu 20

0 23 * * * /opt/minecraft/tools/backup.sh

Accessing Minecraft Console

To access the Minecraft Console you can use the mcrcon utility. The syntax is as follows, you need to specify the host, rcon port, rcon password and use the -t switch which enables the mcrcon terminal mode:

/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 23888 -p strong-password -tLogged in. Type “Q” to quit!
>

To access the Minecraft Console from a remote location make sure the rcon port is not blocked.

If you are regularly connecting to the Minecraft console, instead of typing this long command you should create a bash alias.

Conclusion

You have successfully installed Minecraft server on your Ubuntu 18.04 system and setup a daily backup.

Install Minecraft Ubuntu Java

If you hit a problem or have feedback, leave a comment below.

Leave a Reply

You must be logged in to post a comment.

Are you looking for a fun game to play on Linux? Have you been playing Minecraft for years on a different operating system and would like to know how to install it on your favorite distribution? Regardless of which category you fall into, this article is here to answer all questions you may have regarding installing Minecraft on Linux.

What Is Minecraft?


Minecraft is one of those video games that even people who don’t game at all can instantly recognize. Its creator, Markus “Notch” Persson, first released it in 2009, and it has since then become the bestselling video game of all time.

Most Minecraft players would agree that the secrete to the game’s success lies in its creativity-inspiring design. Players are free to explore a large, procedurally generated world made of blocks, each of which can be interacted with, moved, or transformed into resources for crafting.

This blocky world is occupied by AI-controlled monsters, friendly villagers, and, in multiplayer mode, other players. Minecraft can be played either as a survival game or sandbox, and players are free to modify its gameplay mechanics and create new assets for it.

Because Minecraft is written in the Java programming language, it runs on Linux, Windows, and macOS. Keep in mind that there are several versions of Minecraft, and this article is about Minecraft: Java Edition.

Minecraft

Install Minecraft on Ubuntu and its Derivatives

Install Java On Ubuntu

Thanks to the official .DEB package, installing Minecraft on Ubuntu and its derivatives is a breeze, and the whole process won’t take you more than a few minutes.

Install Minecraft Ubuntu Java Version

Step 1: Download the Installation Package

The first thing you need to do is download the Minecraft .DEB package from Minecraft’s official website. You can either open the alternative download page in your favorite web browser and download it from there, or you can use the following command and download the package to your home folder using wget:

Step 2: Install Minecraft

We recommend you use a small tool called gdebi to install the Minecraft .DEB package because it automatically resolves all dependencies.

Install gdebi:

Use gdebi to install the Minecraft.deb package:

Step 3: Launch Minecraft

To launch Minecraft on Ubuntu and its derivatives, simply search for the Minecraft Launcher and run it. If everything goes right, the Minecraft Launcher should start right away, prompting you to enter your email address and password.

Once you’ve logged in, click the Play button and enjoy Minecraft—there’s really nothing more to it!

Install Minecraft on Other Distributions

Because Minecraft was programmed in Java, you can get it to run on just about any Linux distribution with the Java Runtime Environment installed and working 3D graphics drivers.

Step 1: Install Java Runtime

The Java Runtime Environment (JRE) provides all the necessary components to run Java applications. Most Linux distributions offer multiple options when it comes to executing Java programs:

  • Headless JRE: This minimal version of the Java Runtime Environment is intended for running Java applications that don’t have a graphical user interface. As such, it can’t be used to run Minecraft on Linux.
  • Full JRE: This version of the Java Runtime Environment depends on the headless version, and it includes everything you need to execute Java applications with a graphical user interface, including Minecraft.
  • Java Development Kit (JDK): Intended for Java developers, the JDK includes a Java Virtual Machine (JVM) and other resources necessary to develop Java software applications.

The most popular open-source implementation of Java is called OpenJDK. There’s also Java SE, which is Oracle’s implementation of JRE and JDK. Starting from Minecraft 1.12, Java 8 is required to run Minecraft, but it doesn’t really matter if you choose OpenJDK or Java SE.

To check which version of Java is installed on your Linux distribution, enter the command “java -version” in the terminal.

Step 2: Install Graphics Drivers

To enjoy Minecraft on Linux, you need working 3D acceleration. You can test 3D acceleration using a popular OpenGL test called glxgears, which is part of the mesa-utils package.

First, install the mesa-utils package (it should be in your distribution’s repositories) and then enter “glxgears” in the terminal. A new window with three spinning gears will appear, and you’ll be able to see the number of rendered frames in the terminal. Because glxgears requires very little processing power, any decently powerful Linux computer with working 3D acceleration should be able to render hundreds of frames every second.

If the gears appear to be choppy, your 3D acceleration isn’t working, and you need to install the correct graphics driver for your graphics card.

Step 3: Install & Launch Minecraft

To launch Minecraft on a distribution that’s not based on Ubuntu, you need to download the Minecraft.tar.gz archive from the alternative download page.

Then, extract the archive and launch the executable file called minecraft-launcher using the following command:

If this seems like too much work, you can also install the Minecraft snap package on any Linux distribution that ships with Snap preinstalled (any recent Ubuntu release, most recognized Ubuntu flavors, Solus 3, and Zorin OS):

How to Uninstall Minecraft on Linux

Minecraft creates a hidden folder (.minecraft) in the home directory. The folder is used to store information about your Minecraft profile and progress in the game. To delete it:

  1. Open the terminal.
  2. Enter the following command: rm -vr ~/.minecraft/*

Conclusion

Even though the length of this article may make the installation of Minecraft feel somewhat intimidating, we can assure you that there’s nothing difficult about it at all, especially if you’re using Ubuntu or some distribution based on it.