Running YaCy on an Android TV Box using Termux

I have successfully installed and run YaCy on an Android TV box using Termux. This is the basic procedure I used.

1. Install Termux

I initially followed the YaCy Android installation information and installed Termux.

Termux is available from F-Droid – Termux or from the official Termux GitHub releases.

One issue I encountered was with Termux:Boot. I had trouble installing it, possibly because Termux and Termux:Boot were obtained from different sources/signatures. It is probably best to install Termux and any Termux add-ons from the same source.

The existing YaCy Android installation information is here: YaCy Android Installation.

2. Install the required packages

Open Termux and run:

pkg update && pkg upgrade
pkg install openjdk-21 git ant openssh iproute2 which -y

This installs Java 21, Git, Ant, OpenSSH and the basic networking tools needed for the setup.

3. Clone and build YaCy

Clone the current YaCy source:

git clone --depth 1 https://github.com/yacy/yacy_search_server.git
cd yacy_search_server
ant clean all

Then start YaCy:

./startYACY.sh

After startup, YaCy should normally be accessible from another machine on the LAN using the Android TV box’s IP address and YaCy’s configured HTTP port.

4. Useful Android/Termux checks

These commands are useful for checking the hardware and network configuration:

nproc
free -h
uptime
cat /proc/cpuinfo
whoami
ip -a route

nproc shows the available CPU cores, while free -h is useful for checking how much memory Android leaves available to Termux and YaCy.

5. Enable SSH

Set a password for the Termux user:

passwd

Start the SSH server:

sshd

Termux OpenSSH normally listens on port 8022 rather than the standard port 22.

You can check it with:

ss -ltn | grep 8022

From another Linux machine, connect using something similar to:

ssh -p 8022 TERMUX_USER@ANDROID_TV_IP

Use whoami in Termux to find the correct username.

6. Automatically start SSH and YaCy when Termux starts

Edit the Termux shell configuration:

nano ~/.bashrc

Add:

# Found timing issue on boot up so start SSH server twice.
if ! pgrep -x sshd >/dev/null; then
sshd
fi

if ! pgrep -x sshd >/dev/null; then
sshd
fi

# Only start YaCy from the local Termux terminal, not SSH
if [ -z "$SSH_CONNECTION" ] && [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
    if ! pgrep -f 'net.yacy.yacy' >/dev/null; then
        cd "$HOME/yacy_search_server"
        ./startYACY.sh
        cd "$HOME"
    fi
fi

This means that when a Termux shell starts, it checks whether SSH and YaCy are already running and starts them if necessary.

This is not quite the same as Android boot autostart: .bashrc runs when Termux starts a shell. For true boot-time startup, Termux itself still needs to be launched at Android boot, for example with a compatible Termux:Boot installation or another Android/root startup mechanism.

Result

This gives a surprisingly capable little YaCy peer:

Android TV Box
      │
    Termux
      │
      ├── OpenJDK 21
      ├── OpenSSH :8022
      │
      └── YaCy

The nice part is that no conventional Linux installation, Docker container or desktop environment is required. YaCy is compiled from source and runs directly under Termux.

For anyone experimenting with inexpensive ARM Android TV boxes, this provides a simple way of turning one into a small, low-power 10 Watts YaCy peer.

I noticed the peculiar name for your project recently show up in the list. I like the idea of using older and less expensive hardware to perform some useful task.

But do you have three of them?

Your Android TV setup already has more documents than my old “Arkansas-notebook”.

yes I have 4 ATM 3 Yacys and 1 nextcloud.

Ah, I had no idea what an Android TV looked like. That’s new to me.

When investigating my server crashes, I saw a nextcloud login. Maybe this was your box I bumped into? I did not try to log in.

yes I run a few not all are available on the net like that one…

Thank you @ExploreTruth , That is wonderful! May I ask what you have decided to go with for storage? I would think it would wear out a thumb drive or sdcard in days. Do those set-top boxes support any other storage types directly?

What a great idea!

Storage, just the internal drive in the device.

Yes 2 USB’s and a microsd slot.

I will have to investigate how to map a drive to termux system.

@roamn has the more interesting setup, but since you tagged me, I will also answer with an image of Arkansas-notebook.

This machine is almost always on, running in my house, using a cell phone as its internet connection. Of course, it has a hard drive, so it can store many GB of data. Windows got wiped off its hard drive and was replaced with Linux Mint. What’s impressive to me: even though it is about 16 years old, it is a fully functional server, running Yacy and Apache.

Thanks for the server shot! Glad to hear you found your way over to Linux Mint, I am a big fan for the desktop. Everything just works, and yet you can still make it do just about anything you like, if you have a mind to. :slight_smile:

I am glad I accidentally tagged you in in that one. I would love to send a photo of mine, but I don’t think the OVH data center will send me one. :smiley:

I am using debian on the servers, and mint at home. I’ve been fortunate enough to bybass all the crazy stuff microsoft has been doing with windows 10/11, and I am just so grateful that there is a path out of that madness. I sure hope more people join us.

Fascinating. Maybe something I had happen here would be of service to you: I had a generic Andoid tv box some time ago, not current tech by any means, and I ended up plugging in a 2.5” seagate freeagent 500GB drive, just to see if it would read it, and it did, though with a mechanical drive I would have upgraded the external power supply if I was going to keep it attached.

Ever since you started this experiment I have become more interested in termux and it looks like what you want to do may not be very difficult: Termux Wiki Internal/External storage access

You Inspire me, and now I am going to have to figure out where that set-top box went, so I can join your android provisioning experiment. :slight_smile: