How to install and setup a Minecraft Server

Published on January 01, 2023

How to set up Minecraft Server

This is a tutorial on how to install Minecraft Server 1.19.3 in your computer. You can read more about Minecraft 1.19.3 here.

What is a Minecraft Server?

A Minecraft server is a game server that allows players to connect to it, with you controlling the setup. You can start your own multiplayer Minecraft server using a computer that is not being used.

With your own Minecraft server, you can invite certain friends and family members to connect to it so you can play together. You can also do various things like set up your own rules, assign roles to the players, control spawn rates and environment (landscapes) and a lot more.

Requirements

You will need a computer running MacOS, Linux or Windows. A minimum of 4GB RAM is preferred. A Raspberry Pi v3 or v4 may crawl with two or more players.

If you want to your friends outside your network to have access to your new Minecraft server, you will have to do port forwarding on your router after installation is completed. So you will need to have access to the router administration account.

Alternative to server installation: Minecraft Hosting Services

If you don't want to dedicate a computer for all that, you can use a hosting provider with a server running and maintained on dedicated machines. Hypixel is an example of a server hosted by a provider. There are many hosting plans available.

Download Minecraft Server

There are many Minecraft servers. The most popular ones are Bukkit, CraftBukkit and Spigot. We will download and install Spigot.

The latest Minecraft server is version 1.19.3.

The first step is to download BuildTools.jar and build our own server.

Download BuildTools.jar

Download BuildTools.jar from this webpage.

This is the direct URL to Spigot Minecraft server.

We will build it in the next step. But first, we have to install the pre-requisites, which are Java and git, if you don't have them already installed.

Install Java JDK 17 or greater

You can download and install OpenJDK 17 from here or higher.

I installed OpenJDK 19 on my MacBook.

After installing, configure JAVA_HOME to point to your version of OpenJDK. Verify the installation.

$ java -version
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment Homebrew (build 19.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 19.0.1, mixed mode, sharing)

Install Git

You can download and install Git from here if you are on MacOS or from here if on Windows.

$ git -v
git version 2.38.1

Build Minecraft Server

Run this command:

java -jar BuildTools.jar --rev 1.19.3

This is a portion of the output:

$ java -jar BuildTools.jar --rev 1.19.3
Loading BuildTools version: git-BuildTools-2f33f39-152 (#152)
Java Version: Java 19
Current Path: /Users/arul/Downloads/tmp/.
git version 2.38.1
...
Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment Homebrew (build 19.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 19.0.1, mixed mode, sharing)
Attempting to build version: '1.19.3' use --rev <version> to override
Found version
{
    "name": "3635",
    "description": "Jenkins build 3635",
    "refs": {
        "BuildData": "177811e1fa90f674897a302820f3ed84e4d65688",
        "Bukkit": "d352d96500fbd215d06f4561f374faabb1c0b1fd",
        "CraftBukkit": "941d7e954fb0864bc3e33110530a23de886eb8aa",
        "Spigot": "d90018e043c1bdf8dd894701e61927c4f1a8b064"
    },
    "toolsVersion": 148,
    "javaVersions": [61, 63]
}

Starting clone of https://hub.spigotmc.org/stash/scm/spigot/bukkit.git to Bukkit
Cloned git repository https://hub.spigotmc.org/stash/scm/spigot/bukkit.git to ...
...
Starting clone of https://hub.spigotmc.org/stash/scm/spigot/spigot.git to Spigot
...
Starting download of https://static.spigotmc.org/maven/apache-maven-3.6.0-bin.zip
Downloaded file: apache-maven-3.6.0-bin.zip with hash: 7d14ab2b713880538974aa361b987231473fbbed20e83586d542c691ace1139026f232bd46fdcce5e8887f528ab1c3fbfc1b2adec90518b6941235952d3868e9
Extracted: ./apache-maven-3.6.0/README.txt
Extracted: ./apache-maven-3.6.0/lib/org.eclipse.sisu.plexus.license
Extracted: ./apache-maven-3.6.0/lib/jansi-native/windows32/jansi.dll
Extracted: ./apache-maven-3.6.0/bin/mvnDebug.cmd
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Spigot-API 1.19.3-R0.1-SNAPSHOT .................... SUCCESS [  8.549 s]
[INFO] Spigot-Parent dev-SNAPSHOT ......................... SUCCESS [  0.013 s]
[INFO] Spigot 1.19.3-R0.1-SNAPSHOT ........................ SUCCESS [ 38.625 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  47.288 s
[INFO] Finished at: 2023-01-03T14:19:03-05:00
[INFO] ------------------------------------------------------------------------
...
Success! Everything completed successfully. Copying final .jar files now.
Copying spigot-1.19.3-R0.1-SNAPSHOT-bootstrap.jar to /Users/arul/Downloads/tmp/./spigot-1.19.3.jar
  - Saved as ./spigot-1.19.3.jar

You end up with a file called spigot-1.19.3.jar. This is is our Minecraft server.

Edit eula.txt and change the value of eula from false to true:

eula=true

Save and quit the editor.

If you forget to change eula=false to eula=true, you will see this error:

[14:24:22] [ServerMain/INFO]: Building unoptimized datafixer
[14:24:23] [ServerMain/ERROR]: Failed to load properties from file: server.properties
[14:24:23] [ServerMain/WARN]: Failed to load eula.txt
[14:24:23] [ServerMain/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.

Run the server with this command:

java -Xmx1024M -Xms1024M -jar spigot-1.19.3.jar

It will take a few minutes to start your new Minecraft server.

You may need root access to allow the firewall to open by the Minecraft server.

Minecraft server running

Configuring your new Minecraft Server

Most of the configuration is stored in the file server.properties. You may edit it to have more control over your server.

The default port on which your Minecraft server runs is 25565. This can be changed in server.properties.

Connecting to the Minecraft Server

To connect to your new Minecraft server from within the local network, first find the IP address of the Minecraft server.

Run this command on the computer running the Minecraft server.

ifconfig

You will get a local IP address starting with 192. or 10.. Mine is

$ ifconfig|grep 192
    inet 192.168.1.190 netmask 0xffffff00 broadcast 192.168.1.255

My local IP address is 192.168.1.190.

On another computer running Minecraft, go to the Multiplayer option. Choose Multiplayer → Add Server. Enter the IP address and allow it to connect.

Optional: Install Python plugin

If you want to run Python programs against your new Minecraft server, continue to read through this section.

Download the Python plugin from this webpage. After it downloads, copy it to the plugins directory

Python program to spawn 100 sheep

We will first write code to find the user's location. Next, we will write code to spawn 100 sheep.

Save this file in any directory as spawnsheep.py

from mcpi.minecraft import Minecraft
import mcpi.block as block
from mcpi.entity import ZOMBIE_VILLAGER, SHEEP

mc = Minecraft.create()
playerid = mc.getPlayerEntityIds()[0]

x, y, z = mc.entity.getPos(playerid)

mc.postToChat('')
mc.postToChat('Spawning 100 sheep 🐐')
for i in range(100):
    mc.spawnEntity(x+i+2, y+3, z+1, SHEEP)

Then, run spawnsheep.py.

python spawnsheep.py

When you run it, you will see a hundred sheep being created in your Minecraft world.

More Python code in Minecraft

If you are interested in using Python code in Minecraft, please stay tuned. We will add more blog posts. If you would like anything specific, feel free to contact us.

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Published on January 01, 2023