in

How to Make a Minecraft Server (Java Edition) on Windows or Ubuntu

default image
Let‘s you and I create a Minecraft server up and running in minutes for you to enjoy with close buddies. Minecraft is a creator‘s paradise or a strange-looking blockified world annoying you to the core each time you step in. Either way, gamers around the globe find it irresistible and play Minecraft in big numbers, making it the [best-selling video game of all time](https://en.wikipedia.org/wiki/List_of_best-selling_video_games) with over 238 million copies sold as of 2022.

While you can play Minecraft solo, the experience goes bland after you end up spending hours inside mining and crafting with no one to share it with. Ergo, you have the multiplayer option to keep the fun alive. Now you can either join the big-name servers and play along with hundreds if not thousands of players. Or you can make your own Minecraft server to have fun with your dear ones.

It‘s important to know this guide will show you how to create a Minecraft server on your personal PC. So you shouldn‘t host players you don‘t trust, as you‘ll reveal your public IP address.

And please remember, we‘ll be hosting Minecraft Java edition, which works on Windows, macOS, and Linux. Now that you know enough, let‘s start with the real deal.

How to Make a Minecraft Server

Most likely, you would be using your own Windows or Ubuntu desktop PC for this. However, you can also opt for Minecraft Server Hosting for additional support and professional gameplay for a large number of players. But, we‘ll stick with the assumption that you‘re using a personal computer.

And since we are installing Minecraft Java edition, we need to first install or update Java.

Installing Java

According to Oracle, over 3 billion devices run Java. It powers everything from Blu-ray players to medical devices to stock exchanges. Java 18 is the latest version as of 2022.

Installing Java on Windows 10 or 11 is fairly simple. Visit this Java download page, and grab the latest Java 18 version. Just make sure to pick the correct Windows installer (32-bit or 64-bit) for your system.

For Ubuntu 20.04 or 22.04, open the terminal and enter:

sudo apt update
sudo apt install openjdk-18-jre

and press enter. This will install open source OpenJDK 18, which is essentially Oracle‘s Java under a different license.

If you are planning to run Minecraft on a headless 3rd-party cloud server like DigitalOcean, install Java with this command instead:

sudo apt install openjdk-18-jre-headless

This signifies you‘ll run Minecraft without a graphical user interface, saving memory and compute resources.

Subsequently, download the official Minecraft Server JAR file to get a single file named server.jar. There aren‘t separate server files for Windows vs Linux.

After downloading to your machine, it‘s best to create a dedicated folder for the server since it will generate additional files that you‘ll want kept tidy.

Next, you can choose to run the Minecraft server with or without a graphical user interface (GUI). While having a GUI is convenient, you can conserve some system resources by going the command line route instead. Let‘s explore both options.

Minecraft Server with GUI

Using the Minecraft server with a GUI is nearly identical on Windows 10/11 and Ubuntu 20.04/22.04.

Windows GUI

Simply run the server.jar file by double clicking it in File Explorer. This won‘t open anything visible, but rather creates a handful of new files in the folder including eula.txt.

Open this end user license agreement text file in Notepad, change eula=false to eula=true, and save your change. This indicates agreement with Mojang‘s terms and conditions. Without this, the server will shut down immediately when launched.

Now double-click server.jar again to launch the graphical server interface. It will take a few moments to load all the necessary libraries and files. When you see Done in the bottom right corner, the Minecraft server is fully initialized and ready for connections.

Ubuntu GUI

In the terminal, use the cd command to navigate into the folder containing server.jar. Alternatively, you can right-click the folder in the file manager and select Open in Terminal.

Now run:

java -Xmx1024M -Xms1024M -jar server.jar

and press enter to launch the server.

The -Xmx and -Xms flags configure the maximum and minimum memory usage respectively. Start with 1024M (1GB) as a baseline, but increase if you encounter crashes or lag with multiple players. Some admins use up to 8-16GB for large servers.

You‘ll be prompted to agree to the EULA. Edit eula.txt in the same manner as Windows and re-run the java command. This time, the graphical interface will pop up indicating the server is starting.

On first launch, you may see errors like Failed to load module "canberra-gtk-module". This can be fixed by installing the missing libraries:

sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

Now when restarting the server, these errors should disappear.

While the GUI is handy, having to use the terminal each time is inconvenient. Let‘s make a script to launch the server with one click.

Create a file like start.sh in the server folder using Nano or your preferred text editor. Paste the java command into this file and save it.

Finally, right click the script, open Properties, go to Permissions and enable Allow executing file as program. Now double click start.sh to launch your Minecraft server!

Minecraft Server Without GUI

Operating headlessly via the command line is less beginner-friendly, but allows administrators more control and uses fewer system resources.

Windows Batch

Instead of running server.jar directly, we‘ll make a .bat script to launch the server.

In the server folder, create a new file like start.bat. Open it in Notepad and enter:

java -Xmx1024M -Xms1024M -jar server.jar nogui

-nogui prevents the graphical interface from loading.

Double click start.bat to initialize the server for the first time. This generates all necessary files and closes the window immediately after.

You‘ll need to edit eula.txt to true like before. Now re-running the batch file prints the server log and leaves the window open:

The Done message means the server is fully operational for connections.

Ubuntu Headless

Similar to the Windows batch script, we can automate launching the headless Ubuntu Minecraft server using a bash script.

Open (or create) start.sh and enter:

java -Xmx1024M -Xms1024M -jar server.jar nogui

Allow executing start.sh as a program, then launch it. The server will boot up and display log messages:

You can type help for a list of text-based server controls and commands.

That covers setting up a Minecraft server! Next let‘s look at hosting players locally and across the internet.

Hosting LAN and Online Multiplayer

A properly configured Minecraft server can host players both on your local network and across the internet.

Hosting Local LAN Games

For players on the same LAN (wifi/ethernet), they just need your server computer‘s internal network IP address to connect.

On Windows, open command prompt and type ipconfig to find your IPv4 address:

On Ubuntu, use hostname -I in terminal:

Share this IP with friends on the same network. They can enter it into Multiplayer -> Add Server in the Minecraft client to join your game.

Hosting Online via Port Forwarding

To host players across the internet, you‘ll need to handle networking configuration like port forwarding.

According to OrbisMesh, over 65% of home networks connect to the internet via some form of NAT (Network Address Translation). This includes mobile hotspots and networks behind consumer routers.

NAT hides your home network behind a single public IP address, blocking unsolicited inbound connections. Therefore, hosting a globally accessible server requires specifically enabling access to certain ports.

The default port for Minecraft is 25565 TCP and UDP. First, configure your firewall software (Windows Firewall or Linux UFW) to allow connections on this port:

  • Windows: Open firewall settings and create new Inbound and Outbound 25565 rules
  • Ubuntu: Run sudo ufw allow 25565

Next, you need to forward port 25565 on your router to your server computer‘s internal IP. Router port forwarding steps vary widely by model and brand. Simply search "[your router name] port forwarding" for specific instructions.

Once port forwarding is configured, have your friends add your router‘s public IP address to their Minecraft clients to connect (not your internal IP). Public IP services like whatismyip.com reveal this address.

And that‘s it! With the server up and running, port forwarding enabled, and your public IP shared, your Minecraft server can now host players across the internet.

Optional: Assigning a Domain Name

Sharing an IP address works but isn‘t very user friendly. An easier option is purchasing a domain name and pointing it your public IP via a DNS A record.

Domains can be purchased for ~$12 USD annually from registrars like Namecheap and assigned in their control panel or DNS provider.

Now players can simply enter your memorable domain like yourmcserver.com into Minecraft‘s multiplayer menu. Much cleaner than an IP!

Closing Thoughts

In summary, we walked through getting a Minecraft Java server up and running from scratch on both Windows 10/11 and Ubuntu desktop. This included:

  • Installing prerequisites like Java and basic server setup
  • Launching with or without a GUI
  • Scripting for quick headless startup
  • Enabling local multiplayer by sharing internal IPs
  • Hosting global online play via port forwarding
  • Using a custom domain for easier connections

While possible to host gameplay on a desktop PC, limited resources can impact performance. For larger servers, consider migrating to a hosted VPS or dedicated Minecraft server hosting plan that provides guaranteed uptime, DDoS protection, and faster performance for 10-100+ concurrent players.

I hope this guide served as a good Minecraft server primer! Let me know if you have any other questions.

Written by