Installing a Spigot Minecraft Server on Ubuntu 20.04 can be a great way to host your own server and play with friends or just have a private world to build in. This tutorial will guide you through the steps of installing and configuring a Spigot server on Ubuntu 20.04.
Before getting started, make sure you have a clean installation of Ubuntu 20.04 and that you are logged in as a user with sudo privileges. You will also need to have Java installed on your system.
To check if Java is installed, you can use the following command:
java -version
If Java is not installed, you can install it by running the following command:
sudo apt-get install default-jdk
Once Java is installed, we can proceed with installing the Spigot server.
Step 1: Create a new user for the server
To keep things organized and secure, it is a good idea to create a new user for the server. This will ensure that the server files and processes are isolated from other system files and processes.
To create a new user, run the following command:
sudo adduser minecraft
This will create a new user named **minecraft
**and prompt you to set a password for the user.
Step 2: Download the Spigot server files
Next, we need to download the Spigot server files. You can download the latest version of the server from the Spigot website (https://www.spigotmc.org/).
To download the server files, open a terminal and run the following commands:
cd /tmp
wget <https://cdn.getbukkit.org/spigot/spigot-1.16.5.jar>
This will download the spigot-1.16.5.jar
file to the /tmp
directory.
Step 3: Move the server files to the Minecraft user’s home directory
Next, we need to move the server files to the Minecraft user’s home directory. To do this, run the following commands:
mkdir /home/minecraft/server
mv /tmp/spigot-1.16.5.jar /home/minecraft/server/
This will create a server
directory in the Minecraft user’s home directory and move the spigot-1.16.5.jar
file to that directory.
Step 4: Start the server
Now that the server files are in place, we can start the server. To do this, run the following command:
sudo -u minecraft -H sh -c "cd /home/minecraft/server && java -Xmx1024M -jar spigot-1.16.5.jar nogui"
This will start the server using the Minecraft user and run the java
command to start the server. The -Xmx1024M
flag sets the maximum memory allocation for the server to 1024MB.
When the server starts up, it will automatically generate the necessary files and directories, including the eula.txt
file. This file contains the end-user license agreement for the server software, and you will need to agree to it before you can continue.
To agree to the EULA, open the eula.txt
file in a text editor by running the following command:
nano /home/minecraft/server/eula.txt
In the eula.txt
file, find the line that says eula=false
and change it to eula=true
. Save the file and exit the editor. This will indicate that you have agreed to the EULA and allow the server to start.
Step 5: Configure the server
The Spigot server comes with a default configuration that should be sufficient for most users. However, you may want to customize the settings to your liking. To do this, you will need to edit the server.properties
file.
To edit the server.properties
file, run the following command:
nano /home/minecraft/server/server.properties
This will open the server.properties
file in a text editor. You can then modify the settings as desired. Some of the settings you may want to change include:
server-name
: the name of your serverserver-port
: the port that the server will listen on (default is 25565)level-name
: the name of the world that will be generatedgamemode
: the default gamemode for the server (0 for survival, 1 for creative, 2 for adventure)difficulty
: the difficulty level of the server (0 for peaceful, 1 for easy, 2 for normal, 3 for hard)
Once you have finished configuring the server, save the file and exit the editor.
Step 6: Create a systemd service
In order to automatically start the server when the system boots, we can create a systemd service. To do this, create a new file called minecraft.service
in the /etc/systemd/system
directory by running the following command:
sudo nano /etc/systemd/system/minecraft.service
Paste the following contents into the minecraft.service
file:
[Unit]
Description=Minecraft Server
After=network.target
[Service]
WorkingDirectory=/home/minecraft/server
User=minecraft
Group=minecraft
Restart=always
ExecStart=/usr/bin/java -Xmx1024M -jar spigot-1.16.5.jar nogui
[Install]
WantedBy=multi-user.target
This file defines the minecraft
service and specifies the working directory, user and group, and the command to start the server.
Once the minecraft.service
file has been created, reload the systemd manager configuration by running the following command:
sudo systemctl daemon-reload
Then, start the minecraft
service and enable it to start automatically on boot by running the following commands:
sudo systemctl start minecraft
sudo systemctl enable minecraft
Step 7: Connect to the server
Now that the server is up and running, you can connect to it from your Minecraft client. To do this, open Minecraft and select “Multiplayer” from the main menu. Click the “Add Server” button, and enter a name for the server and the IP address or hostname of the server. Click “Done” to add the server to the list.
To connect to the server, select the server from the list and click “Join Server”. This will open the game and connect you to the server.
Congratulations! You have successfully installed and configured a Spigot Minecraft server on Ubuntu 20.04. You can now invite your friends to join and start playing together.
If you encounter any issues or have any questions, feel free to ask for assistance. I hope this tutorial has been helpful and that you enjoy your new Minecraft server.