Installing BungeeCord for Minecraft on CentOS 6/7
Published on March 9, 2015•Updated on November 21, 2023
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