NOTE: These instructions are for installing a basic vanilla Minecraft server without any add-ons or plugins.
Install the Ubuntu OS as usual.
apt update apt upgrade
apt install tmux wget git most htop
apt install openjdk-16-jdk
adduser minecraft --disabled-login --disabled-password
NOTE: It is best to have a separate user account to avoid possible security vulnerabilities on the system.
su - minecraft
mkdir ~/server && cd ~/server
Visit the official Minecraft site, https://minecraft.net/download/server, and right-click on the Download link and copy the Link Location from the context menu.
wget download_link
NOTE: download_link is the link from the previous step.
echo "eula=true" > eula.txt
NOTE: This creates a file named eula.txt.
tmux -s new minecraft java -jar server.jar
NOTE: Tmux is being used to allow detaching of the session.
NOTE: Some people suggest the server runs quicker using
java -jar server.jar --nogui
For add-ons, mods and to personalize the Minecraft experience consult this official documentation: https://help.mojang.com/.
Download the Minecraft client from the official Minecraft website.
Install and launch the client and sign in.
Create /etc/systemd/system/minecraft.service.
[Unit] Description=Minecraft server Documentation= Wants=network.target After=network.target [Service] WorkingDirectory=/home/minecraft/server User=minecraft Group=minecraft Type=forking # Run it as a non-root user in a specific directory ExecStart=/usr/bin/tmux -s new minecraft "java -jar server.jar" # Send "stop" to the Minecraft server console ExecStop=/usr/bin/tmux kill-session -t minecraft # Wait for the PID to die - otherwise it is killed after this command finishes! ExecStop=/bin/bash -c "while ps -p $MAINPID > /dev/null; do /bin/sleep 1; done" # Note that absolute paths for all executables are required! [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl start minecraft
https://www.minecraft.net/en-us/download/server
https://teilgedanken.de/Blog/post/setting-up-a-minecraft-server-using-systemd/
https://minecraft.fandom.com/wiki/Tutorials/Setting_up_a_server
https://minecraft.fandom.com/wiki/Tutorials/Setting_up_a_server#Configuring_the_environment
http://techtips-tom.blogspot.com/2013/01/mineos-turnkey-on-proxmox-vm-server.html