How to run playit on Android!

For do this, you need a device with Android 7 or highter!

  1. Download and install termux - Termux | F-Droid - Free and Open Source Android App Repository

  2. Now, follow the installation steps to install Ubuntu in termux: GitHub - MFDGaming/ubuntu-in-termux: This is a script by which you can install Ubuntu in your termux application without a rooted device
    Ubuntu in termux is needed because termux itself don’t run some Linux programs.

  3. Once you installed Ubuntu, download the playit version for Raspberry Pi, to check your device architecture, use the command uname -m

  4. Now, we have to move playit to the Ubuntu file system, in my device I can do this in the stock files app, like this:

Playit is probably in Downloads

  • Select the playit file and look for “move to” option

  • Now look for termux on the files tab

  • Now go to “ubuntu-in-termux > ubuntu-fs > home” and tap “move”

  1. At this point, we’re almost done, now let’s see if playit is in the right place! On termux, let’s start Ubuntu, go to /home, make playit a executable file (this is only necessary once) and execute it, using this commands:
cd ubuntu-in-termux
./startubuntu.sh
cd /home
ls | grep "playit" # this command shows your playit file
playit="[playit file name]"
chmod +x "$playit" # example: chmod +x playit-aarch64-0.4.6
./"$playit" # (this one runs playit) example: ./playit-aarch64-0.4.6

When you see root@localhost:~# it means that you are using Ubuntu!

3 Likes

This is awesome! Thanks for creating. I need to give this a try.

3 Likes

I also know how to run java servers using termux, like the vanilla, and nukkit (this one is for Minecraft bedrock), but I don’t know if is useful…

2 Likes

Hey, ive never used termux and pretty new to play it.gg.
I used your steps and followed it exactly, with some debugging.
But on the last step to run playit, it says bus error. Ive looked on google and not found anything helpful. What do I do to solve this.

I know this is an old post but its the only one out there I guess …

Thanks.

Alternative method

Just use the rust package from termux-packages. You don’t have to install Ubuntu with this, but you have to build playit-cli from source (as the playit agent is open-source).

You need to have at least 2-3 gigabytes of free space, as the base environment and the compiler is taking approximately one gigabytes of storage space, and another half a gigabyte for the dependencies+caches (don’t worry, the resulting binary is approximately only 4 megabytes and you can delete the leftovers from the compile process).

You also need at least minimal of 2 gigabytes of RAM to compile this, assuming Termux is the only opened application and no other tasks are running in the background. 4 gigabytes or more is preferred.

Android 7 or above is needed to install the Termux app with updated packages. The requirements might change overtime. Note that Android 12 or above will kill some background processes running inside Termux, which makes the tunnel stop randomly. See [Bug]: Android 12 Phantom Processes Killed "[Process completed (signal 9) - press Enter]" · Issue #2366 · termux/termux-app · GitHub for solution.

Tutorial:

First, you need to install Termux either from F-Droid or GitHub releases, the Google Play version is not stable enough as I post this. Link can be found on the original post above.

Then, make sure to update the packages as installing directly can cause “Cannot link executable error”, notably because of OpenSSL package being upgraded from 1.1.x to 3.x. If it prompts for updating specific configuration file, just type y.

termux-change-repo # Optional, but recommended to switch to the nearest mirror
pkg upgrade

After upgrading, You may exit the Termux app and reopen it to reflect some changes.

Then, install the git and rust package. This will also include cargo which is necessary:

pkg install git rust

(If you don’t want to use Git, download the Source code from the latest tagged release, open the zip on termux, run unzip playit-agent-master.zip, and skip to the compile step)

Then, you need to clone the source code into your device. Make sure you are still under the home directory (and not under ~/storage or /sdcard or /storage) as cloning into the Internal Storage will cause some issues.

git clone -b master --single-branch --depth 1 'https://github.com/playit-cloud/playit-agent'
cd playit-agent/ # Important

You should be inside of the playit-agent directory.

Compile the playit-cli. This is a CPU and RAM intensive process. Close any other applications before compiling to make sure it did not crash:

cargo run --release

After the compile process is done, it should be running the playit-cli automatically. Copy the link either by selecting the text and copying it, then opening it on your web browser, or by selecting any text, then press “More…”, then press “Select URL”, then hold the desired link. Continue the normal setup on your web browser.

The compiled playit-cli program itself is located at target/release/playit-cli. Copy it outside the directory before cleaning the leftovers. Make sure the destination you are copying into is still under the home directory (and not under ~/storage or /sdcard or /storage) as copying into the Internal Storage will cause the program not being able to execute.

cp target/release/playit-cli ~/ # Replace "~/" with your desired path. If unsure, leave it as "~/"

Note that you can also move it into ~/.local/bin/ instead of ../ (mkdir -p ~/.local/bin if that directory doesn’t exists yet) and add the following line in your ~/.bashrc file:

export PATH="$HOME/.local/bin:$PATH"

Relaunch the Termux app, then you should be able to run playit-cli directly without ./ at the beginning.

To run it without cargo:

cd <path-to-playit-cli> # where <path-to-playit-cli> is where you put your playit-cli when you copied it on the previous step. If you just follow the previous step without changing anything, <path-to-playit-cli> is "~/"
./playit-cli

If you need to update it, run git pull inside the playit-agent directory, then repeat the compile process.

Cleaning up

If you no longer need to update this and you no longer want to compile any Rust program, and you wanted to free up storage space, follow the steps below:

#Run inside the playit-agent directory:
cargo clean # Clean the build artifacts
cd .. # Go to the parent directory 
rm -r playit-agent # Remove the playit-agent directory
rm -r ~/.cargo/registry # Remove the cargo registry
pkg remove rust #: Uninstall the rust compiler and cargo
pkg autoremove # Remove any leftover unneeded dependencies

Lastly, clean the downloaded package cache. You may run it at anytime to clean up storage space as the package itself is already installed, so it should be safe.

pkg clean

You can also remove playit-cli if you no longer need it:

cd <path-to-playit-cli> # Ensure you are inside the right directory.
rm ./playit-cli # Remove it

Also I forgot to add apt purge rust after pkg remove rust
Also do autoremove again if you have previously already done the clean up process.

If you no longer need to run this and no longer need to use Termux app, just uninstall the app, this will delete all files including Termux home directory, packages, and programs inside Termux, but your Internal (Shared) Storage (/storage/emulated/0 or /sdcard, etc) should be intact. (If you’ve done termux-setup-storage, it only removes the ~/storage symbolic link if you uninstalled the Termux app, not the actual directory)

Nevermind, it’s actually available in tur-repo

pkg install tur-repo
pkg install playit
playit-cli

Note that at the time of writing this, It is still at version of 0.15.11 The package just have been updated to 0.15.23! Run:

pkg upgrade