Introduction to Minecraft Server on Linux
Running a Minecraft server on Linux offers numerous advantages, including better control over server resources, enhanced security, and the ability to customize the server environment to your liking. This guide provides a detailed walkthrough on setting up a Minecraft server on a Linux system, specifically using Ubuntu 20.04.
Step 1: System Preparation and Software Installation
Before installing the Minecraft server, ensure your Linux system is up-to-date. Connect to your server via SSH and execute the following commands:
- Update the system package list:
sudo apt update
- Install the necessary Java Runtime Environment (JRE) to run Minecraft. As of the latest Minecraft server requirements, OpenJDK 17 is suitable:
sudo apt install openjdk-17-jre-headless
- Verify the Java installation:
java -version
Step 2: Configuring Network and Firewall Settings
The default port for Minecraft is TCP 25565. Configure your firewall to allow traffic on this port:
- Add a rule to the Uncomplicated Firewall (UFW) to allow traffic on port 25565:
sudo ufw allow 25565/tcp
- Apply the firewall changes:
sudo ufw enable
Step 3: Installing the Minecraft Server
- Download the Minecraft server software from the official Minecraft website. Replace
YOUR_DOWNLOAD_URL
with the actual download URL for the latest Minecraft server version:
wget -O minecraft_server.jar YOUR_DOWNLOAD_URL
- Start the Minecraft server to generate initial configuration files:
java -Xms1024M -Xmx2048M -jar minecraft_server.jar nogui
Step 4: Initial Configuration and EULA Agreement
After the first launch, the server will stop and prompt for EULA agreement.
- Edit the
eula.txt
file generated in the server directory:
nano eula.txt
- Change
eula=false
toeula=true
to indicate your agreement with the Minecraft EULA.
Step 5: Fine-Tuning Server Properties
Configure the server to your preferences:
- Open the
server.properties
file:
nano server.properties
- Modify settings such as game mode, difficulty, and world type to customize your server experience.
Step 6: Running the Minecraft Server
Start the Minecraft server with the adjusted memory settings and configurations:
java -Xms1024M -Xmx2048M -jar minecraft_server.jar nogui
Monitor the server output for any issues and confirm that it starts successfully.
Step 7: Maintaining Server Uptime
To keep the server running after disconnecting from the SSH session, use a tool like screen
or tmux
.
- Start a new screen session:
screen -S minecraft
- Run the Minecraft server inside the screen session:
java -Xms1024M -Xmx2048M -jar minecraft_server.jar nogui
- Detach from the screen session with the keyboard shortcut
Ctrl+A
thenD
.
Step 8: Connecting to Your Minecraft Server
To play on your server, open Minecraft, select Multiplayer, and enter your server’s IP address and port.
Optimizing Server Performance
Regularly update your server and monitor its performance. Use tools like htop
to check resource usage and adjust the server’s memory allocation (Xms
and Xmx
parameters) as needed.
Conclusion
Setting up a Minecraft server on Linux is a straightforward process that offers flexibility and control. By following the above steps, you can create a stable and customized Minecraft environment for you and your players to enjoy. Regular maintenance and updates will ensure your server remains secure and performs well.
Add comment