Tips for running a Minecraft server — plugins, admins, automatic restarts
This is the next step after opening a server with Creating a Minecraft server (Java Edition, Paper and vanilla). It covers installing plugins, setting up admins and a whitelist, starting again automatically when it stops, and automatic backups.
1. Create a start script
Create a start file so you don't have to type the long command every time. If the server stops (including crashes), it starts again automatically after 10 seconds.
cd ~/minecraft
nano start.sh
#!/bin/bash
cd ~/minecraft
while true; do
java -Xms1G -Xmx3G -jar server.jar nogui
echo "Server stopped. Restarting in 10 seconds. (To stop it completely, press Ctrl + C)"
sleep 10
done
chmod +x start.sh
screen -S mc ./start.sh
Set the -Xmx value leaving 1–2GB of the server's memory free. (4GB server → 3G, 8GB server → 6G)
2. Admins (OP) and the whitelist
Enter these in the server console (screen -r mc).
op yourname
whitelist add friendname
whitelist on
whitelist list
op yourname— Give admin privilegeswhitelist add friendname— Add to the whitelistwhitelist on— Only players on the whitelist can joinwhitelist list— Show the list
The server console reads the explanation after # as part of the command, so enter only the commands.
For a friends-only server that isn't open to the public, we strongly recommend turning on the whitelist. It keeps strangers from coming in and wrecking your world.
3. Commonly changed settings (server.properties)
With the server stopped, open it with nano server.properties, edit it, and start the server again.
| Setting | Description |
|---|---|
motd | The description shown in the server list |
max-players | Maximum number of players |
difficulty | Difficulty (peaceful, easy, normal, hard) |
gamemode | Default game mode (survival, creative) |
view-distance | View distance. Lowering it reduces lag (8–10 recommended) |
online-mode | Keeping it true is recommended. If you turn off account verification, others can join under your nickname |
4. Install plugins (Paper server)
Plugins don't work on a vanilla server. Switch to a Paper server.jar from papermc.io before using them. (You can keep using your existing world folder.)
- On a plugin site like Modrinth, Hangar or SpigotMC, copy the download link for the
.jarfile that matches your server version. - Download it into the
pluginsfolder.
cd ~/minecraft/plugins
wget "copied download link"
- Restart the server to apply it. Type
pluginsin the console to see the installed plugins listed in green.
Don't install plugins from unknown sources. They can put your whole server at risk.
5. Automatic world backups
Schedule the world to be compressed every day at 5 a.m., with backups older than 7 days deleted. (How to use cron) If you just copy the world while the server is running, files that are being saved get mixed in and the backup can break, so automatic saving is paused only while the backup runs. This method is for when you started the server with screen -S mc as in step 1.
mkdir -p ~/mc-backups
nano ~/mc-backup.sh
#!/bin/bash
# Send commands to the server console (the mc window in screen): pause automatic saving → save everything so far
screen -S mc -p 0 -X stuff "save-off$(printf '\r')"
screen -S mc -p 0 -X stuff "save-all flush$(printf '\r')"
sleep 30
tar -czf ~/mc-backups/world-$(date +%F).tar.gz -C ~/minecraft world
# Turn automatic saving back on
screen -S mc -p 0 -X stuff "save-on$(printf '\r')"
chmod +x ~/mc-backup.sh
crontab -e
0 5 * * * ~/mc-backup.sh >> ~/mc-backups/backup.log 2>&1
30 5 * * * find ~/mc-backups -name "*.tar.gz" -mtime +7 -delete
Backups that exist only on the server disappear along with it if the server goes away. Download them to your PC from time to time. On a Paper server, the Nether and the End are saved separately in the
world_netherandworld_the_endfolders, so addworld_nether world_the_endafterworldin the script.
6. Reducing lag
- Use a Paper server. It's much lighter than vanilla.
- Lower
view-distanceto 8–10. - If it's very laggy when people first join, it's because the map is still being generated. Generating the map in advance with a plugin like Chunky reduces this.
- If memory keeps running short, increase
-Xmxor consider moving to a plan with more memory. - To check whether the server itself is slow, see Checking a slow server.