Installing Sponge and Minecraft Forge on Debian 9

Published on: Fri, Apr 6, 2018 at 3:34 pm EST
This article is a port of "How to Install Forge and Sponge (Minecraft) on a CentOS 6 Server" for Debian 9.

Sponge is an open-source project that expands the capabilities of Minecraft servers through plugins. Combined with the modding API Forge, server hosts can create a highly unique experience for their players. In this tutorial, you will learn to setup a Minecraft server with both Forge and Sponge on a Vultr instance.

Note: While Sponge plugins only need to be installed on the server, Forge mods will often require any players on your server to also have the mod installed. If you choose to install any mods like that, be sure to give your players a heads-up.

Requirements

Installing Java and Screen

In order for the Minecraft server to run, we're going to need Java. We also need a tool called screen that we'll be using later. To install both of these at once, we'll use Debian's apt command. While we're at it, we'll also update the whole system.

Note: The # and $ symbols at the beginning of these lines are not meant to be typed, they are visual indicators of the command prompt.

# apt update && apt upgrade && apt install default-jre screen

When asked if you want to continue, type "y" and press "Enter".

Creating a new user (Optional)

It's generally a good idea to create a non-privileged user when running servers. While this isn't required, it's recommended to mitigate damage in the event of a security exploit.

First, we will create our new user named minecraft.

# adduser minecraft

Create a password and work your way through the prompts.

After that's been done, logout of the SSH client and reconnect using your new username and password. Your prompt will now look something like this.

minecraft@my-server:~$

Downloading Sponge

Create a new folder for the server files with the mkdir command and cd into it.

$ mkdir minecraft && cd minecraft

Create another folder called mods and cd into that.

$ mkdir mods && cd mods

Visit the SpongeForge download page and find a build that matches the version of Minecraft you'll be using for your server. For this tutorial, we'll be using version 1.10.2.

Instead of downloading the file, right click on the download link and click "Copy Link Location". Go back to your SSH session and paste the URL in a wget command.

$ wget https://repo.spongepowered.org/maven/org/spongepowered/spongeforge/1.10.2-2477-5.2.0-BETA-2731/spongeforge-1.10.2-2477-5.2.0-BETA-2731.jar

Take note of the number after the Minecraft version in the URL. This is the Forge build number. In this case, it's 2477. We'll need this in the next step.

Once you've finished that, return to the previous folder.

$ cd ..

Installing Forge

Go to the Forge download page, select your version of Minecraft, and hunt down the build number found in the last step. It will be after the last "." in Forge's full version numbers. For example, 12.18.3.2477 in our case. "Click Installer".

Once again, right click on the "Skip" button after the timer runs out and use "Copy Link Location". Paste this into a wget command.

$ wget http://files.minecraftforge.net/maven/net/minecraftforge/forge/1.10.2-12.18.3.2477/forge-1.10.2-12.18.3.2477-installer.jar

We'll need to run this file in Java. Type java -jar forge and press the "Tab" key to automatically complete the the filename. Type --installServer to complete the command.

$ java -jar forge-1.10.2-12.18.3.2477-installer.jar --installServer

Take note of the Forge installer's filename as we'll use part of it in the next step.

Writing a script to start the server

Next, we're going to write a script that can start up the server. We'll use nano to do this.

$ nano start.sh

From here, write the follow lines.

#!/bin/bash
java -Xmx[memory]M -jar [filename]

Replace [memory] with the amount of heap memory in megabytes you'd like the Minecraft server to use. Remember to leave some for the OS. On a 1GB server, use something around 768MB.

Replace [filename] with the filename from earlier but substitute -installer.jar for -universal.jar.

Here is an example of what it should look like.

#!/bin/bash
java -Xmx768M -jar forge-1.10.2-12.18.3.2477-universal.jar

Use "Control+X", press "y", and press "Enter" to save and exit.

Next, you need to mark the file as executable.

$ chmod +x start.sh

Agreeing to the EULA

You will now be able to run the script.

$ ./start.sh

The server will run for a little while and exit with an error. This is because Minecraft requires server owners to agree to its End User License Agreement. You can accept these terms by opening the newly created eula.txt and changing false to true.

$ nano eula.txt

After making your changes, once again use "Control+X", press "y", and press "Enter" to save them.

Keeping the server up with Screen

In order to keep the server running after closing the SSH window, we'll use a utility called screen.

$ screen

Press "Spacebar" to move past the information screen and then run the script file again.

$ ./start.sh

The Minecraft server will now successfully start.

Lastly, use "Control+A" and press "D" to suspend screen and then logout of your SSH client. You will now be able to connect through Minecraft using the Vultr server's IP address.

Should you need access the Minecraft server again (e.g. restarting it after installing mods/plugins or running Minecraft commands such as op), log back into the SSH client and use the command screen -r to resume the screen session.

Conclusion

In this tutorial you learned how to setup a Minecraft server with Minecraft Forge and Sponge. At this moment, however, it's still a mostly vanilla Minecraft experience. To start extending Minecraft's functionality, check out Forge mods at CurseForge and Sponge plugins at Ore.

Use an SFTP client or the wget technique described earlier to add these to the server. To install Forge mods, just place them in the mods folder. Sponge plugins belong in the plugins subfolder of mods. You might have to make this folder, however.

$ mkdir ~/minecraft/mods/plugins