在依照本页面上的所有步骤架设服务器之前,请注意如果您不清楚您自己在做什么而运行服务端软件,将会导致您的系统出现错误甚至出现崩溃。
本教程将指导您,使用默认的服务器软件建立自己的服务器(Mojang免费提供的)。该软件可能安装在大多数操作系统上,包括Windows,macOS,GNU / Linux和BSD。
注意事项
架设服务器需要一些时间和一些技术知识。除非您具有一些基本的计算机和网络功能,否则不要尝试架设服务器。最好的选择也许是在Internet上寻找有关如何架设服务器的教程。
- Minecraft服务器不需要非常强大的性能,但上网本和笔记本通常不适合用作服务器计算机。与台式机相比,它们的硬件和磁盘读写性能可能较弱。
- 如果您的计算机功能强大,你可以在同一台计算机上实现服务器的搭建和客户端游戏的游玩。
- 不建议使用WLAN网络来搭建多人游戏服务器。
- 如果您决定不想搭建服务器,但仍然想和朋友一起游玩,我们欢迎您加入其他服务器,其他服务器列表可以在这里找到。
- 如果您执意搭建自己的服务器而不想托管服务器硬件,请查看Minecraft论坛或其他网站的Minecraft服务器托管区域。由于免费的托管服务是很少见的,所以您需要每月支付相应的费用,但是您省下了维护服务器的麻烦,并确保您的玩家始终可以使用它。
Note: 网上也有许多Minecraft的第三方服务器端程序,不过它们都是不受Mojang技术支持的。——这类服务器可能有一些额外功能,但在诸多游戏特性上可能与原版服务端大不相同,此类服务器的搭建建议另外寻找文档
注意事项
盲目的在计算机上运行服务器软件,可能会使系统容易受到来自外部的攻击。
由于您将要运行自己的服务器,因此应注意可能存在的危险。按照下面的说明进行操作并不会给您带来任何风险,但这是每个人都可以编辑的Wiki,并且我们不知道您的系统配置,因此我们不能保证您的系统安全。
为了确保您根据下面的教程架设服务器而不会出现问题,我们强烈推荐您至少知道以下的内容:
- 基本的网络搭建术语(IP、DHCP、网络端口等)
- 您的系统配置
- 您的网络构成环境
- (如果您有路由器或交换机等)您的路由器配置
当然,如果您并不希望自己搭建服务器,我们欢迎您加入其他服务器,其他服务器列表可以在这里找到。
Java
Java 是一种编程语言,旨在为Java虚拟机(JVM)创建程序. JVM支持许多不同的平台。这样,开发人员可以为JVM编写代码,并且JVM支持的任何平台都可以运行该程序。
本部分旨在回答有关Java的一些常见问题,并指导您做出有关Java的一些决策。
OpenJDK vs OracleJDK
OpenJDK和OracleJDK非常相似。OpenJDK是Java的官方开源参考实现。OpenJDK是一个开源代码库,几乎所有其他JDK都建立在该代码库上。排除包装,外观和许可证方面的差异,OpenJDK与OracleJDK相同。
OracleJDK(OTN)版本需要付费订阅才能用于商业和生产目的,即使它是非盈利性的,这也可能包括Minecraft服务器。Oracle也提供了OpenJDK,但是它们并未打包成安装程序格式以便于使用。
JRE vs JDK
JRE用于运行Java程序。JDK用于开发Java程序。JDK带有JVM附带的JRE 。如果您拥有JDK,那么您也拥有了JRE和JVM。Minecraft官方服务端(Vanilla)仅仅需要JRE就可以运行,但有些服务端插件可能需要JDK。
安装过程
运行Minecraft服务器的一般过程是,安装java,运行服务端软件(server.jar),接受EULA,然后再次运行。安装java并打开命令行后,所有内容基本上都是相同的。
- 检查系统要求的CPU,RAM和磁盘空间。
- 安装Java。
- 从这里下载官方最新的服务端程序 download page.
- 新建一个文件夹用来存储世界文件,将下载的jar文件复制进去,这个文件夹将用来容纳服务端的所有世界存档文件。
- 打开命令提示符或终端界面。
- 输入
java -version来检查Java是否已经成功安装。 - 输入
cd(更改目录),然后键入放置服务器jar文件的文件夹的路径。 - 输入
java -jar server.jar --nogui(将server.jar替换为下载的服务端文件名,一般来说是server.jar)。 - 阅读并许可EULA。 服务端在首次运行时会在目录下生成
eula.txt。打开并将eula=false修改成eula=true. 它表示您已经阅读并理解使用该软件时要遵循的最终用户许可协议。如果不这样做,则尝试启动服务器时,服务器将立即关闭。 - 现在服务器已经被架设好了, 键入
java -jar minecraft_server.jar来运行你的服务端。
Minecraft options
服务器启动脚本的额外选项在该 -jar minecraft_server.jar 部分之后。键入 --help 以查看可以传递给服务器的所有可用参数。下面是服务器可用的命令行选项的列表。
--bonusChest- 如果允许奖励箱生成,那么第一次生成世界时会生成一个奖励箱的箱子。
--eraseCache- 清除光照缓存。
--forceUpgrade- 强制升级所有区块,使之符合当前游戏版本。
--help- 显示帮助文档
--initSettings- 初始化“ server.properties”和“ eula.txt”,然后退出。(因为eula.txt被初始化,服务端不会启动)
--nogui- 打开服务端而不显示gui界面。
--port <Integer>- 要侦听的端口将覆盖server.properties里指定的端口。(默认值:-1)
--safeMode- 仅仅加载来自vanilla原版服务端的数据包。
--serverId <String>- Gives an ID to the server. (??)
--singleplayer <String>- Runs the server in offline mode (unknown where <String> is used for, probably used internally by mojang?)
--universe <String>- The folder in which to look for world folders. (default: .)
--world <String>- The name of the world folder in which the level.dat resides.
- Older Commandline Options
Some options worked in older versions but were removed or replaced by newer ones.
-o true- to tell the server to run in online mode so only authenticated users can join. (This may no longer work in newer versions)
Example command line
- Running a world found in the folder "cold" on port 1337, with 1G of RAM allowed:
java -Xmx 1G -jar minecraft_server.jar --port 1337 --nogui --world cold.
Windows instructions
Installing Java
Minecraft服务端的运行依赖于JRE. 为了确保您的安全, 您只需要安装来自官网的最新版本的Java. 为了确保您已经安装了最新版本的Java,您需要进行如下操作中的一个:
- 访问 http://java.com/en/download/installed.jsp. 这将自动检测您系统中的Java版本。
- 打开命令提示符并键入
java -version将返回的版本与Java website 中显示的版本相比对。
如果你没有安装Java或者Java版本已过期,你可以前往以下网站安装 https://adoptopenjdk.net/ (OpenJDK) 或者http://www.java.com/download/ (Oracle "OTN" JDK)
macOS instructions
Keep in mind that the server won't run correctly on macOS 10.4 and earlier and may crash your machine.
Installing Java
Open the terminal.
- Check if you have java by running
java -version. Make sure it's
newer than 1.6 (best if newer than 1.8).
- If you don't have java, you can install it via HomeBrew:
- Run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"to install HomeBrew first. - Run
brew cask install adoptopenjdkto install java (OpenJDK).
- Run
- Run
java -versionagain. You should get something this time.
Setting up the Minecraft server
See the Common instructions.
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 is a number between the last number of the two numbers under DHCP range (i.e. 10.0.1.2 to 10.0.1.254 would be anywhere between 2 and 254).
- 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.
Linux instructions
Linux comes in many different varieties called distributions (distros). Some of these distros are designed or better suited for running a server. If you are setting up a dedicated server it is recommended to use one of these distros.
Linux, in general, is more welcoming to open source programs. So where applicable it is recommended you use open source programs, such as OpenJDK.
Installing Java
OpenJDK is in most distribution's repositories. You can install it there. For Oracle Java refer to Oracle's Download Page.
Note: While not affecting minecraft server, JavaFX or other proprietary aspects of Java while need to be installed separately.
Solus
Run sudo eopkg install openjdk-8 to install OpenJDK.
For OracleJDK refer to Solus Help Center
Note: OpenJDK 11 is not in Solus' repositories.
Debian, Ubuntu, Raspbian
Note: You might need to install the package "software-properties-common" by running sudo apt-get install software-properties-common and/or "python-software-properties" by running sudo apt-get install python-software-properties to use the apt-add-repository command.
Due to licensing issues, the repository frequently used to install Oracle Java has been discontinued. It is now recommended that you install OpenJDK 8 or above.
OpenJDK can be installed with one command: sudo apt update; sudo apt-get install openjdk-8-jdk-headless
Removing the 'headless' part of the command will install all components of Java.
Note: Tested in Ubuntu 18.04.
openSUSE
Note: Due to possible instability openSuse Tumbleweed is not recommended as a dedicated server.
Just run the command from the terminal: sudo zypper in java-1_8_0-openjdk
Java should be installed.
Note: Tested in openSuse Leap 15.1
Arch Linux
Note: OpenJDK 7 - 12 are the only officially supported versions of Java.
Just run pacman -S jdk8-openjdk-headless. Remove "-headless" for the full JRE if you want to run with GUI.
If you encounter issues it is recommended that you refer to the ArchWiki
Gentoo
Run emerge --ask virtual/jdk
Other distros
Check your distro's documentation. It should have information on how to install OpenJDK.
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.
A simple installer script (also installs Java)
https://github.com/silvertriclops/MCSLI
Note: this is a very early project, designed with offline installation in mind, and will be updated periodically to make it more user friendly.
FreeBSD instructions
The official people have been using Java 8 for quite a while, so Java 7 is definitely outdated. A lot of the crashing is gone with OpenJDK8, so maybe the whole Linux-compat thing can be removed once tested.
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 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 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 cannot 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
alien-convert PATH_TO_YOUR_JRE.deb chmod ~/~ rwx # for current user snarf java -jar PATH_TO_SERVER_JAR.jar xvmf in acme
Cloudron
Cloudron is a platform to self-host apps on your server. Minecraft is available as a one click app on Cloudron. It comes with a web interface to manage Minecraft from the browser. You can also have multiple installations of Minecraft on the same server. You can try a demo here (username: cloudron password: cloudron)
Docker
Docker is a container based platform which ensures that you do not contaminate your host system. It contains preset environments you can just run.
Getting docker (for Linux, Mac & Windows)
Read https://docs.docker.com/install/
Docker image
- Download the image by running
docker pull sirplexus/minecraft-server-standalone:latest - Set up the container with port 25565 open, 1G ram assigned and named "MyServer":
docker container create --publish 25565:25565/tcp --name "MyServer" --env RAM=1G sirplexus/minecraft-server-standalone - Start the container:
docker container start MyServer
Updating Docker image
- For updating minecraft-server-standalone run
docker pull sirplexus/minecraft-server-standalone:latest
Configuring the environment
Writing a script to launch the server
It's definitely boring to have to remember the command-line options for your server every time you launch it. Luckily, we can write it down in a file and just run that instead.
On Windows
The windows version of a script is called a batch file. Create a text file in the folder where you put the jar as "start.bat", and then right click it to edit using notepad. Paste the following in:
@ECHO OFF
java -Xms1024M -Xmx2048M -jar minecraft_server.jar --nogui
pause
Double click the file to start your server. You may get a "Class_Not_Found" and ServerGuiConcole error, just ignore these errors and you should see your "Server Thread/INFO" dialog start the server.
The "pause" command is there to keep the window open so you can read what happened after the server stops.
On macOS, Linux, and FreeBSD
All these systems use a common scripting language called the "POSIX shell script" on the command line. Create a text file in the folder where you put the jar as "start.sh" and write the following in:
#!/bin/sh
cd "$(dirname "$0")"
exec java -Xms1G -Xmx1G -jar server.jar --nogui
Now save the file. Run chmod a+x start.sh (or path to wherever you put the script) to make it executable. You can now run the file by double-clicking or by running ./start.sh in the folder (or using a whole path from outside there).
If you want to add a pausing part like the Windows example, remove the exec word, and add a line of read -n 1 -p "Waiting..." to the end. This is useful if you are running the script by double-clicking on the GUI.
On Plan 9
(I don't use Plan 9, so I have absolutely no idea how to use the rc, psh, acme, snarf magic. Someone please add it.)
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:
- Minecraft Server Control Script (MSCS) is a server-management script for UNIX and Linux powered Minecraft servers. Features include:
- Run multiple Minecraft worlds.
- Start, stop, and restart single or multiple worlds.
- Create, delete, disable, and enable worlds.
- Includes support for additional server types: Forge, BungeeCord, SpigotMC, etc.
- Automatically backup worlds, remove backups older than X days, and restart worlds.
- Visit the Minecraft Server Control Script Github page for more information.
- Minecraft Server Manager A comprehensive startup script for Minecraft and Bukkit servers (support Debian, such as Ubuntu).
- MSM can also periodically create World Edit compatible backups.
- Keeps players informed with configurable in-game messages, such as "Shutting down in 10 seconds!"
- Expose in-game commands (such as "say", "op" and "whitelist") to the terminal.
- Tab completion on all commands makes learning easy.
- Visit Minecraft Server Manager's GitHub page for the full list of features.
- Server startup script
- FreeBSD startup script
- OpenBSD startup script
- Ubuntu startup script
- rfwadmin startup script with web interface (for Linux servers). Nice web interface for quickly saving and loading maps.
- Minecraft Systemd Service A fully systemd-integrated minecraft service:
- Working on CentOS and Fedora
- Protecting the server with various readonly and inaccessible jails
- Safe restart and stop operations using rcon
- Can be combined with a Minecraft Command Center Script for ease of administration
- Arch Linux systemd wrapper
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.
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". If "TCP/UDP" or "Both" isn't an option you will have to create two rules for both protocols. 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.
To find your computer's IP address, use the following steps:
Windows
- Press ⊞ Win + R; this should be up to the "Run" dialog box. Type
cmdand hit ↵ Enter. This should open a command window with a black background. From there, typeipconfigand press ↵ Enter. You should be given a list of text. Scroll up to "Wireless LAN" (if using wireless) or "Ethernet" (if using a wired connection), and look at "IPv4 address". To the right of this should be a string of numbers (of the form xxx.xxx.xxx.xxx). Copy this down by right-clicking the window and selecting "Mark", then highlight the area and hit Enter. Don't copy any parenthesis or letters.
The IP location on OS X
Mac
- 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 forinet 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 whatever 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
Now it is time to configure and connect.
Setting up a VPN
VPN's can cause issues connecting to Mojang's servers, Minecraft servers, or to the internet.
该段落的内容不代表Mojang Studios或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 who 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. A free software utility that can be used to set up a VPN ais Hamachi by LogMeIn. OpenVPN is another (free, open source) alternative that supports most OSes, but is a bit more difficult to configure. Free Radmin VPN is another software with no need to register on the website and no limits per the number of users. The free version of Hamachi allows up to 5 connections (i.e. players).
Setting up Hamachi
- Install Hamachi on each computer that wishes to participate in the server, including the host.
Windows / Mac
Linux (32-bit and 64-bit.deband.rpmpackages are available, you can install it on Gentoo by emerging "net-misc/logmein-hamachi") - The host server signs up for admin via the Logmein website.
- On the host machine, a new Hamachi network is created.
- The host installs and configures the Minecraft server software:
The server IP field in server.properties is left blank (as default). - The host passes the newly created Hamachi network credentials to each of the players.
- The players connect to the host's Hamachi network.
- 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.
- Note that Hamachi has been squatting on an IANA-allocated IP block (25.0.0.0/8). As such, Hamachi fundamentally conflicts with the internet itself.
Setting up Radmin VPN
It is very similar to Hamachi installation.
- Download free and install Radmin VPN
- Create a network: after Radmin VPN installation on the local computer press "Create network" button. Set a Network name and a Password —> Press "Create" button.
- Now the new network will appear in the main window —> invite friends, send them the info to connect -> you are welcome to run Minecraft.
- Connection: after program launch press “Join network" —> in the dialog box press enter Network name and Password received from the network administrator —> "Join" —> the new network and its nodes will be shown in the main window. —> Connect to the host in Minecraft.
- If the connection on Radmin VPN has been established, but you don`t see other players in the game, then it is required to adjust firewall for work of the game or just turn the firewall off.
Configuring the Minecraft server
- 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 Notepad. Additional configuration may not be necessary as many servers run fine from the default values.
- To become or add an operator (op), type
/op <玩家名>into the server console or gui. This adds the specified user's username and UUID to theops.jsonfile. Operator status will not be changed if you change your username due to the use of UUID.- 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).
- ops.json contents:
[
{
"uuid": "",
"name": "",
"level": 4,
"bypassesPlayerLimit": false
}
]
- If your server.properties is configured to enable whitelist, you can add a user to the
whitelist.jsonby typing/whitelist add <player>into the server console or gui. Due to the transition to the UUID system, it is not recommended to directly editwhitelist.json.
Connecting 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
localhostinstead 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 (4 for the server, 2 for the client, and some for the rest of the 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 the command prompt and looking for the IPv4 address, or by using this website. If the port is set to a number other than 25565 in server.properties, that port must be included. This address (both IP and port) will look something like
192.168.0.168:25565. - Users 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 WanIP 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).
- For troubleshooting purposes you can try running Minecraft on the server machine and connect locally. You can connect through either
localhost, your home network IP (192.168.x.x) or your public (Internet) IP. - If for some reason you have trouble with connecting publicly over your IPv4, try connecting over IPv6. This should only be done for testing whether your server is online, external players should still use IPv4.
Firewalling, NATs and external IP addresses
- You must open a TCP/UDP 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 to java.exe/javaw.exe or your Minecraft server jar file. You may just need to change /jre7/ to /jre6/ . Or search your system for java.exe/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.
Q: Whenever I try to get the server up, it says "Failed to bind to port!".
A: The most common reason this happens is because you put an IP address in the server-ip field in your server.properties file. If the IP you specify isn't the same as any of your network interfaces, (your wireless or wired IPv4 from ipconfig/ifconfig/ip a) Minecraft will throw the port binding failure message. By leaving it blank, you let it bind to all interfaces. You will then be able to connect using localhost and people on your wired/wireless network (in the same subnet) can connect using the computers/server's (private) IP address.
Alternatively, the error can mean 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/Administrator access 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: Why is the server CPU constantly at full load?
A: Some users are experiences full CPU load on the server. This may be caused by the GUI (graphic user interface) window. Run the server with the nogui option to disable this window.
Q: Help! How do you find out your server's IP address?
A: Read #Connecting to the Minecraft server
Q: I port forwarded and allowed java.exe in my firewall and it's still not working!
A: Your modem might be acting as a router as well. If you switch ISP's or upgrade your connection to the Internet, you may get issued a modem/router combination (which might explain why it worked in the past). You can verify this by looking for the WAN IP of your router. If it's a private IP, you'll need to log into the modem/router your ISP issued to you, and configure port forwarding to the WAN IP of your router.
Q: What is connection timed out and connection refused?
A: Simply put, connection timed out is when a firewall ignores a connection attempt (ignores the packet with a SYN flag in the 3-way handshake). Connection refused is when there's no process listening on the port; therefore, the operating system lets the client (in the standard client-server model) know their connection attempt did not work.
The default configuration on all Windows computers (the home version) and (just about) all (SOHO) routers is to drop or time out the connections. This is called "stealth mode" and you can read more about it on superuser. Here's a brief summary: "The idea is that refusing a connection instead of timing it out will tell an attacker that there actually is a computer on that IP-Address. With the connection attempt timing out, the hope is that the attacker will ignore the computer."
You can read more about connection refused on serverfault.
So if your error message is a connection timed out, it's usually a firewall problem - you either need to allow Java in the Windows firewall or port forward. If the error message is a connection refused, perhaps your Minecraft server has not started properly or you turned off the firewall on your router instead of port forwarding.
As always, you can always ask the Minecraft forums if you are uneasy or unsure about something, particularly if opening the command prompt/terminal and running commands makes you nervous.
Connection filtered and connection closed is another way of saying timed out and refused, respectively.
Video/Alternative Tutorials
Here are some other tutorials on how to set up a Minecraft server:
- Windows
- Mac OS X
- Linux
- Others
- Full course
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
