Tutorials/Setting up a server

= Windows =

Verifying and Installing the Latest Java

 * 1) Make sure that you have Java 6 installed. To do so first we need to open up CMD.
 * 2) * In Vista/7 open the start menu and enter cmd in the search field, and press enter.
 * 3) * In XP open the start menu and click Run, then enter cmd and press enter. You can also hold the Windows key down and press R to open Run.
 * 4) * At the command prompt, enter the following command, and press enter:
 * 5) * Java then should display its version, and should read "java version 1.6"
 * 6) If you have a previous version (less than 1.6) or you get this error: " ", then you need to install/update the computers java version. You can do so at the java download page.
 * 7) After you installed the latest java try again with.
 * If you get an error at this point, try the following to add java to your system path.
 * 1) Right click Computer
 * 2) Click properties
 * 3) Click "Advanced system settings"
 * 4) Click "Environment Variables"
 * 5) Under system variables, find the Path variable.
 * 6) Click edit, and append to the end of the value: ";C:\Program Files (x86)\Java\jre6\bin"
 * 7) Now re-open the command prompt and try again.

Download the Minecraft Server
Download minecraft_server.exe from the Minecraft multiplayer page or download custom server software elsewhere.

Start the Minecraft Server
Double click on the "Minecraft_Server.exe" The server should start.

Configure the Minecraft Server

 * 1) Configure the server by editing the server.properties (Use this link to see how it works). This file will be in the same folder as the Server.exe program. Windows may not recognize it, so tell it to open with any word processor (such as Notepad). The server should run fine from default properties.
 * 2) Add your username to the admin.txt and/or op.txt (newer versions may not have an admin.txt file). Admin.txt allows you to execute server commands, and op privileges allows you to destroy/place blocks. Add the name exactly as it is. From the server gui, you can type "op " and it will automatically update the op.txt file.
 * 3) If your computer is connected to a router, open and forward the port that is set for use with the server (The default is 25565). For help with port forwarding, portforward.com is a good source, alternatively one can read the documentation supplied with the router, modem, or other ISP related hardware.
 * 4) Verify the port is open and note your external IP by using a open port check tool.

Connect to the Minecraft Server
To test your server (even if the ports aren't open), select the "Multiplayer" option in the game client (or browser client), and type in "localhost".

To allow yourself and other players to destroy and build blocks, add their user names to the ops test document.

For people connecting from the internet, they must connect using your external IP. This can be found using the open port check tool mentioned earlier. The port must show as open for these users to connect.

For more information about how to run and maintain a server check Maintaining a server.

If all else fails, the official Minecraft forums have users with information and tutorials for hosting servers.

= Linux = This tutorial for how to set up a Minecraft server on Linux was designed for people who don't have a lot of experience with Linux. There is a more advanced tutorial in the forums. This tutorial was tested on Ubuntu 9.10 32-bit but should work with the descendants of Debian.

Verifying Java version
This step is pretty much the same as in Windows. Open the terminal from Applications > Accessories > Terminal. Enter. It should look something similar to this screenshot from Windows:

Make sure that you got version 1.6 (marked with a red box in the image)

Installing Java
If you get  (which may be followed by more text) or if you do have another java version than 1.6 then you need to install java. Simply type this in terminal and press enter:

(Note: In Fedora and Red Hat you use ) (In opensuse use )

If it asks for a password enter your password. If you get asked "Is this OK [y/n]" Enter Y and press enter if required.

Java is now installed

(Note For most Distributions you can get Java right from Java.com In 32 or 64 bit packages)

Setting up the Minecraft Server
Download the latest Minecraft server here.

Create a new folder in your home folder (Places > Home) called "minecraft_server" or something similar. Extract the contents of the .zip file to this folder.

To change the server settings edit the Server.properties file.

Start the Minecraft server
Open the terminal again (Applications > Accessories > Terminal). Enter the following commands: (change minecraft_server to the same name of the folder you extracted the server to)

Less than 1GB free RAM
If you have less than 1024MB RAM, the above line may cause problems with swapping and out of memory conditions, which makes the game hard to play. Measure your current free RAM: It may look like this:

You are interested in the last number in the third line, 565 in this case. Subtract some RAM as safety. On this computer, the server may use up to 512 MB RAM. Now, replace the 1024 in the above example with the calculated number:

Voila, it should run smoothly now.

Tip: If you want to spare more memory, you may set the -Xms parameter even lower, say:

The parameter controls how much memory is reserved on startup. Your server will start with 32MB RAM and whenever it needs more memory it will allocate some until it reaches the maximum of 512M. However, this will result in a little slowdown whenever the allocation is done.

Startup and maintenance script
Alternatively you can automate the startup of the Minecraft server.

Server_startup_script

= Mac OS X = Setting a server up in Mac OS X is "more involved" than in Windows because Notch has not provided an executable. For a full video tutorial click here. Keep in mind that the server won't run correctly on OSX 10.4 and may crash your machine.

Installing Java
Mac OS X already comes with its own version of Java that is updated automatically via Software Update (Apple menu > Software Update).

Setting up the Minecraft Server
 Download the latest version of minecraft_server.jar from here Create a folder and put minecraft_server.jar into it. For example, create a folder on the Desktop named minecraft_server and drag the jar file into it. Open TextEdit, set the format to plain text (Format > Make Plain Text), copy and paste in the following code, and save the file as "start.command" in the same folder as minecraft_server.jar. cd "`dirname "$0"`" java -Xmx1G -Xms1G -jar minecraft_server.jar This will give the server enough RAM to run. The amount of RAM can be changed by editing the  to something else, such as   for 2 GB. Open Terminal (in /Applications/Utilities/Terminal). Type in, with a space after it, then drag and drop the start.command file into the terminal window, then press enter. (This gives run permission to the script.)  Double-click the start.command file to start the server.
 * 1) !/bin/bash

Next, set up port mapping by following the directions below.

For server settings, see the relevant steps in the section Configure the Minecraft Server, but skip the port forwarding steps if you followed the port mapping directions below.

Setting up Port Mapping
A server behind a router requires port mapping (also called port forwarding) to allow others to connect to it over the Internet. This is very easy because most routers support automatic port mapping:


 * 1) Download and run Port Map.
 * 2) Add a mapping with the local port and public desired port set to 25565 (the default).
 * 3) Give it an optional description such as "Minecraft".

Run Port Map each time you run the minecraft server if you want it to be reachable over the Internet.

You can keep minecraft_server.jar and Port Map.app in the same folder for convenience.

= Reporting problems in the forum = Before you can ask for help in the forums make sure that your problems is not listed in the Common Problems

If your problem is not listed you can create a new thread asking for help in the Server Administration Make sure to include as much information as possible:


 * Operating system
 * What you were trying to do
 * What you did so far
 * Any errors you encountered
 * Screenshots of the problem (if possible)

= Other tutorials = Here are some other tutorials on how to set up a Minecraft server.


 * Full video tutorial for setting up Minecraft server on Mac OSX, including port forwarding
 * Linux tutorial for more advanced users
 * Windows tutorial with focus on how to forward a port
 * Guide to setting up an alpha server using Virtualbox.
 * How to install a Minecraft Server on Debian (German)