Creating a Network of Minecraft Servers With BungeeCord on Debian 8, Debian 9, or CentOS 7
What you'll need
- A Vultr VPS with at least 1GB of RAM.
- SSH access (with
Step 1: Installing BungeeCord
First thing's first, we need to get Java installed for this to work. Depending on whether you're using a Debian-based operating system or CentOS, the commands will be slightly different for each operating system. Each command will note the operating system that should use it. If all CentOS 7, Debian 8 and Debian 9 support it, no special marking will be shown.
Operating system: CentOS 7
yum install java-1.7.0-openjdk-devel screen -y
Operating system: Debian 8 and Debian 9
apt-get update apt-get install openjdk-7-jdk screen -y
What you'll want to do next is create a separate user to run the server. While this is optional, it is strongly recommended that you never host any public facing systems as the
root user. This opens up your VPS to being exploited, and this may result in the termination of your server here at Vultr should it be used for illegal purposes, even if it isn't caused by you.
CURRENT_USER='bungeemc' useradd $CURRENT_USER -m -d /home/bungee
Feel free to change the username from
bungeemc, though it'll be the user used throughout the article.
Then, log in as the user.
Now, create a folder for the BungeeCord server.
mkdir ~/bungeeServer cd ~/bungeeServer
Download the server's executable.
Let's run it for the first time.
java -Xms256M -Xmx512M -jar BungeeCord.jar
Generally, for the command shown above, you'll want to leave at least 128MB of RAM free to allow the system to run smoothly. Otherwise, you may run into trouble later as the operating system's low memory application killer will kill your server when memory runs low.
At this point, you should hit
CTRL+C to exit the server prompt. All of the required files have been generated, so we can proceed with the configuration.
Step 2: Configuring BungeeCord
For this article, we will only be adding a single Minecraft server for the lobby behind BungeeCord's proxy. Later in the article, additional information will be given on adding additional servers on either extra Vultr VPS servers or on the current system.
Using your favorite text editor, open up the file named
Caution: The syntax of a YAML file is very important. Java is very picky about the spacing.
Add yourself as an administrator. Change
md_5 to your Minecraft username.
Adding additional administrators requires you to first put two spaces, write a username, add a colon, go to the next line, add another two spaces and the
- admin flag.
At the end, it should look like this.
groups: myMCUsername: - admin extraAdmin: - admin
ip_forward: false to
ip_forward: true. This will allow any target servers to view the client's IP, which allows IP-based bans to be issued.
Move over to the line with
player_limit. Change the default from
1 to the amount of slots. If this value is set to
-1, an unlimited amount of players can join.
Here's what your
listeners section should look like.
listeners: - max_players: 1000 priorities: - lobby proxy_protocol: false host: 0.0.0.0:25565 tab_size: 60 force_default_server: false bind_local_address: true ping_passthrough: false tab_list: GLOBAL_PING motd: '&lMy first BungeeCord server' query_enabled: false query_port: 25577
Change the contents of the single quotes after
motd: to set your server description (what a player will see when first looking at the server in the client.) Make sure the line within the
listeners block that begins with
host: 0.0.0.0 contains the port 25565 to allow users to connect without specifying a port.
Last thing we need to do for BungeeCord is actually put in an entry for our lobby (default server players join.) We will be using the default entry for now, as it suits our needs. Change the motd to your desired server description, and in the end, it should now look like this.
servers: lobby: address: localhost:25567 restricted: false motd: 'My lobby server'
Save and close the file.
Now, let's create the lobby server. There's plenty of Minecraft server articles on Vultr, but it's recommended that you choose one that includes either Spigot or CraftBukkit. Follow the part "Download and use BuiltTools" in the article "Setting up Spigot on Ubuntu". Stop when you reach the section "Optional: Run in background." Remember to set the memory limits properly for the SpigotMC server and to accept the EULA.
There's one change you need to make: enabling offline mode for the target server. This is done by opening
server.properties, and changing
false. We will discuss this in the Security Measures section.
At this point, you should have a SpigotMC jarfile.
Step 3: Starting the server and making it persistant
The first thing we'll do is create a script that'll start both servers.
Copy over the script you created in the "Setting up Spigot" article to a new file.
cp ~/server/start.sh ~/bungeeServer/start.sh
~/bungeeServer/start.sh and change
BungeeCord.jar. After changing the memory values to the desired set, save, and quit.
Make sure to allow the script to be executed.
chmod +x ~/bungeeServer/start.sh
There's two more scripts to create, and the next one will be at
~/startAll.sh. This will allow us to start every server and run it in the background.
The contents of
#!/bin/bash for line in $(find ~ -name "start*"); do echo "Starting $line..." serverID=$(($serverID + 1)) screen -dmS "server-$serverID" bash $line done
This will automatically execute the start scripts in the directory
The last script to create will be at
~/stopAll.sh, and the contents should be this.
#!/bin/bash cd /var/run/screen/S-$USER/ for f in *; do screen -S $f -X kill done
Keep in mind this does not save the worlds in your server, please do that beforehand.
Adding an additional server
Every time you want to add a new server to the Bungee configuration, you'll need to open up
config.yml and add the following entry.
serverName: address: address.of.minecraft.server:portNumber restricted: false motd: 'New server description'
Change restricted to
true if you'd like to restrict the server to an administrator.
Once you're done, save and restart the BungeeCord server.
With the current configuration, offline (also known as cracked users) can join your target servers directly. There are numerous plugins to block all players that don't join from the proxy, one of which is OnlyProxyJoin.
Due to the way this is setup, we can simply open up the lobby server's
server.properties, and change the listening IP address to 127.0.0.1. This will prevent any users from connecting directly, thus forcing all users to be verified by the proxy.
In this article, we setup a small Bungee network. It's expandable, and allows server owners to create a plethora of interconnected servers and gamemodes.
Additional information is available in BungeeCord's documentation.