└── README.md /README.md: -------------------------------------------------------------------------------- 1 | ## Minecraft Server on Termux / Android 2 | 3 | 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**. 4 | 5 |

6 | 7 | --- 8 | 9 | ## Prerequisites 10 | 11 | --- 12 | 13 |
14 | 15 | ### Termux 16 | 17 | You must have [Termux](https://termux.com/) installed on an android device. It is strongly advised install it from [F-Droid](https://f-droid.org/) (not from Google Play Store). Link : [Termux on F-Droid](https://f-droid.org/en/packages/com.termux/) 18 | 19 |
20 | 21 | ### Install Termux Package 22 | 23 | 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. 24 | 25 | ```shell 26 | pkg update -y && pkg upgrade -y && pkg install wget -y 27 | ``` 28 | 29 |
30 | 31 | ### Install JAVA 32 | 33 |
34 | 35 | #### Main method 36 | 37 | This is the recommended method. 38 | 39 | ```shell 40 | pkg install openjdk-17 -y 41 | ``` 42 | 43 | Use command `java -version` to verify that Java is installed correctly. 44 | 45 |
46 | 47 | #### Alternative method 1 48 | 49 | If the previous method did not work, you can proceed as follows: 50 | 51 | ```shell 52 | wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava 53 | ``` 54 | 55 | See [Termux Java GitHub](https://github.com/MasterDevX/Termux-Java) for more information. 56 | 57 |
58 | 59 | #### Alternative method 2 60 | 61 | If the previous method did not work, you can proceed as follows: 62 | 63 | ```shell 64 | cd ~ 65 | apt-get install -y wget 66 | hash -d wget 67 | 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 68 | 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 69 | 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 70 | rm openjdk-9-*.deb 71 | 72 | ``` 73 | 74 | You can learn more about this method by consulting this stackoverflow topic : [How can I install java runtime on Android device?](https://stackoverflow.com/questions/61720889/how-can-i-install-java-runtime-on-android-device) 75 | 76 |

77 | 78 | --- 79 | 80 | ## Install Minecraft Server 81 | 82 | --- 83 | 84 |
85 | 86 | ### Server directory 87 | 88 | For better user comfort, I invite you to create a directory in a shared space of the device as follows: 89 | 90 | ```shell 91 | termux-setup-storage 92 | cd ~/storage/shared 93 | ``` 94 | 95 | Create a folder for the server: 96 | 97 | ```shell 98 | mkdir termux-minecraft-server 99 | cd ./termux-minecraft-server/ 100 | ``` 101 | 102 |
103 | 104 | ### Download Server JAR 105 | 106 | Now we will download the Minecraft server executable file. Here I am using [PufferFish server](https://github.com/pufferfish-gg/Pufferfish) 1.19 which has good performance. 107 | 108 | ```shell 109 | wget https://ci.pufferfish.host/job/Pufferfish-1.19/lastSuccessfulBuild/artifact/build/libs/pufferfish-paperclip-1.19-R0.1-SNAPSHOT-reobf.jar 110 | mv pufferfish-paperclip-1.19-R0.1-SNAPSHOT-reobf.jar server.jar 111 | ``` 112 | 113 |
114 | 115 | You can also choose another distribution. Here are the commands for some of the best known : 116 | 117 | ```shell 118 | 119 | # Server Bedrock : Nukit 120 | wget https://ci.opencollab.dev/job/NukkitX/job/Nukkit/job/master/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar 121 | mv nukkit-1.0-SNAPSHOT.jar server.jar 122 | 123 | 124 | # Server Java : PufferFish 1.18.2 125 | wget https://ci.pufferfish.host/job/Pufferfish-1.18/lastSuccessfulBuild/artifact/build/libs/pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar 126 | mv pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar server.jar 127 | 128 | 129 | # Server Java : Vanilla 1.19 130 | wget https://launcher.mojang.com/v1/objects/e00c4052dac1d59a1188b2aa9d5a87113aaf1122/server.jar 131 | 132 | 133 | # Server JAva : Vanilla 1.18.2 134 | wget https://launcher.mojang.com/v1/objects/c8f83c5655308435b3dcf03c06d9fe8740a77469/server.jar 135 | ``` 136 | 137 |
138 | 139 | ### Accept EULA 140 | 141 | To accept the Minecraft Terms of Use, use the following command: 142 | 143 | ```shell 144 | echo "eula=true" > eula.txt 145 | ``` 146 | 147 |
148 | 149 | --- 150 | 151 | ## Start the server 152 | 153 | --- 154 | 155 | To start the server, you can use the command as below: 156 | 157 | ```shell 158 | java -jar server.jar nogui 159 | ``` 160 | 161 |
162 | 163 | It is also possible to better control the memory allocated by Java for running Minecraft by specifying `-Xms` and `-Xmx` parameters as follows 164 | 165 | ```shell 166 | java -Xms512M -Xmx1536M -jar server.jar nogui 167 | ``` 168 | 169 |
170 | 171 | To know your local ip, you can use the command `ifconfig`. To know your external ip, go to [https://wprock.fr/en/t/ip/](https://wprock.fr/en/t/ip/). To check your ports, use [https://portchecker.co/check](https://portchecker.co/check). 172 | --------------------------------------------------------------------------------