Setting up MineCraft Server in Ubuntu

To setup MineCraft server on Ubuntu, first you need to install Java.

apt install openjdk-8-jre -y

Create a user to run minecraft

useradd -m --shell /bin/bash minecraft

You can set a password if you want direct SSH login to this user or login as root, then “su – minecraft”.

Advertisement

passwd minecraft

Login as user minecraft with SSH or “su”.

Download minecraft server .jar file from

https://www.minecraft.net/en-us/download/server

At the time of writing, i downloaded

wget https://launcher.mojang.com/v1/objects/3dc3d84a581f14691199cf6831b71ed1296a9fdf/server.jar

Don’t use above link as it can get older, always go to minecraft site and get new link, so you get latest minecraft server jar file.

You can start minecraft server with command

java -Xmx1024M -Xms1024M -jar server.jar nogui

First time when you run, it exit with some error related to EULA.

You need to edit file

vi eula.txt

Set

eula=true

Now minecraft will run. You can create a run.sh file with following command for starting minecrat easily.

vi ~/start.sh

Paste following content

#!/bin/bash

java -Xmx1024M -Xms1024M -jar server.jar nogui

To make the file executable, chmod it 755

chmod 755 ~/start.sh

When you start minecraft from terminal/ssh, it get closed when you disconnect. To keep minecraft server running after you disconnect, use tmux or screen.

Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement