Minecraft (Spigot / Bukkit) server on Ubuntu
Introduction
In this tutorial you will learn how to create a Minecraft (Spigot / Bukkit) server on Ubuntu.
Installation
First we are going to update our Ubuntu operating system:
apt update && apt upgrade
When the update & upgrade command has finished your Ubuntu operating system is up-to-date.
Now we are going to install some packages that we need to run a Minecraft server:
sudo apt-get install git openjdk-8-jre-headless -y
Download the Spigot BuildTools to create the server files we need:
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
Now we are going to start the BuildTools script to create the server files. The server files (.jar) will be created in the file location you are at right now:
git config âglobal âunset core.autocrif
java -jar BuildTools.jar
The server files are now building, this will take some minutes.
Copy the server file to another directory, for example /etc/minecraftserver
mkdir /etc/minecraftserver
cp spigot.jar /etc/minecraftserver/
Now we have our Minecraft Server directory. When we run the Server file for the first time it will generate all the other files that are needed.
Lets create a start-up script!
cd /etc/minecraftserver
nano start.sh
The 'nano' command will open a text-editor, with this text-editor we can create a start-up script. Paste the following code into the text-editor:
while true; do echo "Starting server now!";
java -Xms1G -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot.jar
echo "Server restarting in 5 seconds! Press control+c to stop!"; sleep 5; done;
Do you see the -Xms1G and -Xmx1G? This means that the Minecraft Server reserves 1GB of memory/RAM to run. If your VPS has more memory/RAM available, please assign more.
Press CTRL + O and Enter to save the file Press CTRL + X and Enter to exit the file
Execute the following command:
chmod +x start.sh
Lets start the Minecraft Server for the first time!
./start.sh
The Minecraft Server won't start probably, this is because we have not accepted the EULA yet. Edit the EULA file and set false to true.
nano eula.txt
Press CTRL + O and Enter to save the file Press CTRL + X and Enter to exit the file
Start the Minecraft Server again:
./start.sh
Your Minecraft Server is now generating the map and configuration files. When it is done you can connect to your Minecraft Server with the game!
If you want to stop the Minecraft Server, execute the following command:
stop
We want to run the Minecraft Server in the background so we can close the SSH connection. If we do not do this, the Minecraft Server will stop working when we close the SSH connection.
To start the Minecraft Server in the background, execute the following command:
screen ./start.sh
You can now close the SSH connection to your VPS, and the Minecraft Server will continue running. If you start a new SSH connection to your VPS, execute the following command to open the running Minecraft Server:
screen -r
comments (1)
joe
- 2 years agocouldn't figure out how to create a directory, so it's useless for me