There are plenty of reasons why you’d want to set up a Minecraft server on your Linux machine. Perhaps you want to play local multiplayer later in the day because your friends are coming over, or maybe you like to have full control of the game. Either way, setting up a Minecraft server on Linux is a piece of cake, and we’ll show you how to do the same.
Prerequisites to Set up a Minecraft Server on Linux
Here are the prerequisites for setting up a Minecraft server on Linux:
- A Linux system, of course
- Java 17 and above
- Minecraft Server Java file (JAR)
Note: We’re running the Minecraft server locally in this guide, and it might impact the performance of your machine. Closing the terminal will kill the server, hence we recommend minimizing it as soon as you run it or open another instance if you want to do something else.
Set up a Minecraft Server on Your Linux System
Step 1: Install Java in Your Linux Distro
Minecraft is made in Java and so is the server file. Hence, you will first need to install the latest Java version to actually be able to run the server. Minecraft currently only supports Java 17 or above. Hence, we’ll be installing the latest version of the same. For starters, Java is an extremely popular programming language that’s used to develop applications. Installing Java on Linux using a terminal is straightforward.
You can install the latest Java version from its official website. Then all you need to do is enter a few commands and Java will be usable on your Linux system. The DEB and RPM installers are available for the most popular Linux distros, including Ubuntu/Debian-based distros and Fedora/CentOS. However, if you’re running Arch, Java can still be installed using Pacman.
With all of that out of the way, let’s learn how to install Java to power our Minecraft server on Linux:
1. Head over to the official Oracle website and download the Java Development Kit (JDK) available in .deb or .rpm packages.
![Download java](https://beebom.com/wp-content/uploads/2023/05/Java-Download.jpg?w=640)
2. Once downloaded, double-click on the package and install it using your distro’s default package installer.
![default package manager java](https://beebom.com/wp-content/uploads/2023/04/default-package-manager-java-e1682533272832.png?w=498)
3. Once installed, open the terminal and type the following command to ensure JDK is packaged and ready to be installed.
ls /usr/lib/jvm
![ls command to check jdk](https://beebom.com/wp-content/uploads/2023/04/ls-command-to-check-jdk-e1682533410851.png?w=640)
4. Next, type the following command to install Java on your Linux system.
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-20/bin/java 1
5. Once done, type the following command to check if Java has been successfully installed. You will get the Java version installed on your system in the output.
java -version
![java version command](https://beebom.com/wp-content/uploads/2023/04/java-version-command-e1682533498822.png?w=640)
Step 2: Download Minecraft Server Jar File
Now that we have Java up and running, the next step involves downloading the Minecraft Server Java file and running it on your Linux PC. To do so, follow these instructions:
1. Head over the Minecraft’s official website and download the Minecraft Server.jar file (Download).
![Minecraft Server download](https://beebom.com/wp-content/uploads/2023/05/Minecraft-Server-download-e1684304068939.png?w=640)
Step 3: Run the Minecraft Server File (First Time)
2. Once done, change the directory into the folder containing the jar file using the cd
command. For example, if you have saved the jar file on the desktop, execute the following command:
cd Desktop
![Running the minecraft server command](https://beebom.com/wp-content/uploads/2023/05/Running-the-minecraft-server-command-e1684301465295.png?w=640)
3. Next, copy and paste the following command and hit enter.
java -Xmx1024M -Xms1024M -jar server.jar nogui
If you’re confused about what this command means, we have explained it below:
- Xmx: Heap size. 1024M means one gigabyte. You can change this value depending on the number of players.
- Xms: Initial, minimum Java heap size. Again, this can be changed depending on the number of players.
- -jar: We’re letting Java know that a jar file needs to be executed.
- server.jar: Your Minecraft server file for Linux.
- nogui: Executing the command without this argument gives you a GUI to see the memory usage. This is optional.
4. Scroll all the way down to the output and you should see the command prompting you to accept the Eula (End user license agreement). For that, go to the location where your sever.jar file exists and find the eula.txt file.
![Finda the Eula.txt file](https://beebom.com/wp-content/uploads/2023/05/Finda-the-Eula.txt-file-e1684300692870.png?w=640)
5. Open it with any text editor and change “eula=false” to “eula=true,“ save it, and exit.
![change Eula false to true](https://beebom.com/wp-content/uploads/2023/05/change-Eula-false-to-true-e1684300748859.png?w=604)
Step 4: Start and Use Your Minecraft Server
6. Once done, run the command mentioned in the third step again, and it should fire things up. Here’s the command you need to paste into the Linux Terminal to run the Minecraft server:
java -Xmx1024M -Xms1024M -jar server.jar nogui
![Minecraft Java Server start](https://beebom.com/wp-content/uploads/2023/04/Minecraft-Java-Server-start-e1682533602864.png?w=640)
4. That’s pretty much it. Now you can launch Minecraft and join your new server alongside your friends.
![Minecraft gameplay linux](https://beebom.com/wp-content/uploads/2023/05/Minecraft-gameplay-linux-e1684302702907.png?w=640)
And that’s how you can set up your own Minecraft server on Linux and play with friends. Were you successful in creating a Minecraft server by following the instructions above? If you have any doubts, let us know in the comments section below.