/termux-minecraft-server

Minecraft Java and Bedrock Server on Termux / Android

Minecraft Server on Termux / Android

The procedure described here how to installs and runs a Minecraft Java Edition server and Minecraft Bedrock Edition server on an Android device with Termux. Root is not required.




Prerequisites



Termux

You must have Termux installed on an android device. It is strongly advised install it from F-Droid (not from Google Play Store). Link : Termux on F-Droid


Install Termux Package

Launch Termux and type the following commands. This allows us to update the termux packages, and to install the WGET command which will be useful to us later.

pkg update -y && pkg upgrade -y && pkg install wget -y

Install JAVA


Main method

This is the recommended method.

pkg install openjdk-17 -y

Use command java -version to verify that Java is installed correctly.


Alternative method 1

If the previous method did not work, you can proceed as follows:

wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava

See Termux Java GitHub for more information.


Alternative method 2

If the previous method did not work, you can proceed as follows:

cd ~
apt-get install -y wget
hash -d wget
wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jre-headless_9.2017.8.20-1_arm.deb
wget https://archive.org/download/openjdk-9-jre-headless_9.2017.8.20-1_x86_64/openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb
apt-get install -y ./openjdk-9-jre-headless_9.2017.8.20-1_arm.deb ./openjdk-9-jdk-headless_9.2017.8.20-1_arm.deb
rm openjdk-9-*.deb

You can learn more about this method by consulting this stackoverflow topic : How can I install java runtime on Android device?




Install Minecraft Server



Server directory

For better user comfort, I invite you to create a directory in a shared space of the device as follows:

termux-setup-storage
cd ~/storage/shared

Create a folder for the server:

mkdir termux-minecraft-server
cd ./termux-minecraft-server/

Download Server JAR

Now we will download the Minecraft server executable file. Here I am using PufferFish server 1.19 which has good performance.

wget https://ci.pufferfish.host/job/Pufferfish-1.19/lastSuccessfulBuild/artifact/build/libs/pufferfish-paperclip-1.19-R0.1-SNAPSHOT-reobf.jar
mv pufferfish-paperclip-1.19-R0.1-SNAPSHOT-reobf.jar server.jar

You can also choose another distribution. Here are the commands for some of the best known :

# Server Bedrock : Nukit
wget https://ci.opencollab.dev/job/NukkitX/job/Nukkit/job/master/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar
mv nukkit-1.0-SNAPSHOT.jar server.jar


# Server Java : PufferFish 1.18.2
wget https://ci.pufferfish.host/job/Pufferfish-1.18/lastSuccessfulBuild/artifact/build/libs/pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar
mv pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar server.jar


# Server Java : Vanilla 1.19
wget https://launcher.mojang.com/v1/objects/e00c4052dac1d59a1188b2aa9d5a87113aaf1122/server.jar


# Server JAva : Vanilla 1.18.2
wget https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar

Accept EULA

To accept the Minecraft Terms of Use, use the following command:

echo "eula=true" > eula.txt


Start the server


To start the server, you can use the command as below:

java -jar server.jar nogui

It is also possible to better control the memory allocated by Java for running Minecraft by specifying -Xms and -Xmx parameters as follows

java -Xms512M -Xmx1536M -jar server.jar nogui

To know your local ip, you can use the command ifconfig. To know your external ip, go to https://wprock.fr/en/t/ip/. To check your ports, use https://portchecker.co/check.