Turn an Old Android Phone Into a Home Server With Termux (and When to Buy a Pi Instead)

A step-by-step Termux guide to turning an old Android phone into an always-on home server, with SSH, a web page and boot scripts, plus what Hacker News says about Pi versus phone.

Reviewed by Mindloop Editorial on . Every link in the Sources section at the end was re-checked that day.

Graphic of a terminal window on a phone showing an SSH session, illustrating how to turn an old Android phone into a home server.

One blogger priced a Raspberry Pi 4 build with a camera, touchscreen, battery backup and mobile data at roughly $347. A used phone with all of that built in turns up for $45 to $75, by his numbers. That comparison reached the Hacker News front page earlier this week with more than 500 points, and it raises a fair question: if a phone already has a CPU, storage, Wi-Fi and a battery, why not make it your home server?

Key takeaways

  • An old Android phone on Android 7 or newer can run as a small home server using the free Termux app.
  • Install Termux from F-Droid or GitHub, not Google Play, and get its add-ons from the same source.
  • Termux’s SSH server listens on port 8022, and Python’s http.server can serve a simple page on your home network.
  • A phone suits files and weekend projects, but buy a Raspberry Pi if you need GPIO pins and long-term support.

This guide shows how to turn an old Android phone into a small always-on server with Termux, a free Linux terminal app. You will end with a phone you can log into over SSH and a tiny web page it serves to your home network.

What you need

  • An old Android phone on Android 7 or newer (Termux’s F-Droid listing says it requires Android 7.0 or newer)
  • The phone on your home Wi-Fi and plugged into a charger
  • A laptop on the same network
  • About 20 minutes

None of the commands below were run for this article. They come from the Termux project’s own repositories and the Python documentation, so test them on a spare phone first.

Termux running the Vim editor on an Android tablet with a Linux-style on-screen keyboard
Termux on Android: a full Linux command line, here running the Vim editor on a tablet. Screenshot: Petr.Mach.Wraith, CC BY-SA 4.0, via Wikimedia Commons.

Did you know?

Termux’s SSH server does not use the usual port 22. Its sshd configuration lists port 8022, so every login from your laptop needs the -p 8022 flag.

The honest Pi comparison

The post behind the Hacker News thread, from the blog so.long.thanks.fish, priced “illustrative November 2026 listings” in its own table. Its core Pi 4 (4GB) build came to about $222 against $45 to $75 for a used phone. The author also rooted his phone, which this guide does not require.

Commenters pushed back. Several pointed to the Pi’s GPIO pins, a maintained kernel and software support, and one noted that finding hundreds of matching used phones would be harder than buying Pis. If you only want a quiet box for files and a web page, a phone is a reasonable tinkering project, and if you need hardware pins, buy the Pi.

By the numbers

$347full Pi 4 build, roughly

$222core Pi 4 (4GB) build

$45 to $75used phone, by his numbers

Step by step

1. Install Termux from the right place

Termux’s README says to use F-Droid or GitHub. The Google Play build is labeled experimental, targets Android 11 or newer, and is missing functionality compared with the F-Droid build. The README also warns that Google Play may try to replace an F-Droid install, and that update will fail. If you use F-Droid, updates can arrive a few days, or even a week or more, after GitHub releases.

2. Update the packages

Open Termux and run:

Terminal
pkg upgrade

pkg is Termux’s package manager, and upgrade brings every installed package to the latest version.

3. Install SSH and set a password

Terminal
pkg install openssh
passwd
whoami
sshd

passwd sets the login password. According to the termux-auth README, when no credentials file exists, access is locked down, so the password step is required. whoami prints your Termux username. sshd starts the SSH server, and Termux’s sshd configuration lists port 8022 rather than the usual 22.

4. Log in from your laptop

Find the phone’s IP address in its Wi-Fi details or your router’s device list. In this example it is 203.0.113.10, and the username is whatever whoami printed:

Terminal
ssh -p 8022 user@203.0.113.10

You should land in a Termux shell on the phone. When you are ready to drop the password, our guide to setting up SSH keys explains key-based login. Keep using -p 8022 with the commands there.

5. Serve a web page

Terminal
pkg install python
mkdir -p ~/site && cd ~/site
echo "Hello from my old phone" > index.html
python -m http.server 8000

Python’s documentation says the server listens on port 8000 by default and binds to all interfaces. Browse to http://203.0.113.10:8000 from the laptop and you should see your line of text. The same documentation warns that http.server is not recommended for production because it only implements basic security checks, so keep it on your home network and do not forward the port from your router.

6. Stop the phone from falling asleep

Terminal
termux-wake-lock

Termux describes this command as acquiring the wake lock “to prevent the CPU from sleeping.” You may also need to exempt Termux from Android’s battery optimization in the phone’s system settings, and the menu name varies by maker. If the phone will sit on a charger around the clock, our phone battery guide covers how charging habits affect battery wear.

7. Start everything at boot

Install the Termux:Boot add-on from F-Droid, open it once, then create a script. Install Termux and its add-ons from the same source: the Termux:Boot README says signature keys differ between builds, and switching sources means uninstalling Termux and all plugins first.

Terminal
mkdir -p ~/.termux/boot
cat > ~/.termux/boot/start-sshd << 'EOF'
#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
sshd
EOF

The script contents come straight from the Termux:Boot README, which uses this exact example for starting an SSH server at boot.

After a restart, SSH should come back without you touching the phone. An alternative is the termux-services package: install it with pkg install termux-services, restart your shell, then run sv-enable sshd. Its README says to check $PREFIX/var/log/sv/<service>/current for problems.

Flow diagram of five steps to turn an old Android phone into a home server with Termux

Common errors and fixes

  • [Process completed (signal 9) - press Enter]. On Android 12 and newer, the README says Android kills phantom processes beyond a combined limit of 32 across all apps, and also kills processes that use excessive CPU. The README links to an issue with a workaround, and it warns that upgrading from Android 11 is at your own risk.
  • Connection refused. Check that sshd is running in Termux, that you used -p 8022, and that the laptop and phone share a network.
  • Permission denied. Run passwd again on the phone and retry.
  • Server stops overnight. Run termux-wake-lock and check Android’s battery settings for Termux.
  • Boot script never runs. Check that Termux and Termux:Boot came from the same source, such as both from F-Droid, since the README says the builds are signed with different keys.
  • Play Store update fails. Open Termux’s Play Store page, tap the three-dot menu and turn off Enable auto update, as the README suggests.
List of common Termux phone server errors such as connection refused, each paired with its fix

Is it worth it?

For a file share, a notes page or a weekend project, an old phone is a fun fit, and it keeps a device out of the drawer. For anything that must stay up, the commenters’ warnings about locked bootloaders and device-to-device quirks are worth listening to. As of 15 November 2026, the cheapest first step is the one above: install Termux, start sshd, and see what survives a week.

Frequently asked questions

Can I use an old Android phone as a server?

Yes, for light jobs. With the free Termux app on Android 7 or newer, a phone on Wi-Fi and a charger can run an SSH server and a simple web page on your home network. Test on a spare phone first.

Should I install Termux from Google Play or F-Droid?

Termux’s README recommends F-Droid or GitHub. The Google Play build is labeled experimental, targets Android 11 or newer and lacks some functionality. Install Termux and its add-ons from the same source, since builds are signed with different keys.

What port does SSH use in Termux?

Termux’s sshd configuration lists port 8022 rather than the usual 22. From your laptop, connect with ssh -p 8022 followed by your Termux username and the phone’s IP address.

Is an old phone better than a Raspberry Pi for a home server?

For a quiet box serving files or a web page, a phone is a reasonable tinkering project. If you need GPIO pins, a maintained kernel and long-term software support, Hacker News commenters point out a Pi is the better buy.

Quick quiz

Which port does Termux’s SSH server use?

  • 22
  • 8000
  • 8022

Termux’s sshd configuration lists port 8022 rather than the usual 22.

What does termux-wake-lock do?

  • Prevents the CPU from sleeping
  • Locks the screen with a password
  • Starts Termux at boot

Termux describes it as acquiring the wake lock to prevent the CPU from sleeping.

Why should Termux and Termux:Boot come from the same source?

  • Google Play blocks add-ons
  • Builds are signed with different keys
  • F-Droid charges for plugins

The Termux:Boot README says signature keys differ between builds.

Sources

Links last checked on 15 November 2026.

Written by Mindloop Editorial

The Mindloop Experience editorial team writes clear, carefully sourced explainers and how-tos on AI and technology, software and the business of tech, for anyone who likes to know how things actually work.

Meet the editorial team

Responses

Write a response

More from Mindloop Experience

See all from Mindloop Experience

You can clap up to 50 times.