I was tasked with running a Minecraft server at work (Great job isn’t it?). Here are the steps to setup a Vanilla Minecraft server on Slackware.

Create a user that minecraft will run under:
[root@host ~]# addgroup minecraft
[root@host ~]# adduser -g minecraft minecraft

I am using a passwordless login:
[root@host ~]# cd /home/minecraft/
[root@host minecraft]# mkdir .ssh
[root@host minecraft]# chown minecraft:minecraft .ssh
[root@host minecraft]# chmod 700 .ssh/
[root@host minecraft]# cat minecraft.key >> .ssh/authorized_keys
[root@host minecraft]# chown minecraft:minecraft .ssh/authorized_keys

Download and configure minecraft and use a whitelist:
[root@host minecraft]# su - minecraft
[minecraft@host ~]$ wget https://s3.amazonaws.com/Minecraft.Download/versions/${version}/minecraft_server.${version}.jar
[minecraft@host ~]$ ln -s minecraft_server.${version}.jar minecraft_server.jar
[minecraft@host ~]$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
[minecraft@host ~]$ sed -i '/eula=/c\eula=true' eula.txt
[minecraft@host ~]$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
stop
[minecraft@host ~]$ sed -i '/spawn-protection=/c\spawn-protection=0' server.properties
[minecraft@host ~]$ sed -i '/difficulty=/c\difficulty=4' server.properties
[minecraft@host ~]$ sed -i '/snooper-enabled=/c\snooper-enabled=false' server.properties
[minecraft@host ~]$ sed -i '/white-list=/c\white-list=true' server.properties
[minecraft@host ~]$ sed -i '/motd=/c\motd=My Minecraft Server' server.properties

I require access to the console, so I am going to run the server using screen:
[root@host minecraft]# screen -S Minecraft
[minecraft@host ~]$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
op
whitelist add

To detach from the screen:
CTRL-a d

To reattach to the screen later:
screen -r

If a startup script is needed, this can be added as an init script:
screen -S minecraft -d -m su - minecraft /home/minecraft/start.sh

Reference:
Screen
Setting up a Minecraft server

One Response to “Minecraft Server”

  1. Xtreme Delusions: A Legend In My Own Mind Says:

    […] Minecraft Server […]

Leave a Reply

You must be logged in to post a comment.