This is the minecraft server for me and my friends which I host manually because I don't like the startup times of the free solutions and also don't want to pay anyone
MIT License
Welcome to the Minecraft Server Setup repository! This guide will help you set up a Minecraft: Java Edition multiplayer server on your machine. Follow the instructions below to get started.
Before you begin, ensure you have the following:
PATH
environment variable.Download the Minecraft server file from the official website or use the link below:
Alternatively, you can use PaperMC for better performance and additional features:
Create a new directory for your Minecraft server files.
mkdir MinecraftServer
cd MinecraftServer
Move the downloaded minecraft_server.1.21.jar
or paper-1.21-99.jar
file into this directory.
Accept the Minecraft End User License Agreement (EULA).
eula.txt
.eula=true
Run the server with the following command:
For the official Minecraft server:
java -Xmx1024M -Xms1024M -jar minecraft_server.1.21.jar nogui
For PaperMC:
java -Xmx1024M -Xms1024M -jar paper-1.21-99.jar nogui
If you want to start the server with its graphical user interface (GUI), you can leave out the nogui
part:
java -Xmx1024M -Xms1024M -jar minecraft_server.1.21.jar
java -Xmx1024M -Xms1024M -jar paper-1.21-99.jar
The server will start up and generate the necessary files and folders in the directory.
For Windows users, you can use the provided start.bat
script to start the server with the appropriate memory settings (Provided in the repository).
If you wish to run the server with more memory, you can adjust the -Xmx
and -Xms
values in the command above. For example, to allocate 2GB of memory, you can use:
java -Xmx2048M -Xms2048M -jar minecraft_server.1.21.jar nogui
or
java -Xmx2048M -Xms2048M -jar paper-1.21-99.jar nogui
The -Xmx
flag sets the maximum memory allocation pool for the Java Virtual Machine (JVM).
The -Xms
flag sets the initial memory allocation pool for the JVM.
2048M
can be replaced with the desired amount of memory in megabytes or 2G
for gigabytes.
Note: Make sure you have enough memory available on your system to allocate to the server.
Note: The server will take some time to start up, especially the first time you run it.
Note: If you encounter any errors, make sure you have Java installed and configured correctly.
Note: If you are running the server on a remote machine, you can use tools like screen
or tmux
to keep the server running in the background.
Once the server is running, you can connect to it using the IP address localhost
and join the server.
To simplify the process of starting the server, you can create a script that automates the steps mentioned above. Below are examples of scripts for Linux, macOS, and Windows that you can use to start the server:
server-start-linux.sh
)./server-start-linux.sh
server-start-macos.sh
)./server-start-macos.sh
start_server.sh
)#!/bin/bash
# Navigate to the server directory
cd "$(dirname "$0")"
# Check if eula.txt exists
if [ ! -f eula.txt ]; then
echo "eula=true" > eula.txt
fi
# Start the server
java -Xmx1024M -Xms1024M -jar minecraft_server.1.21.jar nogui
# Get the server IP address
SERVER_IP=$(hostname -I | awk '{print $1}')
echo "Minecraft server is running at IP: $SERVER_IP"
start_server.bat
) - to run just double click on the file@echo off
:: Navigate to the server directory
cd /d %~dp0
:: Check if eula.txt exists
if not exist eula.txt (
echo eula=true > eula.txt
)
:: Start the server
java -Xmx1024M -Xms1024M -jar minecraft_server.1.21.jar nogui
:: Get the server IP address
for /f "tokens=2 delims=[]" %%A in ('ping -4 -n 1 %COMPUTERNAME% ^| findstr /r /c:"\[[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\]"') do set SERVER_IP=%%A
echo Minecraft server is running at IP: %SERVER_IP%
pause
If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
Happy crafting!
Feel free to reach out if you have any questions or need further assistance.