Installing BungeeCord for Minecraft on CentOS 6/7

BungeeCord is a free, easy, and reliable way to connect multiple Minecraft servers together. If you would like to string multiple game modes together on your server, BungeeCord is the right solution for you. Learn more about it on the official site.

Requirements

  • CentOS 6/7 x86/x64
  • Minimum 512MB of RAM
  • Java 7+
  • Screen (optional)

Installation

First of all, you will need to login to your server.

Download the latest version from their website.

mkdir BungeeCord
cd BungeeCord
wget http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar

Start BungeeCoord with Java:

cd ~
cd BungeeCord
java -Xms512M -Xmx512M -jar BungeeCord.jar

... or with Screen:

cd ~
cd BungeeCord
screen -S BungeeCord
screen -r BungeeCord
[user@ ~screen]$ java -Xms512M -Xmx512M -jar BungeeCord.jar

BungeeCord is setup at this point. You can use the init script below to have it run on boot and perform service commands against it.

(Optional) Init script

Create an init.d script.

nano /etc/init.d/BungeeCord

Copy and paste the init script below. Edit the MCPATH='/root/BungeeCord' to the proper install path.

#!/bin/bash
 # /etc/init.d/BungeeCord
 # version 0.3.9 2012-08-13 (YYYY-MM-DD)

 ### BEGIN INIT INFO
 # Provides:   BungeeCord
 # Required-Start: $local_fs $remote_fs
 # Required-Stop:  $local_fs $remote_fs
 # Should-Start:   $network
 # Should-Stop:    $network
 # Default-Start:  2 3 4 5
 # Default-Stop:   0 1 6
 # Short-Description:    BungeeCord
 # Description:    BungeeCord
 ### END INIT INFO

 #Settings
 SERVICE='BungeeCord.jar'
 USERNAME='root'
 MCPATH='/root/BungeeCord'
 INVOCATION="java -server -Xmx512M -Dfile.encoding=UTF-8 -jar $SERVICE"

 ME=`whoami`
 as_user() {
   if [ $ME = $USERNAME ] ; then
     bash -c "$1"
   else
     su - $USERNAME -c "$1"
   fi
 }

 mc_start() {
   if  pgrep -u $USERNAME -f $SERVICE > /dev/null
   then
     echo "$SERVICE is already running!"
   else
     echo "Starting $SERVICE..."
     cd $MCPATH
     as_user "cd $MCPATH && screen -dmS BungeeCord $INVOCATION"
     sleep 7
     if pgrep -u $USERNAME -f $SERVICE > /dev/null
     then
       echo "$SERVICE is now running."
     else
       echo "Error! Could not start $SERVICE!"
     fi
   fi
 }


 mc_stop() {
   if pgrep -u $USERNAME -f $SERVICE > /dev/null
   then
     echo "Stopping $SERVICE"
     as_user "screen -p 0 -S BungeeCord -X eval 'stuff \"alert PROXY STOP IN 10 SECONDS.\"\015'"
     sleep 10
     as_user "screen -p 0 -S BungeeCord -X eval 'stuff \"end\"\015'"
     sleep 7
   else
     echo "$SERVICE was not running."
   fi
   if pgrep -u $USERNAME -f $SERVICE > /dev/null
   then
     echo "Error! $SERVICE could not be stopped."
   else
     echo "$SERVICE is stopped."
   fi
 }

 mc_update() {
      if pgrep -u $USERNAME -f $SERVICE > /dev/null
   then
     echo "Stopping $SERVICE"
     as_user "screen -p 0 -S BungeeCord -X eval 'stuff \"say Proxy SERVER GO TO UPDATE.. RESTARTING IN 10 SECONDS.... \"\015'"
     sleep 10
     as_user "screen -p 0 -S BungeeCord -X eval 'stuff \"stop\"\015'"
     sleep 10
     as_user "cd $MCPATH && rm -rf BungeeCord.jar"
         sleep 6
     as_user "cd $MCPATH && wget http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar"
   else
     echo "$SERVICE was not running."
   fi
   if pgrep -u $USERNAME -f $SERVICE > /dev/null
   then
     echo "Error! $SERVICE could not be UPDATED."
   else
     echo "$SERVICE is update."
   fi
 }
 #Start-Stop here
 case "$1" in
   start)
     mc_fupdate
     mc_start
     ;;
   stop)
     mc_stop
     ;;
   restart)
     mc_stop
     mc_fupdate
     mc_start
     ;;
   update)
     mc_update
     mc_start
     ;;
   status)
     if pgrep -u $USERNAME -f $SERVICE > /dev/null
     then
       echo "$SERVICE is running."
     else
       echo "$SERVICE is not running."
     fi
     ;;

   *)
   echo "Usage: $0 {start|stop|update|status|restart}"
   exit 1
   ;;
 esac

 exit 0

Register the service.

chmod a+x /etc/init.d/BungeeCord
chkconfig --add BungeeCord

You're all set, you can use the following commands to control the service.

service BungeeCord start
service BungeeCord stop
service BungeeCord restart
service BungeeCord update
service BungeeCord status
  • Minecraft, Game Servers, CentOS
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Setting up a Name Server for IPv6 rDNS in CentOS

Managing your own IPv6 rDNS is a fairly simple task. After setting up the name server, please...

Reset the Root Password in CentOS

If you have forgotten the root password it is possible to set a new one by interrupting the boot...

How to Install and Configure vsftpd on CentOS 7

FTP (File Transfer Protocol) is one of the most popular methods to upload files to a server....

How to enable EPEL repository?

The EPEL repository is an additional package repository that provides easy access to install...

Find (View) Default Zone for Firewall on CentOS 7

Pre-Flight Check These instructions are intended for finding (viewing) the default zone in...