Updating Minecraft Server
Update the Minecraft Server to the latest version.
Master the Process of Safely Upgrading Your Minecraft Server on Ubuntu 21.04 without Data Loss or World File Overwrites. Manual Updates Required for New Minecraft Versions Released by Mojang.
Create backups and download the new version
Before proceeding with the server update to the latest version, let’s take precautions by creating a backup. Navigate to the Minecraft root directory.
cd minecraft/
Create a backup of your world file.
sudo cp -r world world-backup
Following that, it’s crucial to generate a backup of your current working server.jar file.
sudo cp server.jar server.jar-backup
Now, visit the Minecraft server download page[1] and copy the URL for acquiring the latest Minecraft version. Download the version using the following command.
sudo wget [URL]
As an illustration, we will utilize version 1.18.1.
sudo wget https://launcher.mojang.com/v1/objects/125e5adf40c659fd3bce3e66e67a16bb49ecc1b9/server.jar
Stop the Minecraft server and upgrade
To conclude the session, enter stop while in the Minecraft server console. If employing a screen session, you can reattach to the screen using the following command.
screen -r
Similarly, for the screen session, input stop or utilize CTRL + C to conclude the session.
Now, proceed to replace the old server.jar file with the new one using the following command.
sudo mv server.jar1 server.jar
You can now start the server again.