All Linux HowTo's

Create a Linux based Minecraft Server

The following will guide you into creating a linux based Minecraft server, the example is running on a Ubuntu 12.04 box however this should work any similar distro.

First if all we need to make sure that you have java installed, use the command below to do this. If you do have java already installed it will return “Already the Latest Version” or something similar

sudo apt-get install default-jdk

Once you have java installed we are going to use Screen to keep our server running even when we are not connected to our box. Ubuntu does include screen by default however it does not hurt to check if you have the latest version which you can do by running the following.

sudo apt-get install screen

At the bottom of this post is a little bit about how to use Screen however if you want to know more about it you can check out the full manual here

So the next step is to install Minecraft, you will want to create a directory for it and then change to that directory.

mkdir /srv/minecraft/
cd /srv/minecraft/

Now we have to download the server version of Minecraft, the code below will download version 1.7.4 of the server if you want a different version then you can just change the number in the command.

wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.7.4/minecraft_server.1.7.4.jar

Now we can create our screen session that we will use to launch the server software

screen -S "AGIX Minecraft Server"

Now we just have to create a launch script so that we can start the server

touch start_server.sh
chmod 755 start_server.sh
vim start_server.sh

Now we just have to add the following line into the script and save it

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Now to launch you server you can just run that script, no need for you to remember the command, to launch the script just type

./start_server.sh

Your minecraft server should start up when it is started you will see the line

2014-XX-XX 03:24:03 [INFO] Done (10.103s)! For help, type "help" or "?"

To disconnect from your screen session now that your server is started just press ctrl a d this will bring you back to your main terminal session, from here you can logout of your server and go enjoy some Minecraft. However if you need to reconnect to your server you can just run the following command.

screen -R "AGIX Minecraft Server"

If you need to edit the properties for you server they can be found in

/srv/minecraft/server.properties

I have added an example of a creative server

generator-settings=
op-permission-level=2
allow-nether=true
level-name=AGIXWorld
enable-query=false
allow-flight=true
announce-player-achievements=true
server-port=25565
level-type=DEFAULT
enable-rcon=false
force-gamemode=true
level-seed=
server-ip=
max-build-height=256
spawn-npcs=true
white-list=false
spawn-animals=true
hardcore=false
snooper-enabled=true
online-mode=true
resource-pack=
pvp=true
difficulty=0
enable-command-block=false
gamemode=1
player-idle-timeout=0
max-players=20
spawn-monsters=true
generate-structures=true
view-distance=10
spawn-protection=16
motd=Just an AGIX minecraft server

Similar Posts: