How to Set Up a Minecraft Server

Published: 13 November 2024

A screenshot of Minecraft gameplay

Getting Started

Prerequisites

The Minecraft Server executable requires the Java Runtime Environment to be installed on your computer. If you do not have Java installed, or think you may have an outdated version, you can download the latest version here.

Setting up the server files

Firstly, you will need the server files.

  1. Go to the Minecraft Server Download page and download the minecraft_server.<version>.jar file.
  2. Create a new folder with a memorable name and move the minecraft_server.<version>.jar file into your new folder.
  3. Open the minecraft_server.<version>.jar file with Java by double-clicking on it.

You should now see some new files appear in your server directory.

In the server directory there is a subdirectory titled logs, and eula.txt, server.jar, and server.properties files

Server Configuration

To host a Minecraft Server, you must agree to the End User License Agreement (EULA).

  1. Inside your server directory, you should be able to see a eula.txt file. Double-click on this file to open it.
  2. Read the contents of the file. Most importantly, read the Minecraft EULA.
  3. Only if you agree to the EULA, change eula=false to eula=true.
    • (If you don’t want to agree to the EULA, stop here and check out Lunati or Vintage Story instead!)
  4. Save and close the eula.txt file.

Gathering Device Information

You’re going to need to gather unique details about your device and network configuration. This guide will help you find the IPv4 address and MAC Address of your Server Computer, and the Default Gateway address of your router.

Finding the local IPv4 Address of the Server Computer

Each device in your home network has its own local IP (Internet Protocol) address. We need to find the IP address of the device that is hosting the Minecraft server.

Windows Instructions

  1. Open the command prompt by holding down the Windows key and pressing R to bring up the Run dialog.
  2. Type cmd into the Run dialog and hit Enter.
  3. In the command prompt, type in ipconfig and hit Enter.
  4. Look for the line starting with IPv4 Address to find your IPv4 address. Make a note of this, as you will need it later.

macOS Instructions

  1. Open the Terminal application from the Launchpad on macOS.
  2. In your terminal, type in ipconfig getifaddr en0 and hit Enter.
  3. Your device’s IP address should be printed in the output. Make a note of this, as you will need it later.

Finding the Physical (MAC) Address of the Server Computer

Each device has its own Media Access Control (MAC) address. You’ll need your device’s MAC Address to set a Static DHCP Lease.

Windows Instructions

  1. Open the command prompt by holding down the Windows key and pressing R.
  2. Type cmd into the Run dialog and hit Enter.
  3. In the command prompt, type in ipconfig and hit Enter.
  4. Look for the line starting with Physical Address to find your MAC address. Make a note of this.

macOS Instructions

  1. Open the Terminal application.
  2. In your terminal, type in networksetup -listallhardwareports and hit Enter.
  3. If connected via Wi-Fi, find the MAC Address below the line Hardware Port: Wi-Fi.
    • The address after Ethernet Address: is your MAC Address.
  4. If connected via Ethernet, find the MAC Address below Hardware Port: Ethernet.

Finding the Default Gateway address

Windows Instructions

  1. Open the command prompt by holding down the Windows key and pressing R.
  2. Type cmd into the Run dialog and hit Enter.
  3. In the command prompt, type in ipconfig and hit Enter.
  4. Look for the line starting with Default Gateway to find your Default Gateway address.

macOS Instructions

  1. Open the Terminal application.
  2. In your terminal, type in netstat -nr | grep default and hit Enter.
  3. Your default gateway address should be at the top of the output.

Router Configuration

Most household routers have a web interface you can access via the Default Gateway Address.

Accessing the Router Administration panel

  1. Open a web browser and enter the Default Gateway address.
  2. If requested, default login credentials are usually admin for the username and either password or admin for the password.

Setting a Static DHCP lease for the Server Computer

To ensure the Server Computer’s IP address doesn’t change:

  1. Find the DHCP menu in the router configuration panel.
  2. Add a Static Lease for your Server Computer:
    • Set the Host Name to a short name for your device (e.g. home-pc, server-pc, or kyles-laptop).
    • Set the MAC Address to the Physical Address of the Server Computer.
    • Set the IP address to the IPv4 address of the Server Computer.

Port Forwarding

To allow external connections to your Minecraft Server:

  1. Find the Port Forwarding menu.
  2. Create a new Port Forwarding rule with these settings:
    • Set the configuration name to Minecraft.
    • Set the WAN and LAN port to 25565.
    • Set the protocol to both UDP and TCP.
    • Set the destination IP address to the IPv4 address of the Server Computer.

Remember to save the changes.

Configuring the Server Properties

  1. Open server.properties in the server directory with a text editor.
  2. Edit settings to suit your needs:
    • server-ip= should equal your server computer’s IPv4 address.
    • Set op-permission-level=3 if you don’t want operators to stop the server.
    • Set white-list=true to configure a list of approved players.
    • Change pvp=true to pvp=false if you want to disable player-versus-player combat.
    • Switch gamemode=survival to gamemode=creative for Creative mode.
    • Set difficulty=easy to your preferred difficulty level.
    • Change allow-flight=false to allow-flight=true if you don’t want players kicked for false positives.

For more details on the server.properties file, refer to the Minecraft Wiki Page.

Launching the Server

Basic Launch

  1. Right-click the server.jar file.
  2. Select Open With… and choose Java Runtime Environment.

Launching the server with a script

Windows Instructions

  1. Right-click in your server folder and create a new text document.
  2. Rename the New Text Document.txt to server.bat.
  3. Edit server.bat to include the following:
@echo off
java -Xms2G -Xmx4G -jar server.jar nogui
PAUSE

Connecting to the Server

Once your server is up and running, players can connect to it using the IP address and port. Here are the steps to connect:

Connecting from the Same Network

  1. Open Minecraft on the device you want to play on.
  2. Go to the multiplayer section and select “Direct Connect.”
  3. Enter the local IPv4 address of your server computer followed by :25565 (e.g., 192.168.1.100:25565).
  4. Click “Join Server” to connect.

Connecting from an External Network

For others to join from outside your network, you’ll need to give them your public IP address.

  1. Search “What’s my IP” in your web browser to find your public IP.
  2. Share this IP address followed by :25565 (e.g., 203.0.113.45:25565) with anyone who wants to join.

Note: It’s generally safer to limit sharing your IP address only with people you trust. Setting up a whitelist in the server.properties file can also help control who can join.


Troubleshooting Common Issues

“Server is outdated” Error

If you or your players see an error about the server being outdated, it’s likely due to using a newer version of Minecraft than your server supports. To resolve this:

  1. Update the server .jar file to the latest version from the Minecraft Server Download page.
  2. Make sure that players are using the same Minecraft version as the server.

“Cannot connect to server” or “Timed out” Errors

This issue is often due to misconfigured network settings:

  • Double-check that the server’s IPv4 address hasn’t changed if you’re on a dynamic IP.
  • Verify that the port forwarding settings on your router are still set correctly.
  • Ensure any firewall on the server computer allows traffic on port 25565.

Performance Issues

If players experience lag or slow gameplay:

  • Consider increasing the server’s RAM allocation in the server.bat script by adjusting the -Xms and -Xmx options.
  • Reduce view distance and player slots in server.properties.
  • Ensure that your server computer meets Minecraft’s minimum hardware requirements.

Additional Resources

For more detailed instructions and support, check out:

By following these steps, you should have a fully operational Minecraft server that you and your friends can connect to and enjoy. Good luck, and have fun building!