“Cara Membuat Minecraft Server pada Ubuntu 20.04 / Debian 11 / Linux Mint”
Daftar Isi
Pendahuluan
Minecraft adalah salah satu game paling populer sepanjang masa. Ini adalah video game kotak pasir di mana pemain menjelajahi dunia tanpa batas dan membangun struktur yang berbeda dari rumah sederhana hingga gedung pencakar langit yang menjulang tinggi.
Persyaratan
sudo apt update sudo apt install git build-essential
Install Java Runtime Environment
- Install OpenJRE
sudo apt install openjdk-11-jre-headless
java -version
Membuat User Minecraft
sudo useradd -r -m -U -d /opt/minecraft -s /bin/bash minecraft
Install Minecraft Server pada Ubuntu 20.04 / Debian 11 / Linux Mint
- Masuk ke user minecraft
sudo su - minecraft
- Buat 3 direktori
mkdir -p ~/{backups,tools,server}
Download dan Compiling mcron
- Clone
git clone https://github.com/Tiiffi/mcrcon.git ~/tools/mcrcon
- Build utility
cd ~/tools/mcrcon gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c
- Cek versi
./mcrcon -v
Download Minecraft Server
- Download jar file
wget https://launcher.mojang.com/v1/objects/a0d03225615ba897619220e256a266cb33a44b6b/server.jar -P ~/server
Konfigurasi Minecraft Server
- Jalankan Minecraft Server
cd ~/server java -Xmx1024M -Xms1024M -jar server.jar nogui
Hasil tampilan
[17:35:14] [main/ERROR]: Failed to load properties from file: server.properties [17:35:15] [main/WARN]: Failed to load eula.txt [17:35:15] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
- Edit File
nano ~/server/eula.txt
eula=true
- Edit properties
nano ~/server/server.properties
rcon.port=25575 rcon.password=strong-password enable-rcon=true
Membuat service systemd
- Buat file
sudo nano /etc/systemd/system/minecraft.service
[Unit] Description=Minecraft Server After=network.target [Service] User=minecraft Nice=1 KillMode=none SuccessExitStatus=0 1 ProtectHome=true ProtectSystem=full PrivateDevices=true NoNewPrivileges=true WorkingDirectory=/opt/minecraft/server ExecStart=/usr/bin/java -Xmx1024M -Xms1024M -jar server.jar nogui ExecStop=/opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 25575 -p strong-password stop [Install] WantedBy=multi-user.target
- Save dan reload service
sudo systemctl daemon-reload
- Start service
sudo systemctl start minecraft
- cek status service
sudo systemctl status minecraft
- Enable Service
sudo systemctl enable minecraft
Allow Firewall
sudo ufw allow 25565/tcp
Buat Configurasi Backup
- login ke user minecraft
sudo su - minecraft
- Buat file baru
nano /opt/minecraft/tools/backup.sh
Tambahkan script berikut
#!/bin/bash function rcon { /opt/minecraft/tools/mcrcon/mcrcon -H 127.0.0.1 -P 25575 -p strong-password "$1" } rcon "save-off" rcon "save-all" tar -cvpzf /opt/minecraft/backups/server-$(date +%F-%H-%M).tar.gz /opt/minecraft/server rcon "save-on" ## Delete older backups find /opt/minecraft/backups/ -type f -mtime +7 -name '*.gz' -delete
- Buat permission file
chmod +x /opt/minecraft/tools/backup.sh
- Setup Crontab
crontab -e
0 23 * * * /opt/minecraft/tools/backup.sh
Penutup
Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Membuat Minecraft Server pada Ubuntu 20.04 / Debian 11 / Linux Mint. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.