This script automates the setup of a Minecraft Spigot server on a Linux machine. It ensures that all necessary dependencies are installed, checks Java version, downloads and builds the specified Spigot version, and configures the server properties based on user input.
- Automatically installs required dependencies including
sudo
,git
,wget
,screen
, and Zulu Java 21 if not present. - Prompts the user to enter the Spigot version, game mode, difficulty, and MOTD.
- Downloads and builds the specified Spigot version using BuildTools.
- Automatically accepts the EULA.
- Configures
server.properties
based on user input. - Runs the Minecraft server in a
screen
session to ensure it continues running after SSH disconnection.
- A Linux-based server with root (or sudo) access.
-
Download the script:
wget https://raw.githubusercontent.com/Fkstone/One-click-Spigot/main/setup_minecraft_server.sh
-
Make the script executable:
chmod +x setup_minecraft_server.sh
-
Run the script:
./setup_minecraft_server.sh
-
Follow the prompts to configure your server:
The script will ask you to enter:
- The Spigot version you want to install (default:
1.20.1
) - The game mode (default:
survival
) - The difficulty (default:
normal
) - The MOTD (default:
A Minecraft Server
)
- The Spigot version you want to install (default:
Here is an example of running the script:
./setup_minecraft_server.sh
You will see prompts like:
Enter the Spigot version you want to install [1.20.1]: 1.20.1
Enter the game mode (survival/creative/adventure/spectator) [survival]: survival
Enter the difficulty (peaceful/easy/normal/hard) [normal]: normal
Enter the MOTD for your server [A Minecraft Server]: My Awesome Server
After answering the prompts, the script will proceed to:
- Install dependencies.
- Download and build the specified Spigot version.
- Configure the server.
- Start the server in a
screen
session.
After the script completes, your Minecraft server will be running and accessible at:
<your-server-ip>:25565
Replace <your-server-ip>
with the actual IP address of your server.
To find the screen
session running your Minecraft server, you can list all screen
sessions with:
screen -ls
You should see a session named minecraft_server
. To reattach to this session, use:
screen -r minecraft_server
To stop the Minecraft server gracefully, reattach to the screen
session and then run:
stop
To detach from the screen
session without stopping the server, press Ctrl + A
followed by D
.
If you need to restart the server (for example, after installing plugins):
-
Stop the server gracefully by reattaching to the
screen
session and runningstop
. -
Detach from the
screen
session. -
Start the server again in a new
screen
session:screen -dmS minecraft_server java -jar /path/to/spigot.jar nogui
Replace
/path/to/spigot.jar
with the actual path to yourspigot.jar
file, typically located in theminecraft_server
directory.
- Ensure you have adequate permissions to install software and run scripts on your server.
- The script will automatically attach to the
screen
session running the Minecraft server. To detach from the session, pressCtrl + A
followed byD
. To reattach, usescreen -r minecraft_server
.
This project is licensed under the MIT License.
Contributions are welcome! Please open an issue or submit a pull request.
- SpigotMC for providing the Spigot server software.
- Azul Systems for providing Zulu Java distributions.