Week 19 – Setting Up a Minecraft Server

Last week, I went in-depth about how you can install Ubuntu Linux on an old laptop to run various applications on it such as a webserver or Minecraft server. Today, I’m going to talk about the steps required to run a Minecraft Java Edition server with Ubuntu so that you can play with friends, and next week I’m going to show you how you can even add a plugin for crossplay so that your friends on the pocket edition or windows 10 edition can join you. The first step is to make sure you have java installed, but before that, you’ll want to make sure all of your packages are up to date. Open the Ubuntu terminal and type

sudo apt update

followed by

sudo apt upgrade

The Minecraft Java Edition server is coded in Java, so you’ll need to have Java 8 installed. To install Java, use the following command:

sudo apt install openjdk-8-jdk -y

You can now close the terminal. The next thing you’ll have to do is download the papermc server JAR file. To do this, navigate to https://papermc.io/downloads and click on the download button next to the newest build. Builds are released daily, and you will be able to update the server in the future by simply replacing the JAR file. Create a new folder on your desktop named “server” or any other name without spaces, and drag the new JAR file into it. Rename the JAR file to “server.jar”. Then, create a new text file named “start.sh”. The contents of the file should be as follows:

sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

the “-Xmx” and “-Xms” flags tell the server how much RAM should be dedicated. For 5 people or less, I recommend you set it to 2048M for a smooth experience, but you can add more or less depending on how much ram the system has. To start the server, open a new terminal window. Type in the following commands (excluding notes in parentheses) to navigate to the new folder and start the JAR

cd Desktop
cd server (or whatever the name of the new folder is)
sh start.sh

The first time you do this, you’ll notice a new file in the folder called “eula.txt”. Open this in your text editor of choice and change “eula=false” to “eula=true”. Save the file and exit the text editor. Assuming you left the terminal open, you should be able to run “sh start.sh” again. Otherwise, use the commands above to navigate back to the folder and run the start script. If all goes according to plan, you should see some new information in the terminal window like this:

Loading libraries, please wait...
[14:35:08 INFO]: Starting minecraft server version 1.15.2
[14:35:08 INFO]: Loading properties
[14:35:09 INFO]: This server is running Paper version git-Paper-268 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)

Congratulations! You’re almost done. After the server is done generating terrain, a “>” symbol will appear next to which you will type “stop” in the terminal and press ENTER. you will now have to edit a new file called “server.properties” in the folder with the server. There are multiple features to be turned on and off which you can read about here, but the only one we need to worry about for now is the one called “server-ip=”. Open a new terminal beside the one you were using to run the server, and run “sudo apt install net-tools” to install the ifconfig command which we will use to find the local IP of the machine. then, run “ifconfig” and you will be prompted with a slurry of numbers. If the machine is connected to the internet via ethernet, take note of the “inet addr:” under “eth0”, or if it is on Wi-Fi check the “inet addr:” under “wlan0”. This is the local IP address of the machine you are running the server on. Copy this after the “=” in “server-ip=” in the server.properties and save the file. Go back to the terminal where you were running the server.jar file and run “sh start.sh” again. Your new Minecraft Java Edition server is now accessible from other computers on your network using the server’s local IP, but if you want your friends to be able to access it from elsewhere as well, you’ll need to change the port forwarding configuration on your router, which I will be covering in next week’s post.

1 comment

Leave a Reply

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