Tutorials/Setting up a server

= Download the Minecraft Server = Download Minecraft_Server.exe or minecraft_server.jar from the Minecraft downloads page.

Windows users can use either the exe or the jar, Mac OSX and Linux users can use only the jar.

It is recommended that you create a folder either on your computer's desktop, or elsewhere in your computer, for the server files. The server app should go in the folder you create.

Note: There is also custom server software available, but note that these applications are not supported by Mojang.

=Windows Instructions=

Verify and Install the Latest version of Java

 * 1) Make sure that you have Java 6 installed. To do so, we first need to open up a command (CMD) window.
 * 2) * In Windows Vista/7, open the start menu, 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, which should read "Java version 1.6"
 * 6) If you get this error, " ", then you may have a previous version (less than 1.6) of Java or Java may not be in your system path.
 * 7) *For 32-bit users you can obtain the latest version here: Java download page. If you use a 64-bit OS ensure you download the Windows x64 package: Java download page.
 * 8) * After you have installed the latest version of 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: . If you use 32-bit Java on a 64-bit OS use:
 * 7) *# Restart your computer.
 * 8) *# Now re-open the command prompt and try again.

Start the Minecraft Server (exe version)
Double click on the "Minecraft_Server.exe" file and the server should start.

If Windows does not recognize the filetype (You are being prompted to select a program to open it with), it may be because Minecraft_Server is missing the .exe extension. This can be fixed by renaming the Minecraft_Server file to Minecraft_Server.exe. If it worked, the icon should now be the Minecraft symbol.

If this does not work, you will have to go into a command window by opening Run, typing cmd and pressing enter. Once there you need to navigate to the folder you have created.

To do this:


 * 1) Ensure you are in the proper drive (usually c drive). Type  and then hit enter to access the c drive
 * 2) Now you need to call the directory (open the folder). Type  then hit enter.  Make sure to include the quotation
 * 3) Ensure you are in the proper directory. Type  and command will generate a list of contents of the folder, you should see minecraft_server there.
 * 4) Rename Minecraft. Type   then hit enter. This should add the .exe extension to the executable and it should now operate correctly

Start the Minecraft Server (jar version)

 * 1) If you have the .jar version, you will need to have a path variable set up for Java in order to start the jar version of the server. Refer to step 3 of "Verify and Install the Latest Java" above to set up a path variable.
 * 2) To start the jar version of Minecraft on Windows, create a new file in Notepad, and paste in
 * 3) Save the file as startserver.bat, and place the file in the same folder as minecraft_server.jar. The .bat extension saves the file as a batch file.
 * 4) Double click startserver.bat, and the Minecraft server will run.
 * 1) Double click startserver.bat, and the Minecraft server will run.

Starting the jar version without altering your system path
To start minecraft.jar server without having to change your system path variable you need to instead express the path variable for Java in the "start.bat" file. This is handy because it allows you to still run commands from command prompt using the default system path, without having to constantly edit the system path. so that a command window isn't opened to show the output from our start file where  contains the existing Path values and   contains the location of your 32bit Program Files - usually "C:\Program Files (x86)"
 * 1) To do this open your start.bat file (or whatever you've named it) with Notepad
 * 2) On the very first line add the command
 * 1) On the next line make sure the system can find Java (also called the Java Runtime Environment or JRE) by adding it to the Path Environment Variable. On a current Windows PC Java will be most commonly located at "C:\Program Files (x86)\Java\jre6\bin", so what you would then write is
 * 1) Finally, make sure on the last line you have the command that starts the Minecraft server itself:
 * 1) If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option  to the end of the last command above, so that it reads:

Configure and connect
Now it is time to configure and connect.

= Linux Instructions = 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.

Downloading
Ensure you have the latest server application software. Look under Download the Minecraft Server above for instructions.x

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 or update java. The official Sun Java is recommended. Quite a few individuals have experienced issues with OpenJDK. If OpenJDK is installed, remove it before installing the official Sun Java.

Debian
To install Java, simply type this in terminal and press enter:

Ubuntu
For Ubuntu 10.04 LTS and on, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. You must add these sources: Some distros have the command "add-apt-repository" removed. If this is the case, you will need to add the python properties by running the following command:
 * For Ubuntu 10.04 LTS (Lucid Lynx):
 * For Ubuntu 10.10 (Maverick Meerkat):
 * For Ubuntu 11.04 (Natty Narwhal):

Then you can proceed to add the source:


 * For Ubuntu 11.10 (Oneiric Ocelot):
 * Then install the packages:

openSUSE
Use

Arch Linux
Open a terminal and run  as root.

Other Distros
Alternatively, you can visit Java's website directly to download the Java package for Linux. Most distros work with this (either 32 or 64-bit). Instructions for the installation of those different packages are given on the site.

If during installation, 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 should now be installed.

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, 2163 in this case. Subtract some RAM as safety. On this computer, the server may use up to 1536 MB RAM. Now, replace the 1024 in the above example with the calculated number:

if Minecraft_Server.exe is being used you use:

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

Configure and connect
Now it is time to configure and connect.

= Mac OS X Instructions = 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.

Downloading
Ensure you have the latest server application software. Look under "Download the Minecraft Server" above for instructions.

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
Ensure you have followed the download step before proceeding.

Create a folder, if you haven't already, 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")" exec java -Xmx1G -Xms1G -jar minecraft_server.jar
 * 1) !/bin/bash

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.

Run as a daemon
Alternatively you can automate the startup of the Minecraft server.

Create a Mac OS X startup daemon

= Configuring the Minecraft Server =

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 ops.txt file.
 * 1) Configure the server by editing the server.properties (Use this link to see how it works). Windows may not recognize it, so tell it to open with any text editor (such as Notepad or Notepad++). The server should run fine from the default values.
 * 2) Add your username to the admin.txt and/or ops.txt (newer versions may not have an admin.txt file). Admin.txt allows you to execute server commands.

= Connect to the Minecraft Server =
 * To test the server, if you are playing on the machine you are hosting on, select the "Multiplayer" option in the game client (or browser client) and type in "localhost".
 * For people connecting from the internet, they must connect using your external IP address. You must port forward for someone outside your network to connect to the server.
 * Users within your network can connect with your internal IP address. You do not need to port forward for connections that are within your local network.

IP address notes

 * Unless you set a static IP for the computer that is hosting the game, the internal IP address can change. This affects port forwarding rules, and can make them invalid. Each modem or router has a different way of setting a static IP address. You should refer to the manual for your device(s) or online documentation for further instruction.
 * If you are having players connect to your external IP, your external IP can change if you do not have a static IP from your internet service provider. Use a tool such as http://mywanip.com/ to periodically check on the external IP address. Alternatively, you can look into a dns service that will allow you to have a name, rather than an IP address, that will remain the same. The name will point to your external IP address, regardless of whether or not it changes (the dns is updated when changes occur). An example of a free dns service is Dyndns.

Firewalling, NATs and external IP addresses

 * You must open the TCP port (default is 25565) on the firewall

If the server in question is not reachable via a globally routable IP address, you will need to add appropriate address and/or port number translation rules to the gateway — usually your router has the global IP address.


 * For help with address translation, opening the firewall and routing (these three make up what people call port mapping/forwarding), portforward.com is a good source. Select your router from that list, skip the ad that comes after selecting the device, and you will see instructions for setting up port forwarding. Alternatively, you can read the documentation supplied with your router, modem, or other ISP related hardware.
 * Verify the port is open, and note your external IP by using a port checker tool, such as http://www.yougetsignal.com/tools/open-ports/. The default port you should test is 25565, unless you specified something else. Have the Minecraft server running when you test the port.
 * You can obtain your external IP address from http://www.yougetsignal.com/what-is-my-ip-address/.

Setting Up a VPN (Hamachi)
An easy way to set up a server between you and your friends is to set up a VPN (virtual private network). A free software utility that can be used to set this up is Hamachi by LogMeIn.

Advantage of doing this saves you configuring ports on your router and if you have a dynamic IP address using Hamachi will provide you with a static IP.


 * 1) Install software on you and your friend's computers  https://secure.logmein.com/products/hamachi2/ or https://secure.logmein.com/US/labs/?wt.ac=73-516-440 for Linux (32-bit and 64-bit .deb and .rpm packages are available, you can install it on Gentoo by emerging "net-misc/logmein-hamachi")
 * 2) One person sign up for admin via logmein website
 * 3) Create new network
 * 4) Pass these details onto every person concerned and get them to login
 * 5) One person set up a server.
 * 6) Everyone else connect via their Hamachi ip address and use port number 25565 (default)

= 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
 * Another Mac OSX and port forwarding tutorial
 * Alternate Mac OSX video (updated for 1.7)
 * 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)
 * How to Install Minecraft Server on CentOS

Tutoriels/Configurer un serveur Создание и настройка сервера 튜토리얼/서버 설치