Introduction
This article explains the steps to install Minecraft cloud gaming servers on Ubuntu 20.04.
Prerequisites
- Deploy a Rcs Ubuntu 20.04 instance with at least 1 GB of RAM.
- Update the Ubuntu server.
1. Create a Minecraft User
Create a sudo user named minecraft.
# adduser minecraft
# usermod -aG sudo minecraftSwitch to the new user.
# su - Minecraft2. Install Java and Screen
Update the package index.
$ sudo apt updateInstall Java.
$ sudo apt install openjdk-16-jdk -yInstall Screen. This allows your server to run without leaving your terminal open.
$ sudo apt install screen -yConfirm the installed packages.
$ sudo java -version3. Install the Minecraft Server
Create a new server directory for your server files.
$ mkdir minecraftMove to the directory.
$ cd minecraftInstall wget
$ sudo apt install wgetNavigate to https://www.minecraft.net/en-us/download/server to find the download links for the latest version of Minecraft. Download it with wget. For example, with version 1.16.4`, run:
$ sudo wget https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jarRun the server. The 1024M parameter in -Xms1024M -Xmx1024M configures Java for 1 GB of RAM. Change this to the amount of RAM you want to allocate for Minecraft. The operating system requires available RAM as well, please don't assign all available RAM to Minecraft. For example, if the server has 4 GB RAM, you might consider setting -Xms3072M -Xmx3072M.
$ java -Xmx1024M -Xms1024M -jar server.jar noguiYou should receive an similar output to this.
[main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.To agree to the EULA, edit eula.txt.
$ sudo nano eula.txtFind the line that says eula=false and change it to eula=true. Save and exit the file.
Create a startup script for your server.
$ nano start.shPaste the following into start.sh. Adjust the Xmx and Xms RAM values as needed.
#!/bin/sh
while true
do
java -Xmx1024M -Xms1024M -jar server.jar nogui
echo "restarting in 10"
sleep 10
doneSave and exit the file.
Make start.sh executable.
$ chmod +x start.shCreate a screen instance for the server.
$ sudo screen -S "Minecraft Server"Start your server script.
$ ./start.shTo exit the screen session, press Control + A then D. To resume the screen session, run:
$ sudo screen -RServer Modification Tips
Here are some tips for your Minecraft server:
- You can use Minecraft commands in the screen session without a leading
/. For exampleop @awill make everybody online a server operator. - To modify the general game settings for your Minecraft server, input the command
sudo nano server.propertiesto get access to them. - The Minecraft server creates a new directory called
worldon the first launch for Minecraft modifications, datapacks, and other features.