Want to host a Minecraft server on Linux? If so, you need to be running the Java edition, as Microsoft only allows Linux Minecraft servers to run that way. To run a Minecraft server on Linux, you’ll need the Java Runtime environment.platform with the Java edition. Installing Java might be annoying. However, it’s straightforward to install Java on Linux, so let’s get going!
Install Java Runtime
In this guide, we’ll focus on the concept of hosting a Minecraft server on a Linux operating system. We won’t specifically focus on using a Linux server operating system, because it’s not required. However, if you’re looking to have a dedicated Minecraft server on Linux, you should probably go that route, and we recommend Ubuntu server.
Note: there are many versions of the Java Runtime environment on Linux, both Oracle’s official release and the open source alternative. For this tutorial, we’ll use the official Oracle version. That said, it’s perfectly OK to use the OpenJDK setup as an alternative, and everything should run just as well.
Oracle’s Java runtime isn’t easy to install on Ubuntu. However, adding a PPA makes this much less of a headache. Due to the nature of how Ubuntu server works, this PPA should work fine on both Ubuntu desktop, and Ubuntu server. However, if you add the PPA to Ubuntu server and find issues, consider installing the OpenJDK JRE runtime as an alternative.
To add the Oracle Java Runtime PPA to your system, open up a terminal and enter the following:
sudo add-apt-repository ppa:webupd8team/java
Run apt update to refresh Ubuntu’s software sources.
sudo apt update
After running the update, use apt upgrade to install any updates that show up.
sudo apt upgrade -y
Lastly, install Oracle Java from the software repository.
sudo apt install oracle-java9-installer sudo apt install oracle-java9-set-default
Debian can access the Ubuntu Oracle Java PPA. To add it, you’ll need to edit your /etc/apt/sources.list file. Open up a terminal and launch Nano.
Oracle Java not working? Consider using the Open source alternative instead.
sudo nano /etc/apt/sources.list
Paste the following code into the Nano editor:
deb https://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src https://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
Save the Nano editor with Ctrl + O, then use the terminal to add the PPA’s software GPG key.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 sudo apt-get update
Lastly, install Java.
sudo apt-get install oracle-java9-installer sudo apt-get install oracle-java9-set-default echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
Oracle has pretty good support for all Redhat based Linux operating systems, so installing it is very easy. That said, if you have issues, you may want to look into the open source alternative.
To install the latest version of the Oracle Java Runtime Environment, go to the download page and get the newest RPM.
Once downloaded, open up the terminal, CD to the ~/Downloads directory and run the installer.
sudo dnf jre-8u171-linux-x64.rpm
sudo yum jre-8u171-linux-x64.rpm
sudo zypper jre-8u171-linux-x64.rpm
Run Minecraft Java Edition Server
After getting Java working, the hard part is done. Now all that’s left to do is to download the latest version of the Minecraft Java Edition server app and run it. When downloaded, open up a terminal use the MV command to place the server app in an appropriate location.
Note: if you are using a server OS, you may need to download and place the file manually. The instructions below are specifically for those running a Minecraft server on an OS that has a proper Home folder structure set up.
mkdir ~/Minecraft/server/ mv ~/Downloads/server.jar ~/Minecraft/server/
Run the server headless (no GUI) with:
java -Xmx1024M -Xms1024M -jar ~/Minecraft/server/server.jar nogui
Alternatively, run the Minecraft server with a GUI interface:
java -Xmx1024M -Xms1024M -jar ~/Minecraft/server/server.jar
Now that the Minecraft Java edition server is running, you’ll need to distribute the IP address for it. For best results, host this server at your own home on LAN. If you must host one online, consider doing it on a VPS like DigitalOcean, as they offer great rates to run Linux apps on.
Note: if you are running an online server, be sure that port 25565 is forwarded or the server will not work!
To find the local IP address, run in a terminal:
ip addr show | grep 192.168.1
This command will isolate the server’s LAN IP.
From there, distribute your IP address to any who needs to connect and instruct players to add the IP to their Minecraft client.
Running your Minecraft server online and not just on LAN? You’ll need to go through and find your server’s external IP address. Finding this address should be easy to do within most VPS dashboards.