Setting up a fresh Minecraft server installation on linux

There are instructions all over the place for this sort of thing, so I’m just putting this here for my own reference. I may update it or write new posts as things change significantly.

These instructions are all assuming a headless remote Linux machine will be running the server, so the instructions are based on that.

Step 0

Get the linux server running, set up ssh access, install java, etc.

Step 1 – Install Screen

It’s easiest to run the server on a Screen Window, so go get screen.

Ubuntu/Debian setup:

 sudo apt-get update
 sudo apt-get install screen

Gentoo:

 sudo emerge --sync
 sudo emerge screen

Step 2 – Get the server software

Modpack:

If you’re using a modpack that provides server software, go get that.

Example:

Feed the beast – List of server packs – http://www.feed-the-beast.com/servers/downloads
Monster:

wget http://www.creeperrepo.net/direct/FTB2/f4039de83bfeba547e48047317c4c82e/modpacks%5EMonster%5E1_1_1%5EMonsterServer.zip

unzip the modded server into a directory of your choosing

mkdir ftbMonster
mv *MonsterServer.zip ftbMonster
cd ftbMonster
unzip *.zip

Vanilla (or custom modding):

Go to minecraft.net to get the server software, get the jar: https://minecraft.net/download

Currently:

 wget https://s3.amazonaws.com/Minecraft.Download/versions/1.7.10/minecraft_server.1.7.10.jar

copy the server into a directory of your choosing (to keep things clean):

mkdir minecraft
mv minecraft_server.*.jar minecraft
cd minecraft

Step 3 – Set up the shell script

Modpack:

Odds are there’s already a shells script ready to use, but it might need modifications. For FTB it’s called ServerStart.sh
You can edit this file, but keep reading the vanilla instructions to understand what to modify.

Vanilla:

Create a new file called ServerStart.sh with contents (note: If you’re using a modpack, don’t change anything yet):

java -Xms512m -Xmx1024m -XX:PermSize=256m -jar minecraft_server_1.7.10.jar nogui

What this does:

java = runs java
-Xms512m = tells java the server will use at least 512MB of RAM.
-Xmx1024m = tells java the server can only use up to 1024MB of RAM.
-XX:PermSize=256m = tells java that it should allocate 256MB of space for classes and such. 
This is in addition to the Xmx setting
minecraft_server_1.7.10.jar = the name of the server application
nogui = tells minecraft we don't want to use the GUI

So here’s what to edit:

-Xmx1024m = Set this as high as you're comfortable. Leave some memory for other processes.
-Xms512m = Scale this up some if you've scaled up the maximum.

Leave the permsize unless you’re running significantly more mods, 256Mb should be enough. I haven’t run into any issues with this for the Monster pack from FTB.

Step 4 – Set up ops and server properties

ops.txt should have 1 line per operator. Use the player’s handle.

kadono
Notch

Then set up the server.properties file. This is more complicated than I plan on getting into here, and there’s a good reference here: http://minecraft.gamepedia.com/Server.properties

One note though, if you’re using a white list, be sure to add the users you want to allo in white-list.txt. Ops are automatically allowed, so they don’t need to be in the whitelist.

Step 5.0 – Using Screen

OK, now a short screen cheat-sheet.

First, run screen

>screen

You’re now in a screen window. These windows will keep running even after you detach from them and log off ssh.

Screen uses “Ctrl+a” for its shortcuts. There are a number of shortcuts, so I’m not going to list them all here, just the ones that’ll be needed most frequently.

“Ctrl+a”, “?” – a list of shortcuts (for what’s not listed here)
“Ctrl+a”, “c” – create a new “window”
“Ctrl+a”, “n” – go to next window
“Ctrl+a”, “d” – detach from screen. This will send you back to the shell but keep the screen and all it’s windows running.
“exit” – closes that screen window, if it’s the last window, closes the screen

When you’re detached, to reattach, type

>screen -r

and if there’s one screen it will reattach. If there is more than one, it will ask:

There are several suitable screens on:
 17021.pts-0.machineName (Detached)
 17725.pts-0.machineName (Detached)

To reconnect to one, use:

>screen -r 17021.pts-0.machineName

Step 5.1 – Running the server on a screen

launch screen and navigate to your ServerStart.sh file (in the same directory as your server).

run:

sh ServerStart.sh

and it should work. You should see some stuff being written to StdOut. Try connecting to your server from the local network. If it all looks good, you can detach from the screen and disconnect from ssh. If there are issues, spend some time on Google figuring it out.

Step 6 – Port Forwarding

Forward 25565 to the server (by default)

Step 7 – Do everything else

Choose the mods to use, set up everything, and so on. There are other things you can do like have default resourcepacks and you’ll have to distribute the mods to whomever wants to play on your server. This guide is just for the initial basic setup, so all of the fancier stuff can be handled by Google. If I make some other guides, I may link them here.

Again, this guide was for myself as a quick reference, if it was useful to you, I’m glad. If it’s not, then head over to http://minecraft.gamepedia.com/Tutorials/Setting_up_a_server


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *