Skip to content

Instantly share code, notes, and snippets.

@publicarray publicarray/minecraft.md
Last active Jan 5, 2018

Embed
What would you like to do?
Minecraft with SocketBuffer - on Vultr (CentOS 6.9)
wget https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip-1294.jar
ln -sf paperclip-1294.jar minecraft_server.jar
service minecraft restart

service iptables stop
chkconfig iptables off
# systemctl disable iptables

yum install tuned tuned-utils
tuned-adm profile throughput-performance
sysctl -w net.ipv4.tcp_timestamps=0
#yum install mtr
 
##wget https://github.com/downloads/nickrak/SocketBuffer/SocketBuffer-1.1-nix64.tar.gz
##tar -zxvf SocketBuffer-1.1-nix64.tar.gz
wget https://github.com/nickrak/SocketBuffer/archive/master.zip
yum groupinstall "Development Tools"
yum install qt qt-devel unzip
unzip master.zip
cd SocketBuffer-master/src
## rpm -ql qt-devel | grep qmake 
qmake-qt4 SocketBuffer.pro -o Makefile
make
cp SocketBuffer /usr/local/bin/socket-buffer
#mv SocketBuffer /home/minecraft/server
chown minecraft:minecraft /home/minecraft/server/SocketBuffer
sed -i -e 's/25565/25566/' /home/minecraft/server/server.properties
#socket-buffer -t=127.0.0.1 -l=25565 -s -p=25566 

## copy the files below

# set executable
chmod +x /home/minecraft/server/socket-buffer-service.sh
chmod +x /etc/rc.d/init.d/socket-buffer
chkconfig socket-buffer on 
#systemctl enable socket-buffer
service socket-buffer start
#!/bin/bash
# place in -> /etc/rc.d/init.d/socket-buffer
# socket-buffer init.d startup script
#
# chkconfig: 345 70 30
# description: socket-buffer for minecraft
# processname: socket-buffer
#
# Source function library.
. /etc/init.d/functions
# Conf
SERVICENAME="socket-buffer"
USER="minecraft"
USERSCRIPT="/home/minecraft/server/socket-buffer-service.sh"
start() {
echo -n "Starting $SERVICENAME: "
su - $USER $USERSCRIPT "start"
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
echo ""
else
echo_failure
echo ""
fi
return $RETVAL
}
stop() {
echo -n "Shutting down $SERVICENAME: "
su - $USER $USERSCRIPT "stop"
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
echo ""
else
echo_failure
echo ""
fi
return $RETVAL
}
status() {
su - $USER $USERSCRIPT "status"
RETVAL=$?
return $RETVAL
}
# Script logic
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
*)
echo "Usage: <servicename> {start|stop|status|restart}"
exit 1
;;
esac
exit $?
#!/bin/bash
#
# place in -> /home/minecraft/server/socket-buffer-service.sh
#
DIR="$( cd "$( dirname "$0" )" && pwd )"
cd $DIR
PID=`pgrep -u "minecraft" socket-buffer`
PROC_COUNT=`pgrep -u "minecraft" socket-buffer | wc -l`
if [[ "$1" == "start" ]]; then
# Start server
if [[ $PROC_COUNT -eq 0 ]]; then
screen -d -m -S "socket-buffer" -t "socket-buffer" socket-buffer -t=127.0.0.1 -l=25565 -s -p=25566
exit $?
fi
exit 0
elif [[ "$1" == "stop" ]]; then
# Stop server
if [[ $PROC_COUNT -gt 0 ]]; then
kill "$PID"
fi
exit 0
elif [[ "$1" == "status" ]]; then
# Show server status
if [[ $PROC_COUNT -eq 0 ]]; then
echo "Server is not running."
else
echo "Server is running."
fi
exit 0
else
# Unknown command
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.