Minecraft Wiki
Register
(44 intermediate revisions by 21 users not shown)
Line 8: Line 8:
 
This tutorial takes you through the steps of '''setting up your own server''' using the default [[server]] software that [[Mojang AB|Mojang]] distributes free of charge. The software may be installed on most operating systems, including Windows, Mac and Linux.
 
This tutorial takes you through the steps of '''setting up your own server''' using the default [[server]] software that [[Mojang AB|Mojang]] distributes free of charge. The software may be installed on most operating systems, including Windows, Mac and Linux.
   
Regardless of your operating system, you must begin by downloading the server software from the minecraft [http://minecraft.net/download.jsp download page], and save it to the directory in-which you will run the server.
+
Regardless of your operating system, you must begin by downloading the server software from the minecraft [http://minecraft.net/download.jsp download page]. The server is available as either a Java .jar file or a Windows .exe file. The .exe version may seem easier to use, but in case of problems the .jar version gives better error messages and it is more configurable.
 
   
 
''Note: There is also [[Custom server list|custom server software]] available, which most large servers use, but these applications are not supported by Mojang.''
 
''Note: There is also [[Custom server list|custom server software]] available, which most large servers use, but these applications are not supported by Mojang.''
Line 24: Line 23:
   
 
== Windows instructions ==
 
== Windows instructions ==
=== Verify and install the latest version of Java ===
+
=== Verify that the latest version of Java is installed ===
# Make sure that you have Java 7 installed. To do this, we first need to open up a command (CMD) window.
 
# In Windows XP/Vista/7, whilst holding the Windows key down, press R to open the Run dialog. Type <code>cmd</code> and press enter.
 
#* Once the command prompt has opened, enter the following command, followed by the enter key:<br /><code>java -version</code>
 
#* Java should display its version, which should read "Java version 1.7"
 
# If you get the error "<code>'Java' is not recognized as an internal or external command, operable program or batch file.</code>", then you may have a previous version (less than 1.6) of Java or Java may not be in your system path.
 
#*For 32-bit users you can obtain the latest version here: [http://www.java.com/en/download/ Java download page]. If you use a 64-bit OS, ensure that you download the x64 Windows package.
 
#* After you have installed the latest version of Java try again with <code>java -version</code>.
 
#*: If you get an error at this point, try the following to add Java to your system path.
 
#*# Right click Computer.
 
#*# Click properties.
 
#*# Click "Advanced system settings".
 
#*# Click "Environment Variables".
 
#*# Under system variables, find the Path variable.
 
#*# Click edit, and append to the ''end'' of the value: <code>;"c:\Program Files\Java\jre7\bin"</code>. If you use 32-bit Java on a 64-bit OS use: <code>;"c:\Program Files (x86)\Java\jre7\bin"</code>
 
#*# Restart your computer.
 
#*# Now re-open the command prompt and try again.
 
   
  +
The Minecraft server (also the Windows .exe) requires Java (also called the Java Runtime Environment or JRE). For your security, you should only use the most recent version of Java. To verify that you have the latest version, do ''one'' of the following:
Windows Vista/7 users: If these steps don't work for you, open the Control Panel and search for <code>Java</code>, then click Java (32 or 64-bit). Under the Java tab, click "View...". The installed version of Java will be listed under 'Platform'.
 
   
  +
* Open Windows Control Panel, find Java (it may be inside the Programs category), and click on Update Now.
=== Start the Minecraft server (.exe version) ===
 
  +
* If Java has been enabled in your browser, you can also visit http://java.com/en/download/installed.jsp. This will perform an automatic version check.
#Double click on the "Minecraft_Server.exe" file you downloaded and the server should start with a default configuration.
 
  +
* The following method will only work if the Java folder has been added to the system path. Open a command window. (Whilst holding the Windows key down, press R to open the Run dialog. Type <code>cmd</code> and press enter or click OK.) Once the command prompt has opened, enter the command <code>java -version</code>, followed by the enter key. If a version number is reported, then check the Java website at http://www.java.com/download/ to see what the most recent version number is.
#Upon its initial start, it may throw some "file not found" error messages. This is normal. The files are being created.
 
#After the first start, you'll probably want to shut it down (enter <code>stop</code> in the server command window) and then edit some configuration files—as is explained below.
 
   
  +
If you don't have Java, or your version is outdated, then download it at http://www.java.com/download/. If you also want to be able to use Java in your webbrowser, you will probably have to install the 32-bit version, even if you are running 64-bit Windows, because most webbrowsers are still 32-bit. (Read more about this at http://java.com/en/download/faq/java_win64bit.xml) If you are using a 64-bit webbrowser, or don't need to use it with your webbrowser, you can install the 64-bit version. It is possible to install both the 32-bit and the 64-bit versions, but then you need to remember to upgrade both versions when they are outdated.
If you get an error such as "Can't save server.properties" and your screen fills with useless, gibberish text, close the command prompt window and run the MinecraftServer.bat file as the Administrator by right-mouse clicking on it and choosing 'Run as...'. (You will need the administrator password to do this...)
 
   
=== Start the Minecraft server (.jar version) ===
+
=== Start the Minecraft server ===
#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 "REQUIRED: Verify and Install the Latest Version of Java" above to set up a path variable.
 
#To start the jar version of Minecraft on Windows, create a new file in Notepad, and paste in
 
#:<code>java -Xms512M -Xmx1G -jar minecraft_server.jar</code> (add in <code>-d64</code> if your server is on a 64-bit computer using 64-bit java)
 
#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.
 
#Double click startserver.bat, and the Minecraft server will run.
 
   
  +
Before starting the server, make sure you place the downloaded file (.exe or .jar) in a folder of it's own. Don't run the server from your desktop, download folder, or any other common place. The server creates several configuration files in the application folder, and these are easier to find if everything is in a dedicated folder.
==== 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.
 
#To do this open your start.bat file (or whatever you've named it) with Notepad
 
#On the very first line add the command <br> <code>@echo off</code> <br> so that a command window isn't opened to show the output from our start file
 
#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\jre7\bin\java.exe", so what you would then write is <br> <code>path=%PATH%;%ProgramFiles(x86)%\Java\jre7\bin</code> <br> where <code>%PATH%</code> contains the existing Path values and <code>%ProgramFiles(x86)%</code> contains the location of your 32bit Program Files - usually "C:\Program Files (x86)" (adjust this if you are using Java 6)
 
#Finally, make sure on the last line you have the command that starts the Minecraft server itself: <br> <code>java -Xms512M -Xmx1G -jar minecraft_server.jar</code> (If you are using 1.6.1 or 1.6.2, change the part of minecraft_server.jar to what your .jar file is, such as minecraft_server.1.6.2.jar)
 
#If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option <code>nogui</code> to the end of the last command above, so that it reads: <br> <code>java -Xms512M -Xmx1G -jar minecraft_server.jar nogui</code>
 
   
 
Double click the file and the server should start. It will put configuration files in the folder, and quit immediately.
   
  +
The first, and required, configuration you have to do is accepting the EULA. A text file call eula.txt is created in the application folder. Open this file in a text editor (Notepad, Gedit, TextEdit, etc. Do '''not''' use a rich text editor like Wordpad.) and change the line <code>eula=false</code> to <code>eula=true</code>. It signifies that you have read and understood the end user license agreement that you'll follow when using the software. If you don't do this, the server will shut down immediately when you try to start it.
Here is an example of a bat file that starts the minecraft server on Windows, in this example the minecraft directory is located at D:\minecraft (so minecraft_server.jar is located at D:\minecraft\minecraft_server.jar), the operating system is Windows 7 64 bit, Sun's java.exe is installed at C:\Program Files\Java\jre7\bin This java happens to be 64 bit and the PC I'm running has plenty of RAM, 16 GB in my case, so I can allocate the 2GB via the <code> Xmx2048M </code> of maximum memory to run minecraft. The <code> D: </code> line below tells the bat file to go the D: drive. Also note the double quotes around "Program Files" below, needed because of the space between the words <code> Programs </code> and <code> Files </code>. I also chose not to use the @echo off . The <code> title run-minecraft </code> in the 1st line is to just have the MS DOS window that is used to run minecraft display "run-minecraft" in the window title bar.
 
   
 
If you get an error such as "Can't save server.properties" and your screen fills with useless, gibberish text, then run the Minecraft Server as administrator by right-mouse clicking on it and choosing 'Run as administrator'. (You may need the administrator password to do this.)
<code>
 
title run-minecraft
 
path=%PATH%;C:\"Program Files"\Java\jre7\bin
 
D:
 
cd minecraft
 
java.exe -Xms1048M -Xmx2048M -jar minecraft_server.jar nogui
 
</code>
 
   
 
After the first start, you'll probably want to shut it down and then edit some configuration files, as is explained below.
=== Optional steps ===
 
   
==== Increasing the amount of RAM allocated to the Minecraft server ====
+
=== Starting from the command line ===
If you would like to start your server with more RAM, you will need to create a Windows batch file and run your server that way. Don't worry, it's easier than it sounds.
 
   
  +
Both the Java and the executable version can be run from the command line with extra parameters to configure, for example, memory usage.
#Open up Notepad (not Wordpad) to create a text document with no formatting (italics, boldface, etc.).
 
#Identify your Windows OS type (32-bit or 64-bit), which may be done through the Control Panel. Also, identify which version of Java you are running—32 bit or 64 bit.
 
#Based on your OS and Java types...
 
##If Windows is 32-bit ''or'' Windows is 64-bit with 64-bit Java, copy this into your document:
 
##:<code>javaw -Xms1024m -Xmx1024m -jar "Minecraft_Server.exe"</code>
 
##If you are, for some reason, running 32-bit Java on a 64-bit system, ''upgrade Java''. Also, if you have installed Java to a different directory or changed the name of your Minecraft server .exe file, see below.
 
##If you do have 32-bit Java on a 64-bit system, Java.com recognizes Java by browser, and some browsers are 32-bit, so downloading both 32-bit Java and 64-bit Java may be needed to run everything correctly
 
#*So what does all of this mean? The executable command (<code>"C:\Program Files\Java\jre7\bin\javaw.exe"</code>) is the file path to the location of your most current javaw.exe file. javaw.exe is identical to java.exe but there is no associated console window, Since we are starting our own from our .bat. ''If you installed Java to a different location, you will have to locate it and paste that file path in instead.'' The next part (<code>-Xms1024m -Xmx1024m</code>) is your RAM allocation, in megabytes (MB). By default, your server runs with about 100 MB of RAM, which is very little. Most people will change their server to run on 1 GB (1024 MB) of RAM; 2 GB of RAM is also common. As for the <code>-jar</code>, this indicates that Minecraft_Server.exe is a Java archive.
 
#*Lastly in the executable command is the name of our .exe file (<code>Minecraft_Server.exe</code>). Typically, it is named Minecraft_Server.exe. ''Upper and lower case does matter.'' Rename <code>Minecraft_Server.exe</code> to whatever you named your file. Then click <code>File->Save As...</code> and for the file name call it <code>run.bat</code>, and make sure you select <code>*.* All File Types</code> from the drop-down arrow (Note: If you do not see <code>*.* All File Types</code> as a file type, you must put <code>run.bat</code> in quotes. <code>"run.bat"</code>). Then save it in the same location your server is saved, and double click your <code>run.bat</code> file. If all goes well, you will notice that you will have much more RAM available on your server!
 
   
  +
Running from the command line requires that the Java folder is included in the system path, or that it is specified on the command line. The Java installer does not do this for you (anymore), so you will have to do this yourself. You can either modify the system path permanently, or make a temporary modification every time you start the server.
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.
 
   
  +
Either method requires that you know the location of the Java folder. Unless you made changes while installing Java, this folder should be:
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.
 
  +
* if you are using 32-bit Windows: <code>c:\Program Files\Java\jre7\bin\</code>
  +
* if you are using 32-bit Java on 64-bit Windows: <code>c:\Program Files (x86)\Java\jre7\bin\</code>
  +
* if you are using 64-bit Java on 64-bit Windows: <code>c:\Program Files\Java\jre7\bin\</code>
   
  +
==== Permanently modifying the system path ====
To do this:
 
   
  +
# Right click Computer (either on your desktop, in the Start menu, or in the Windows Explorer).
#Ensure you are in the proper drive (usually C drive). Type <code>C:</code> and then hit enter to access the c drive
 
 
# Click properties.
#Now you need to call the directory (open the folder). Type <code>cd \"folder name"</code> then hit enter. Make sure to include the quotation
 
 
# Click "Advanced system settings".
#Ensure you are in the proper directory. Type <code>dir</code> and command will generate a list of contents of the folder, you should see minecraft_server there.
 
 
# Click "Environment Variables".
#Rename Minecraft. Type <code>rename minecraft_server minecraft_server.exe</code> then hit enter. This should add the .exe extension to the executable and it should now operate correctly.
 
 
# Under system variables, find the Path variable.
 
# Click edit, and append to the ''end'' of the current value a semicolon (<code>;</code>) and the location of your Java folder, for example <code>c:\Program Files (x86)\Java\jre7\bin\</code>. (See above.)
  +
# Close any command windows that are open. (A reboot is not required.)
  +
# Now (re)open the command prompt and enter the command <code>java -version</code>. Java should now report the installed version.
   
  +
==== Specifying the path on the command line ====
=== Running a 1.7.2+ Server ===
 
When the 1.7.2 server executable (exe) became public, most (if not all) users encountered the same problem: there was nothing in the log section of the server, as well as the server not generating all of the necessary files! Most users never knew that the .jar version of the server could be used, along with a simple batch file, to fix this problem! [[User:5chris100]] was nice enough to write this guide for Minecrafters who encounter this problem!
 
==== Downloading the file ====
 
Simple enough. Go to the [http://minecraft.net/download.jsp Minecraft download page] and download the .jar file. Save it to a folder, '''never ever ever''' to your Desktop, Downloads, Documents, etc. folder. This will cause all of the server files to be generated in that directory, and you could accidentally delete a necessary file or two. I recommend saving it to "C:\Users\[username]\Desktop\Server" or something like that, for organization's sake.
 
   
  +
The system path can also be modified from the command line. This way, the modification is forgotten as soon as you close the command window.
==== Creating the batch file ====
 
Fire up Notepad and type these two simple lines in:<br>
 
#Line 1: <code>java -Xmx2G -Xms2G -jar minecraft_server.1.7.4.jar -o true</code><br>
 
#Line 2: <code>pause</code><br>
 
   
  +
To modify the system path, enter the following command:<br>
==== Breakdown of the code ====
 
  +
<code>set path=%path%;c:\Program Files\Java\jre7\bin\</code> (if "c:\Program Files\Java\jre7\bin\" is your Java folder, see above).
#<code>java</code>: Tells the computer to access the "java.exe" program (used for running .jar files)<br>
 
#<code>-Xmx2G -Xms2G</code>: Sets the minimum and maximum RAM to be used by the server (can be changed to whatever you want)<br>
 
#<code>-jar minecraft_server.1.7.4.jar</code>: Tells "java.exe" to execute the Java archive file "minecraft_server.1.7.4.jar"<br>
 
#<code>-o true</code>: Tells the server to run in online mode so only authenticated users can join<br>
 
#<code>pause</code>: Tells the window to stay open after the /stop command is issued. Useful if you want to read what happened as it shut down.<br>
 
When you save the file, first go to the directory that you saved "minecraft_server.1.7.4.jar" to (remember I told you to save it to a folder?). '''Make sure that you change the "Save as type:" from "Text Documents" to "All Files". If you do not do this, then your file will instead be "Run.bat.txt" which is not what we want for this tutorial.''' After changing the type to "All Files," "minecraft_server.1.7.4.jar" should appear as the only file in the directory. '''Do not click on it or the file name will be transferred.''' In the "File name:" box, type '''exactly as shown:''' <code>Run.bat</code> and click "Save." Then close Notepad and proceed to the next step.<br>
 
   
  +
Instead of modifying the system path, the Java folder can also be entered as part of the Java command:<br>
==== Running the server ====
 
  +
<code>"c:\Program Files\Java\jre7\bin\java" -version</code> (again, if "c:\Program Files\Java\jre7\bin\" is your Java folder).
/me sighs. We're nearly there! Go to your server directory (the same one you saved "minecraft_server.1.7.4.jar" and "Run.bat" to. There should be only two files in the folder: A file named "minecraft_server.1.7.4" with a coffee cup-looking icon, and a file named "Run" with an icon of a box containing two gears. Double-click "Run" and you should see a standard Minecraft server window. But, oh, it's not the [[File:Minecraft server window.jpg|regular white server window]]! That's because the server was launched from a Windows Batch File, which in turn is launched in the [http://en.wikipedia.org/wiki/Command_Prompt Command Prompt]. If all goes well and you can connect to it, then mission accomplished! If, instead, you see: <code>'java' is not recognized as an internal or external command, operable program or batch file.</code>, then you need to [[http://minecraft.gamepedia.com/index.php?title=Tutorials/Setting_up_a_server#Verify_and_install_the_latest_version_of_Java update your Java]]. Once that works, ''then'' it's mission accomplished! Happy crafting!<br> [[User:5chris100|5chris100]] ([[User talk:5chris100|talk]]) 23:59, 26 November 2013 (UTC)
 
  +
  +
Please note: when entering the path together with the Java command you need to enclose the command inside quotes, because of the space character in the path (between <code>Program</code> and <code>Files</code>). When modifying the path, the quotes are '''not''' required.
  +
 
==== Starting the server ====
  +
  +
To start the server, change to the Minecraft server folder using the <code>cd</code> command, and enter the following command:<br>
 
<code>java -jar minecraft_server.jar</code><br>
  +
(Replace <code>minecraft_server.jar</code> with the .jar file name if it is different, for example <code>minecraft_server.1.7.10.jar</code>. Use <code>minecraft_server.exe</code> if you're using the executable server.)
  +
 
If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option <code>nogui</code> to the end of the command, so that it reads: <code>... minecraft_server.jar nogui</code>
  +
  +
You can also replace the <code>java</code> command with <code>javaw</code>. Javaw.exe is identical to Java.exe but there is no associated console window. This may be preferable when using a .bat file. (See the next section.) Note however that Javaw also doesn't show any error messages in the command window if anything is wrong.
  +
  +
Using the <code>Xms</code> and <code>Xmx</code> parameters, the initial and maximum memory size for Java can be specified. By default, your server runs with about 100 MB of RAM, which is very little. Most people will change their server to run on, for example:<br>
  +
<code>java -Xms512M -Xmx1G ...</code><br>
  +
<code>java -Xms1024M -Xmx1024M ...</code><br>
  +
<code>java -Xms1G -Xmx2G ...</code><br>
  +
 
Add in <code>-d64</code> if your server is on a 64-bit computer using 64-bit Java.
  +
 
Add <code>-o true</code> to tell the server to run in online mode so only authenticated users can join.
  +
 
==== Creating a .bat file to store the commands ====
  +
  +
To start the Minecraft server from the command line, without having to enter all commands every time, you need to create a "batch" (.bat) file.
  +
  +
# To do this open a text editor, for example Notepad.
 
# On the very first line add the command <br> <code>@echo off</code> <br> so that a command window isn't opened to show the output from our start file.
  +
# On the next line, enter the <code>set path</code> command if required. Usually, this is not required and if this is required, it is better off to reinstall Java and the reinstallation process will fix it.
  +
# After that you have the command that starts the Minecraft server itself. See the previous paragraphs for the possible commands to do this.
 
# Optionally, on the next line enter the command <code>pause</code> to tell the window to stay open after the /stop command is issued. Useful if you want to read what happened as it shut down.
  +
# Save the file, for example as "start-server.bat", in the Minecraft server folder (remember I told you to place the server in it's own folder?). Note: when using Notepad, use quotes around the filename "start-server.bat" when saving, because otherwise Notepad will add a ".txt" extension to the file.
  +
# Now the server can be started just by double-clicking the .bat file.
  +
  +
Here is an example of a bat file that starts the Minecraft server on Windows. Put it in the same directory the Minecraft server is.
  +
 
title run-minecraft
 
java -Xms1024M -Xmx2048M -jar minecraft_server.jar nogui
  +
pause
  +
  +
=== Further configuration ===
  +
  +
Read the sections [[#Port_forwarding|Port forwarding]] and further for more information about configuring your server.
   
 
== Mac OS X instructions ==
 
== Mac OS X instructions ==
Setting a server up in Mac OS X is [http://minecraft.net/download.jsp "more involved"] than in Windows because an executable file has not been made available. A three step in-depth video tutorial of the process can be seen [http://www.youtube.com/watch?v=fqbd3emxrcg&list=PL8NCkvVGHD21XnJ14rBQ4u7JEWvEpTOot&index=1 here]. Keep in mind that the server won't run correctly on OSX 10.4 and may crash your machine.
+
Setting a server up in Mac OS X is [http://minecraft.net/download.jsp "more involved"] than in Windows because an executable file has not been made available. A three step in-depth video tutorial of the process can be seen [http://www.youtube.com/watch?v=fqbd3emxrcg&list=PL8NCkvVGHD21XnJ14rBQ4u7JEWvEpTOot&index=1 here]. Keep in mind that the server won't run correctly on OS X 10.4 and may crash your machine.
   
 
=== Downloading ===
 
=== Downloading ===
Line 131: Line 127:
   
 
=== Installing Java ===
 
=== Installing Java ===
Mac OS X already comes with its own version of Java that is updated automatically via Software Update (Apple menu > Software Update).
+
Mac OS X already has Java downloaded onto your machine. Java is updated through Java's website
  +
If you are running OS X 10.8.* (Mountain Lion) or OS X 10.9.* (Mavericks) You need to download Java here, as Mavericks will fail when looking for it. [http://support.apple.com/kb/dl1572 Java Download]
   
 
=== Setting up the Minecraft server ===
 
=== Setting up the Minecraft server ===
Line 141: Line 138:
 
#!/bin/bash
 
#!/bin/bash
 
cd "$(dirname "$0")"
 
cd "$(dirname "$0")"
exec java -Xmx1G -Xms1G -jar minecraft_server.jar</code>
+
exec java -Xms1G -Xmx1G -jar minecraft_server.jar nogui</code>
 
*Save the file as "start.command" ''in the same folder'' as minecraft_server.jar.
 
*Save the file as "start.command" ''in the same folder'' as minecraft_server.jar.
 
**This will give the server enough RAM to run. The amount of RAM can be changed by editing the <code>1G</code> to something else, such as <code>2G</code> for 2 GB.
 
**This will give the server enough RAM to run. The amount of RAM can be changed by editing the <code>1G</code> to something else, such as <code>2G</code> for 2 GB.
Line 147: Line 144:
 
*Grant execute permissions on file start.command to Owner, Group. and Public. To do so, type in <code>chmod a+x </code>, with a space after it; drag and drop the start.command file into the terminal window; and then press enter. (This gives ''run'' permission to the start.command script.)
 
*Grant execute permissions on file start.command to Owner, Group. and Public. To do so, type in <code>chmod a+x </code>, with a space after it; drag and drop the start.command file into the terminal window; and then press enter. (This gives ''run'' permission to the start.command script.)
 
*Double-click the start.command file to start the server.
 
*Double-click the start.command file to start the server.
*A new Terminal window will open and, the first time you run the script, several error messages about missing files/directories will appear. This is normal. You're now ready to [[Setting_up_a_server#Configuring_the_Minecraft_Server|configure your server]].
+
*A new Terminal window will open and, the first time you run the script, several error messages about missing files/directories will appear. This is normal. You're now ready to [[Setting up a server#Configuring the Minecraft server|configure your server]].
  +
  +
=== Pre-Made Server Configuration ===
  +
*Vanilla:
  +
**[https://skydrive.live.com/redir?resid=F9E6AC3C0BC0ACBF!1166 Download Here]
  +
*CraftBukkit:
  +
**[http://files.gettfs.info/WohK/Pre-made%20Minecraft%20Server%20Files%20%5BCraftBukkit,%20OSX%5D.zip Download Here]
  +
  +
  +
'''Please keep in mind that these are NOT self updating. Download the newest server software here:'''
  +
*CraftBukkit:
  +
**[http://dl.bukkit.org/latest-rb/craftbukkit.jar Latest Recommended Build]
  +
**[http://dl.bukkit.org/latest-beta/craftbukkit.jar Latest Beta Build] (Please remember that this file needs to be renamed to <code>craftbukkit.jar</code>)
  +
**[http://dl.bukkit.org/latest-dev/craftbukkit.jar Latest Development Build]
  +
*Vanilla:
  +
**Find all of the minecraft server downloads [http://minecraft.net/download here] Click on the "minecraft_server.[minecraft version].jar" to download. (Please remember that this file needs to be renamed to <code>minecraft_server.jar</code>.)
  +
  +
''Please note that all CraftBukkit download links are going to be current.''
   
 
=== Using Time Capsule ===
 
=== Using Time Capsule ===
Line 166: Line 180:
 
*Change everything with the word port in it to 25565.
 
*Change everything with the word port in it to 25565.
 
*Now hit Save and update the Time Capsule.
 
*Now hit Save and update the Time Capsule.
That's it! You're now ready to [[Setting_up_a_server#Configuring_the_Minecraft_Server|configure your server]].
+
That's it! You're now ready to [[Setting up a server#Configuring the Minecraft Server|configure your server]].
   
 
=== Run as a daemon ===
 
=== Run as a daemon ===
Line 301: Line 315:
   
 
== FreeBSD instructions ==
 
== FreeBSD instructions ==
This tutorial was tested on FreeBSD 9.2 amd64.
+
This part was tested with FreeBSD 10.0 amd64 and 'jre-7u65-linux-i586.tar.gz'
 
=== Downloading ===
 
Ensure you have the latest server application software. Look [[#Download server|above]] for instructions.
 
   
 
=== Installing Java ===
 
=== Installing Java ===
  +
Due to performance and crash issue with OpenJDK and Minecraft server, we will install Sun/Oracle JRE made for linux.<br>
Most likely you do not have java in your system. You can install official Sun/Oracle Java from the ports tree: /usr/ports/java/linux-sun-jre17. Running `make install' there will direct you to Oracle site where you have to agree with their terms and download a file with your web browser. Get a file named like `jre-7u45-linux-i586.tar.gz' and place it into your /usr/ports/distfiles/ directory. You may have to set JRE_UPDATE_VERSION variable in your Makefile to the actual number (e.g. 45 like in this example) and run `make install NO_CHECKSUM=1'.
 
  +
Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this [http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu-lbc-install.html documentation].<br>
  +
Jave requires some information about the proc. You have to mount linprocfs, type:
 
<code>
  +
kldload linprocfs
  +
mount -t linprocfs linprocfs /compat/linux/proc
 
</code>
  +
and add this line to <code>/etc/fstab</code>:
  +
<code>
  +
linprocfs /compat/linux/proc linprocfs rw 0 0
  +
</code><br>
  +
The Sun/Oracle JRE has a dependency marked as forbidden and the installation will fail. Go to <code>/usr/ports/textproc/linux-f10-expat2.0.1/</code> and in the Makefile remove the line which starts with <code>FORBIDDEN=</code>.<br>
  +
Next you have to manually get the linux tarball due to licence issue (like `jre-7u65-linux-i586.tar.gz') from java official web site and copy the file to <code>/usr/ports/distfiles</code>.
  +
Then to install the JRE, go to <code>/usr/ports/java/linux-sun-jre17/</code> and run:
  +
<code>
  +
make install distclean
  +
</code>
   
  +
''Note: The previous version of this part, tested on FreeBSD 9.2 amd64, was explained like this: You may have to set JRE_UPDATE_VERSION variable in your Makefile to the actual number (e.g. 45 like in this example) and run 'make install NO_CHECKSUM=1'.''<br><br>
=== Java doesn't work ===
 
  +
Try running `java -version'. You may end up with a message that it can not find `libjli.so'. One way to fix it is to add your java paths to the search explicitly.<br>
+
Try running <code>java -version</code>. You may end up with a message that it can not find <code>libjli.so</code>. One way to fix it is to add your java paths to the search explicitly.
1. Make a symlink from /usr/local/linux-sun-jre1.7.0/lib/i386 (or wherever your Java got installed) to /compat/linux/usr/lib/java</br>
 
  +
Make a symlink:
2. In /compat/linux/etc, add the following to ld.so.conf.d/java.conf:<br>
 
  +
<code>
 
ln -s /usr/local/linux-sun-jre1.7.0/lib/i386 /compat/linux/usr/lib/java</code>
  +
</code>
 
And in <code>/compat/linux/etc/ld.so.conf.d/java.conf</code> add:
 
<code>
 
<code>
 
/usr/lib/java
 
/usr/lib/java
 
/usr/lib/java/jli
 
/usr/lib/java/jli
 
</code>
 
</code>
and run ../sbin/ldconfig
+
Run <code>/compat/linux/sbin/ldconfig</code>.<br>
  +
Now <code>java -version</code> should work.
   
=== Getting it running ===
+
=== Launching Minecraft Server ===
  +
Create a folder and copy the minecraft server jar in it.<br>
Suppose you have minecraft_server.1.7.2.jar in your current directory. Most likely if you run your sever in usual way, you'll get complaint about exception in `sun.nio.ch.EPollArrayWrapper.epollCreate' and `syscall epoll_create not implemented' in /var/log/messages.
 
  +
In the actual version you will get this exception <code>syscall epoll_create not implemented</code> if you run the server in the usual way, so we add this line to the command to fix that <code>-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider</code>.<br>
Therefore, a modified command would be like
 
  +
The command to launch is like<br>
 
<code>
 
<code>
java -Xmx1024M -Xms1024M -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -jar minecraft_server.1.7.2.jar
+
java -Xmx1024M -Xms1024M -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -jar minecraft_server.1.7.10.jar nogui
 
</code>
 
</code>
   
Line 366: Line 399:
 
{{disclaimer|section}}
 
{{disclaimer|section}}
   
An alternate way to set up a server between you and your friends is to set up a VPN (virtual private network). This method may be deemed unrecommended, and an inconvenience for many users due to the fact that all users whom wish to connect to the server must download external software in order to join or create server. An alternative to this method is to [[Tutorials/Setting_up_a_server#Port_forwarding|port forward]]. A free software utility that can be used to set this up a VPN is [https://secure.logmein.com/products/hamachi/download.aspx Hamachi] by LogMeIn. The free version allows up to 5 connections (i.e. players).
+
An alternate way to set up a server between you and your friends is to set up a VPN (virtual private network). This method may be deemed unrecommended, and an inconvenience for many users due to the fact that all users whom wish to connect to the server must download external software in order to join or create server. An alternative to this method is to [[Tutorials/Setting up a server#Port forwarding|port forward]]. Free software utilities that can be used to set up a VPN are [https://secure.logmein.com/products/hamachi/download.aspx Hamachi] by LogMeIn and [https://www.evolvehq.com/ Evolve] by Echobit. The free version of Hamachi allows up to 5 connections (i.e. players), while the free version of Evolve allows an unlimited number of connections.
   
 
=== Setting up Hamachi ===
 
=== Setting up Hamachi ===
Line 378: Line 411:
 
# Now that all the machines are connected within the same Hamachi network, the host gives their machine's Hamachi IPv4 address to the players.
 
# Now that all the machines are connected within the same Hamachi network, the host gives their machine's Hamachi IPv4 address to the players.
 
# Each player connects using this IP as per the usual Minecraft multiplayer screen.
 
# Each player connects using this IP as per the usual Minecraft multiplayer screen.
  +
  +
=== Setting up Evolve ===
  +
  +
# Install Evolve on each computer that wishes to participate in the server, including the host.<br> [https://www.evolvehq.com/client Windows]
  +
# Each computer participating must create an account on [https://www.evolvehq.com/ Evolve's website], whether they host the server or not.
  +
# On the host machine, a new Evolve party is created. This can be done after logging in by opening the Friends window, clicking the red "Friends" tab, and clicking "Create Party..."
  +
# The host installs and configures the Minecraft server software:<br> The server IP field in server.properties is left blank (as default).
  +
# The host adds each participating computer as a friend (Friends window > "Add Friend..." > enter the nickname of each computer, which was created in step 2) and then adds them in the party (double-click the party > "Send Party Invite" > enter the nickname of each friended computer. You must add them as a friend first, or they will not be added).
  +
# The players connect to the host's Evolve party.
  +
# Now that all the machines are connected within the same Evolve party, each player connects using the host's Evolve IP address (10.xxx.xxx.2, shown next to their name on the sidebar of the party) as per the usual Minecraft multiplayer screen.
  +
# Evolve also doubles as a LAN bridger, so any singleplayer worlds opened to LAN can be accessed just as any other LAN server: at the bottom of the Multiplayer screen.
  +
# The only advantage of being the party creator is that you can kick and ban players from your party. Any player in the party can host a Minecraft server.
  +
# You can get help with setting up a party from the Evolve group chat room.
   
 
== Configuring the Minecraft server ==
 
== Configuring the Minecraft server ==
# Configure the server by editing the [[server.properties]] file, the format for which is [[server.properties|explained here]]. Be certain to edit the file with a text editor that does not add formatting (e.g., for italics). Additional configuration may not be necessary as many servers run fine from the default values.
+
# Configure the server by editing the [[server.properties]] file, the format for which is [[server.properties|explained here]]. Be certain to edit the file with a text editor that does not add formatting (e.g., for italics), such as Windows 7's Notepad. Additional configuration may not be necessary as many servers run fine from the default values.
# Add your username to the admin.txt and/or ops.txt (newer Minecraft versions may not have an admin.txt file).
+
# Add your username to the admin.txt and/or ops.txt to become an [[administrator]] or [[operator]]. (Newer Minecraft versions may not have an admin.txt file). Each username must be on a separate line.
#* Ops.txt and admin.txt determine who may execute [[server commands]]. In other words, operator ("[[op]]") privileges allow you to control certain aspects of the game (e.g., teleporting players).
+
#* Administrators and operators may execute [[commands]]. In other words, operator ("[[op]]") privileges allow you to control certain aspects of the game (e.g., teleporting players).
#* Op privileges may also be granted from the server GUI: type "op <username>" and it will automatically add <username> to the ops.txt file.
+
#* Operator privileges may also be granted from the server GUI: type "op <username>" and it will automatically add <username> to the ops.txt file.
   
 
== Connect to the Minecraft server ==
 
== Connect to the Minecraft server ==
Line 455: Line 501:
 
*3306 (Used by most MySQL Servers)
 
*3306 (Used by most MySQL Servers)
   
Generally avoid any port below number 1024, since those ports are generally referred as [[wikipedia:List of TCP and UDP port numbers#Well-known_ports|well-known ports]] and are registered with the IANA for important services.
+
Generally avoid any port below number 1024, since those ports are generally referred as [[wikipedia:List of TCP and UDP port numbers#Well-known ports|well-known ports]] and are registered with the IANA for important services.
 
----
 
----
   
Line 561: Line 607:
 
Here are some other tutorials on how to set up a Minecraft server:
 
Here are some other tutorials on how to set up a Minecraft server:
 
* Windows
 
* Windows
** [https://www.youtube.com/watch?v=ZQKooVkmAFQ Server Tutorial: How to Make A Vanilla Minecraft Server 1.7.4]
+
** [https://www.youtube.com/watch?v=ZQKooVkmAFQ Server Tutorial: How to Make A Vanilla Minecraft Server]
 
** [http://www.youtube.com/watch?v=1cSgHbtX4YY How To Make a 1.6.2 Minecraft Server on Windows]
 
** [http://www.youtube.com/watch?v=1cSgHbtX4YY How To Make a 1.6.2 Minecraft Server on Windows]
 
** [http://www.youtube.com/watch?v=RGkrLW_Jk50 How to Set Up and Host a Vanilla 1.5.2 Windows Minecraft Server]
 
** [http://www.youtube.com/watch?v=RGkrLW_Jk50 How to Set Up and Host a Vanilla 1.5.2 Windows Minecraft Server]
Line 572: Line 618:
 
** [http://gamecrunch.co/2011/10/09/setup-minecraft-server-on-centos-vps/ How to Install Minecraft Server on CentOS ]
 
** [http://gamecrunch.co/2011/10/09/setup-minecraft-server-on-centos-vps/ How to Install Minecraft Server on CentOS ]
 
* Others
 
* Others
** [https://www.youtube.com/watch?v=h92atM9ir-0 How to Set Up Port Forwarding 1.7.4]
+
** [https://www.youtube.com/watch?v=h92atM9ir-0 How to Set Up Port Forwarding]
 
** [http://www.youtube.com/watch?v=ye_BnHAEJGU How to Port Forward any Minecraft Server (1.6.2)]
 
** [http://www.youtube.com/watch?v=ye_BnHAEJGU How to Port Forward any Minecraft Server (1.6.2)]
 
** [http://www.minecraftforum.net/viewtopic.php?t=836 Alternative port forwarding tutorial for Windows (with pictures)]
 
** [http://www.minecraftforum.net/viewtopic.php?t=836 Alternative port forwarding tutorial for Windows (with pictures)]

Revision as of 23:26, 8 November 2014

Warning

Before following these instructions please note that running server software on your computer without a clear understanding of what you are doing may seriously harm your system and lead to vulnerabilities.[1] 

Template:Tocright This tutorial takes you through the steps of setting up your own server using the default server software that Mojang distributes free of charge. The software may be installed on most operating systems, including Windows, Mac and Linux.

Regardless of your operating system, you must begin by downloading the server software from the minecraft download page. The server is available as either a Java .jar file or a Windows .exe file. The .exe version may seem easier to use, but in case of problems the .jar version gives better error messages and it is more configurable.

Note: There is also custom server software available, which most large servers use, but these applications are not supported by Mojang.

Warning

Since you're about to run your own server, you should be aware of the possible dangers. Although we can not prevent people from running their server and putting themselves at risk, we may at least appeal that you don't do it when having no idea what you actually do. Running by the instructions below should not put you at any risk, but since this is a wiki which everybody is allowed to edit, and we don't know about your system configuration, we cannot guarantee you'll be out of danger. In order to run your server and stay out of trouble, we strongly recommend you should at least know about the following:

  • Networking in general (IP, DHCP, ports etc.)
  • Your system configuration
  • Your network configuration
  • Your router configuration (if you want other people to connect over Internet)

Alternatively, if you decide that you don't wish to create a server, you are welcome to join other servers, which can be found here.

Windows instructions

Verify that the latest version of Java is installed

The Minecraft server (also the Windows .exe) requires Java (also called the Java Runtime Environment or JRE). For your security, you should only use the most recent version of Java. To verify that you have the latest version, do one of the following:

  • Open Windows Control Panel, find Java (it may be inside the Programs category), and click on Update Now.
  • If Java has been enabled in your browser, you can also visit http://java.com/en/download/installed.jsp. This will perform an automatic version check.
  • The following method will only work if the Java folder has been added to the system path. Open a command window. (Whilst holding the Windows key down, press R to open the Run dialog. Type cmd and press enter or click OK.) Once the command prompt has opened, enter the command java -version, followed by the enter key. If a version number is reported, then check the Java website at http://www.java.com/download/ to see what the most recent version number is.

If you don't have Java, or your version is outdated, then download it at http://www.java.com/download/. If you also want to be able to use Java in your webbrowser, you will probably have to install the 32-bit version, even if you are running 64-bit Windows, because most webbrowsers are still 32-bit. (Read more about this at http://java.com/en/download/faq/java_win64bit.xml) If you are using a 64-bit webbrowser, or don't need to use it with your webbrowser, you can install the 64-bit version. It is possible to install both the 32-bit and the 64-bit versions, but then you need to remember to upgrade both versions when they are outdated.

Start the Minecraft server

Before starting the server, make sure you place the downloaded file (.exe or .jar) in a folder of it's own. Don't run the server from your desktop, download folder, or any other common place. The server creates several configuration files in the application folder, and these are easier to find if everything is in a dedicated folder.

Double click the file and the server should start. It will put configuration files in the folder, and quit immediately.

The first, and required, configuration you have to do is accepting the EULA. A text file call eula.txt is created in the application folder. Open this file in a text editor (Notepad, Gedit, TextEdit, etc. Do not use a rich text editor like Wordpad.) and change the line eula=false to eula=true. It signifies that you have read and understood the end user license agreement that you'll follow when using the software. If you don't do this, the server will shut down immediately when you try to start it.

If you get an error such as "Can't save server.properties" and your screen fills with useless, gibberish text, then run the Minecraft Server as administrator by right-mouse clicking on it and choosing 'Run as administrator'. (You may need the administrator password to do this.)

After the first start, you'll probably want to shut it down and then edit some configuration files, as is explained below.

Starting from the command line

Both the Java and the executable version can be run from the command line with extra parameters to configure, for example, memory usage.

Running from the command line requires that the Java folder is included in the system path, or that it is specified on the command line. The Java installer does not do this for you (anymore), so you will have to do this yourself. You can either modify the system path permanently, or make a temporary modification every time you start the server.

Either method requires that you know the location of the Java folder. Unless you made changes while installing Java, this folder should be:

  • if you are using 32-bit Windows: c:\Program Files\Java\jre7\bin\
  • if you are using 32-bit Java on 64-bit Windows: c:\Program Files (x86)\Java\jre7\bin\
  • if you are using 64-bit Java on 64-bit Windows: c:\Program Files\Java\jre7\bin\

Permanently modifying the system path

  1. Right click Computer (either on your desktop, in the Start menu, or in the Windows Explorer).
  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 current value a semicolon (;) and the location of your Java folder, for example c:\Program Files (x86)\Java\jre7\bin\. (See above.)
  7. Close any command windows that are open. (A reboot is not required.)
  8. Now (re)open the command prompt and enter the command java -version. Java should now report the installed version.

Specifying the path on the command line

The system path can also be modified from the command line. This way, the modification is forgotten as soon as you close the command window.

To modify the system path, enter the following command:
set path=%path%;c:\Program Files\Java\jre7\bin\ (if "c:\Program Files\Java\jre7\bin\" is your Java folder, see above).

Instead of modifying the system path, the Java folder can also be entered as part of the Java command:
"c:\Program Files\Java\jre7\bin\java" -version (again, if "c:\Program Files\Java\jre7\bin\" is your Java folder).

Please note: when entering the path together with the Java command you need to enclose the command inside quotes, because of the space character in the path (between Program and Files). When modifying the path, the quotes are not required.

Starting the server

To start the server, change to the Minecraft server folder using the cd command, and enter the following command:
java -jar minecraft_server.jar
(Replace minecraft_server.jar with the .jar file name if it is different, for example minecraft_server.1.7.10.jar. Use minecraft_server.exe if you're using the executable server.)

If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option nogui to the end of the command, so that it reads: ... minecraft_server.jar nogui

You can also replace the java command with javaw. Javaw.exe is identical to Java.exe but there is no associated console window. This may be preferable when using a .bat file. (See the next section.) Note however that Javaw also doesn't show any error messages in the command window if anything is wrong.

Using the Xms and Xmx parameters, the initial and maximum memory size for Java can be specified. By default, your server runs with about 100 MB of RAM, which is very little. Most people will change their server to run on, for example:
java -Xms512M -Xmx1G ...
java -Xms1024M -Xmx1024M ...
java -Xms1G -Xmx2G ...

Add in -d64 if your server is on a 64-bit computer using 64-bit Java.

Add -o true to tell the server to run in online mode so only authenticated users can join.

Creating a .bat file to store the commands

To start the Minecraft server from the command line, without having to enter all commands every time, you need to create a "batch" (.bat) file.

  1. To do this open a text editor, for example Notepad.
  2. On the very first line add the command
    @echo off
    so that a command window isn't opened to show the output from our start file.
  3. On the next line, enter the set path command if required. Usually, this is not required and if this is required, it is better off to reinstall Java and the reinstallation process will fix it.
  4. After that you have the command that starts the Minecraft server itself. See the previous paragraphs for the possible commands to do this.
  5. Optionally, on the next line enter the command pause to tell the window to stay open after the /stop command is issued. Useful if you want to read what happened as it shut down.
  6. Save the file, for example as "start-server.bat", in the Minecraft server folder (remember I told you to place the server in it's own folder?). Note: when using Notepad, use quotes around the filename "start-server.bat" when saving, because otherwise Notepad will add a ".txt" extension to the file.
  7. Now the server can be started just by double-clicking the .bat file.

Here is an example of a bat file that starts the Minecraft server on Windows. Put it in the same directory the Minecraft server is.

title run-minecraft
java -Xms1024M -Xmx2048M -jar minecraft_server.jar nogui
pause

Further configuration

Read the sections Port forwarding and further for more information about configuring your server.

Mac OS X instructions

Setting a server up in Mac OS X is "more involved" than in Windows because an executable file has not been made available. A three step in-depth video tutorial of the process can be seen here. Keep in mind that the server won't run correctly on OS X 10.4 and may crash your machine.

Downloading

Ensure you have the latest server application software. Look above for instructions.

Installing Java

Mac OS X already has Java downloaded onto your machine. Java is updated through Java's website If you are running OS X 10.8.* (Mountain Lion) or OS X 10.9.* (Mavericks) You need to download Java here, as Mavericks will fail when looking for it. Java Download

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:

#!/bin/bash
cd "$(dirname "$0")"
exec java -Xms1G -Xmx1G -jar minecraft_server.jar nogui
  • Save the file as "start.command" in the same folder as minecraft_server.jar.
    • This will give the server enough RAM to run. The amount of RAM can be changed by editing the 1G to something else, such as 2G for 2 GB.
  • Open Terminal (in /Applications/Utilities/Terminal).
  • Grant execute permissions on file start.command to Owner, Group. and Public. To do so, type in chmod a+x , with a space after it; drag and drop the start.command file into the terminal window; and then press enter. (This gives run permission to the start.command script.)
  • Double-click the start.command file to start the server.
  • A new Terminal window will open and, the first time you run the script, several error messages about missing files/directories will appear. This is normal. You're now ready to configure your server.

Pre-Made Server Configuration


Please keep in mind that these are NOT self updating. Download the newest server software here:

  • CraftBukkit:
  • Vanilla:
    • Find all of the minecraft server downloads here Click on the "minecraft_server.[minecraft version].jar" to download. (Please remember that this file needs to be renamed to minecraft_server.jar.)

Please note that all CraftBukkit download links are going to be current.

Using Time Capsule

Some homes use AirPort Time Capsule as a wireless router instead of other brands. This section will teach you how to set one up without messing up your file server.

NOTE: Make sure you have your admin username and password.

  • Open System Preferences > Network.
  • Click the Advanced button and go under TCP/IP.
  • Where it says Configure IPv4, change that option to Using DHCP with manual address.
  • Change the IP address to 10.0.1.x, where x can be any number from 1 to 100.
  • Now go to the Sharing section and make sure that Internet Sharing is on.
  • Now, open up AirPort Utility and edit your Time Capsule settings.
  • Go under Network and make sure the option Router Mode is set to DHCP and NAT. Now, click the + button under the Port Settings.
  • Type in the following:
    • Description: Minecraft Server (or whatever you want to call it)
    • Private IP Address: The address you chose for the 4th step.
  • Change everything with the word port in it to 25565.
  • Now hit Save and update the Time Capsule.

That's it! You're now ready to configure your server.

Run as a daemon

Alternatively you can automate the startup of the Minecraft server.

Create a Mac OS X startup daemon

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 above for instructions.

Installing Java

If you get java: command not found (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 Oracle Java is recommended. A few individuals have experienced issues with OpenJDK. Others report that running on OpenJDK is completely fine.

Debian

Ensure that the non-free repository is being scanned by apt. You do this by adding non-free to your /etc/apt/sources.list file. e.g.:

deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free

Update your sources list (as root):

apt-get update

Then to install Java, simply type this in terminal and press enter (as root):

apt-get install sun-java6-jre

Ubuntu

Unfortunately, some licensing issues have prevented Canonical from allowing repositories to have Sun Java, so you must either download it directly from Oracle, package it, and install it or you could use the PPA provided by webupd8 by following the instructions below.

This guide has been tested on Ubuntu Server 12.10.

Note: You might need to install the package "software-properties-common" by running apt-get install software-properties-common and/or "python-software-properties" by running apt-get install python-software-properties to use the apt-add-repository command.

Run the following commands in this order to add the PPA, update the source list and then install java:
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Then run this to check what version you have installed:
java -version

The output should be similar to:
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

For more information or troubleshooting see this link at webupd8s site

openSUSE

On older versions, you can simlpy type zypper in java-1_6_0-sun into a terminal.

On newer versions, there is a tutorial here describing how to install Java.

Arch Linux

Open a terminal and run pacman -S jre7-openjdk as root.

Gentoo

Use: emerge virtual/jre

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, substituting 'minecraft_server' with the name of the folder you extracted the server to:

cd minecraft_server
java -Xms1G -Xmx1G -jar minecraft_server.jar nogui

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.

cd minecraft_server
java -Xms1G -Xmx1G -jar minecraft_server.jar nogui
free -m
It may look like this:

File:Ram left.PNG

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:

java -Xms1536M -Xmx1536M -jar minecraft_server.jar nogui

Voila, it should run smoothly now

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

java -Xms32M -Xmx512M -jar minecraft_server.jar nogui

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 512 MB. However, this will result in a little slowdown whenever the allocation is done.

Startup and maintenance script

Alternatively you can manage/automate the startup and shutdown of the Minecraft server using a script such as the ones listed below:

FreeBSD instructions

This part was tested with FreeBSD 10.0 amd64 and 'jre-7u65-linux-i586.tar.gz'

Installing Java

Due to performance and crash issue with OpenJDK and Minecraft server, we will install Sun/Oracle JRE made for linux.
Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this documentation.
Jave requires some information about the proc. You have to mount linprocfs, type:

 kldload linprocfs
 mount -t linprocfs linprocfs /compat/linux/proc

and add this line to /etc/fstab:

 linprocfs   /compat/linux/proc   linprocfs   rw   0  0


The Sun/Oracle JRE has a dependency marked as forbidden and the installation will fail. Go to /usr/ports/textproc/linux-f10-expat2.0.1/ and in the Makefile remove the line which starts with FORBIDDEN=.
Next you have to manually get the linux tarball due to licence issue (like `jre-7u65-linux-i586.tar.gz') from java official web site and copy the file to /usr/ports/distfiles. Then to install the JRE, go to /usr/ports/java/linux-sun-jre17/ and run:

 make install distclean

Note: The previous version of this part, tested on FreeBSD 9.2 amd64, was explained like this: You may have to set JRE_UPDATE_VERSION variable in your Makefile to the actual number (e.g. 45 like in this example) and run 'make install NO_CHECKSUM=1'.

Try running java -version. You may end up with a message that it can not find libjli.so. One way to fix it is to add your java paths to the search explicitly. Make a symlink:

 ln -s /usr/local/linux-sun-jre1.7.0/lib/i386 /compat/linux/usr/lib/java

And in /compat/linux/etc/ld.so.conf.d/java.conf add:

 /usr/lib/java
 /usr/lib/java/jli

Run /compat/linux/sbin/ldconfig.
Now java -version should work.

Launching Minecraft Server

Create a folder and copy the minecraft server jar in it.
In the actual version you will get this exception syscall epoll_create not implemented if you run the server in the usual way, so we add this line to the command to fix that -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider.
The command to launch is like
java -Xmx1024M -Xms1024M -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -jar minecraft_server.1.7.10.jar nogui

Plan 9

Use: alien-convert <path-to-your-jre->.deb chmod ~/~ rwx for <current user> Then snarf java -jar <path to your .jar> xvmf in acme

Port forwarding

See also: Port forwarding

Port forwarding is used when you have a router and you wish to let users connect to your server through it. If you wish to host your server for local reasons, it is not required that you do so. Keep in mind that port forwarding might cause security risks.

When port forwarding, it varies on how your router will ask you for the information. If you don't understand on how your router wants you to input the information, try visiting PortForward.com for a tutorial. If you still need help, please visit the Minecraft Forums and create a thread asking for help (You need to register).


Once you have managed to locate your router's admin page, and find the Port Forwarding page; hit add new service (may not work) (if you use belkin, this can be very difficult to perform) or custom service. When you get a page asking to setup the new rule, it should prompt you on what you want to call it. You may name it as you wish but for simplicity, name it "minecraft". Then you want to look for "type". Select TCP. For the ports (internal and external), enter 25565. If it asks for anything else other than output IP (or internal IP, server IP), leave it alone and continue.

For the out put IP address, use the following steps.

Windows
Locate to your desktop and hit start. From there, either search for cmd, or on previous versions of windows press "run" and type in cmd and hit enter. Once you have completed those steps, a console window should open. From there, enter "ipconfig /all" and press ENTER. From there, you should be given a list of text. Scroll up to Wireless LAN, and look at IPv4 address. On the right should be a couple of numbers, (xxx.xxx.xxx.xxx) copy this down by right clicking the window, and pressing mark; Highlight the area and hit enter. Don't copy any parenthesis or letters.
Mac
Ip-address-mac-610x206

The IP location on Mac OS X

Locate your way to your desktop. Pull up the apple menu under the logo and scroll down to System Preferences; then select "Network" your IP should be on the lower right as "IP address (xxx.xxx.xxx.xxx). Once you have your IP, copy it down.
Linux
Either you use the network diagnose center (depending on distribution), or the terminal with ifconfig. The output should return all your interfaces. Search for inet addr:xxx.xxx.xxx.xxx, copy the xxx.xxx.xxx.xxx numbers down.

Once you have this IP, enter it in the "Output IP / Server IP" or what ever way it asks for where the service points to.

Once you have completed it, find where it says to save/continue/apply. And you have successfully port forwarded. When you run your minecraft server, you have to leave the Server IP field empty in the server properties.

For people to connect to your server, they must use your external IP, which you can find at websites such as IP Chicken. If you don't want to use such IPs, use DynDNS services such as NoIP DynDNS

Configure and connect

Now it is time to configure and connect.

Setting up a VPN

Paper
The contents of this section are not supported by Mojang Studios or the Minecraft Wiki.

An alternate way to set up a server between you and your friends is to set up a VPN (virtual private network). This method may be deemed unrecommended, and an inconvenience for many users due to the fact that all users whom wish to connect to the server must download external software in order to join or create server. An alternative to this method is to port forward. Free software utilities that can be used to set up a VPN are Hamachi by LogMeIn and Evolve by Echobit. The free version of Hamachi allows up to 5 connections (i.e. players), while the free version of Evolve allows an unlimited number of connections.

Setting up Hamachi

  1. Install Hamachi on each computer that wishes to participate in the server, including the host.
    Windows / Mac
    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. The host server signs up for admin via the Logmein website.
  3. On the host machine, a new Hamachi network is created.
  4. The host installs and configures the Minecraft server software:
    The server IP field in server.properties is left blank (as default).
  5. The host passes the newly created Hamachi network credentials to each of the players.
  6. The players connect to the host's Hamachi network.
  7. Now that all the machines are connected within the same Hamachi network, the host gives their machine's Hamachi IPv4 address to the players.
  8. Each player connects using this IP as per the usual Minecraft multiplayer screen.

Setting up Evolve

  1. Install Evolve on each computer that wishes to participate in the server, including the host.
    Windows
  2. Each computer participating must create an account on Evolve's website, whether they host the server or not.
  3. On the host machine, a new Evolve party is created. This can be done after logging in by opening the Friends window, clicking the red "Friends" tab, and clicking "Create Party..."
  4. The host installs and configures the Minecraft server software:
    The server IP field in server.properties is left blank (as default).
  5. The host adds each participating computer as a friend (Friends window > "Add Friend..." > enter the nickname of each computer, which was created in step 2) and then adds them in the party (double-click the party > "Send Party Invite" > enter the nickname of each friended computer. You must add them as a friend first, or they will not be added).
  6. The players connect to the host's Evolve party.
  7. Now that all the machines are connected within the same Evolve party, each player connects using the host's Evolve IP address (10.xxx.xxx.2, shown next to their name on the sidebar of the party) as per the usual Minecraft multiplayer screen.
  8. Evolve also doubles as a LAN bridger, so any singleplayer worlds opened to LAN can be accessed just as any other LAN server: at the bottom of the Multiplayer screen.
  9. The only advantage of being the party creator is that you can kick and ban players from your party. Any player in the party can host a Minecraft server.
  10. You can get help with setting up a party from the Evolve group chat room.

Configuring the Minecraft server

  1. Configure the server by editing the server.properties file, the format for which is explained here. Be certain to edit the file with a text editor that does not add formatting (e.g., for italics), such as Windows 7's Notepad. Additional configuration may not be necessary as many servers run fine from the default values.
  2. Add your username to the admin.txt and/or ops.txt to become an administrator or operator. (Newer Minecraft versions may not have an admin.txt file). Each username must be on a separate line.
    • Administrators and operators may execute commands. In other words, operator ("op") privileges allow you to control certain aspects of the game (e.g., teleporting players).
    • Operator privileges may also be granted from the server GUI: type "op <username>" and it will automatically add <username> to the ops.txt file.

Connect to the Minecraft server

  • If you are playing on the same machine on which the server is running, select the "Multiplayer" option in the game client, click direct connect, and then type in "localhost" instead of an IP address.
    • Both hosting and playing on the same machine is not a recommended practice unless you have a powerful computer (e.g. more than 6 gigabytes of ram (5 for the server, 1 for the client, and remainder for system).
  • Users within your local network (i.e. that are accessing the same router) can connect using your internal IP address - port forwarding is not required for such local connections. The internal IP address of a specific network adapter can be found by typing "ipconfig" into command prompt and looking for the ipv4 address.
  • People connecting from the Internet (i.e., outside of your local network) must connect using your external IP address. You must port forward for someone outside your network to connect to the server.

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 MyWANIP to periodically check on the external IP address. You may also search "my ip address" on Google and it will show your 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).

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 You Get Signal. 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 YouGetSignal.

Local network dedicated servers

This only applies to Classic (v0.30) servers.

A common problem for server administrators is the inability to connect to your own server via another machine on your local network. A typical scenario for this is that you have a Classic server running on a dedicated machine, and you have your own machine which you play on. They're both connected to the same router/switch, and have internal IP's with the octets '192.168.x.x'. Normally, connecting via the URL generated for your server will result in an error message claiming that the server is offline.

To correct this, you must add a function to the end of your URL, bookmarks, or whatever else you connect by. The function is: ?override=true
Example: http://www.minecraft.net/classic/play/4c3bebb1a01816acbe31c5ece1570da5?override=true

Previously, (before the 1.8 beta and website update) this was &override=true. This caused much confusion since the change was not announced by Mojang, and wasn't announced on the website applet pages either. Before the update, connecting to your own URL via the website resulted in red text under the applet window saying "If you can't connect, try this link instead." The link returned the same thing, with the &override=true affixed to the end.

Note: This situation does not effect Beta servers, and you should be able to connect via an internal or external IP.

FAQ (frequently asked questions)

Q: I have a problem which is not answered in here! What should I do to?

A: Go to the Minecraft Forums and post your problem there. To help you, they need the following information:

  • Operating system
  • Version of Java
  • One machine or multiple computers
  • Exact description of the problem
  • Steps you have taken to solve the problem
  • Any errors you encountered
  • Screenshots of the problem (if possible)
  • Anything else that might help us to solve your problem - there almost never is too much information (passwords would be too much information!)

And please, if we were able to help you, post where the problem was exactly and what the fix was for that. Other people will appreciate that (and we will be able to get a grip on the common problems)!


Q: On a Windows computer, when I double click the batch file it opens a command prompt window, but quickly disappears and the server does not start.

A: Right-click your .bat program and hit edit; add a new line and type pause save and run the file. If it says invalid path, it is probably due to an incorrect path for javaw.exe or your server software. You may just need to change /jre7/ to /jre6/ . Or search your system for javaw.exe and adjust the path accordingly. (It's probably under c:\program files or c:\program files (x86).) Also, you must have the offline version of Java installed—not just the Java plug-in for your browser.

You can also try replacing the contents of the .bat file with: START "minecraft" "C:\Program Files (x86)\Java\jre7\bin\javaw.exe" -Xms1024m -Xmx1024m -jar "Minecraft_Server.exe" amending name values/locations as required


Q: Whenever I try to get the server up, it says "Failed to bind to port!".

A: This usually means that you have tried to use a port that is already in use or that you do not have permission to use (ports < 1024 are privileged and require root to bind to). You can try a different port by changing it in your server.properties file in this line: server-port=25565.

Note: You should avoid using the following ports for your server as some ISPs may block these ports for security reasons and you shouldn't be running the Minecraft server as root (in the case of a Linux type OS and ports < 1024):

  • 21 (Used by most FTP Servers)
  • 22 (Used by Secure Shell daemon)
  • 25 (Used by Mail Servers for SMTP)
  • 53 (Used by DNS Servers)
  • 80 (Used by most Web Servers)
  • 110 (Used by most Mail Servers for POP3)
  • 115 (Used by Simple File Transfer Protocol)
  • 143 (Used by Mail Servers for IMAP)
  • 443 (SSL port for Web Servers)
  • 3306 (Used by most MySQL Servers)

Generally avoid any port below number 1024, since those ports are generally referred as well-known ports and are registered with the IANA for important services.


Q: I tried to run the server with Solaris/OpenSolaris and got the following error:

java.io.InterruptedIOException: Operation interrupted 
at java.net.SocketInputStream.socketRead0(Native Method) 
at java.net.SocketInputStream.read(SocketInputStream.java:129) 
at java.net.SocketInputStream.read(SocketInputStream.java:182) 
at java.io.FilterInputStream.read(FilterInputStream.java:66) 
at gq.a(SourceFile:131) 
at ji.g(SourceFile:197) 
at ji.c(SourceFile:17) 
at oq.run(SourceFile:84) 
2011-05-31 16:57:26 [INFO] /:44673 lost connection

A: For whatever reason, out of all of the operating systems, only Solaris throws that exception when a thread interrupts a connection. A workaround is to change the default behavior on the command line:

java -Xmx1G -Xms32M -XX:-UseVMInterruptibleIO -XX:+UseConcMarkSweepGC \
 -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts\
 -jar minecraft.jar nogui

This instructs Java to use an interruptible IO stack instead of the default IO that is sensitive to interrupted threads.


Q: When I try to connect to my server this is what it says:

               Connection lost 
 
The server responded with an invalid server key

A: This error is usually caused when the server sends an unrecognized function to the client, which may be caused by using unrecognized server software, unbalanced client / server versions or modifications to the client.


Q: I cannot break/place any blocks!?

A: This is most usually caused by interacting with blocks in a protected area. If you are trying to interact near spawn, most likely it has been protected, by the minecraft server software; either build away from it or get operator status.


Q: My server runs fine but I cannot connect to it!

A: This could be caused by a series of issues. Please post a thread using the template provided above.


Q: How do you give a .jar server more ram?

A: Change the numbers in the server launch command "-Xmx1G -Xms1G". The -Xms part specifies how much memory the server starts with, and the -Xmx part is the maximum amount of memory the server can use. -Xmx1G -Xms2G = 1GB -Xmx2G -Xms1G = 2GB And so on.



Q: Help! How do you find out your server's IP address?

A: Read #Connect to the Minecraft server

Video/Alternative Tutorials

Here are some other tutorials on how to set up a Minecraft server: