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