Evenings spent with family watching series and movies can be delightful, yet the logistics of accessing content often present challenges. The reliance on multiple laptops, each with varying battery life, and the need for cumbersome connections to the television can detract from the experience. Additionally, the reluctance to download torrents on a work laptop and the risk of interruptions during downloads add to the frustration.
Desire for Simplicity
Imagine a scenario where you simply turn on the television, select a film, and start watching—no fuss, no hassle. This vision inspired a quest for a more streamlined solution.
Innovative Solution
After reading an article on creating a DIY home NAS on Habr, I was intrigued but quickly deterred by the high costs of ready-made solutions and components. A spark of inspiration struck when I recalled my old OnePlus 5T, a smartphone from 2017 that had recently returned to my possession. I decided to repurpose it as an “ultra-mini-nano-NAS,” or more accurately, a media server. Despite its modest 64 GB of internal storage, I figured that with careful management—deleting films after viewing—it could suffice.
The device, while no longer receiving updates, remains surprisingly fast and user-friendly. To avoid transforming the phone into a monolithic Linux system, I opted for a gentler approach: installing Termux and launching a Linux-like environment via PRoot. This method allows the smartphone to retain its dual SIM functionality while enabling the deployment of media-sharing services without compromising the Android experience.
Software Selection
Alpine Linuxsshddms(available at GitHub) — a lightweight and easy-to-configure DLNA server requiring just three parameters at startup.transmission-daemon— for torrent management, featuring a built-in web interface for initiating downloads from any device on the network.
Exploring Alternatives
- Jellyfin: Requires .NET and is too resource-intensive for a smartphone.
- Gerbera: Appeared complex to configure.
- minidlna: Did not work immediately, and I opted not to troubleshoot further.
Step-by-Step Guide
- Install Termux on your phone (available from F-Droid).
- In Termux, install proot-distro and update packages:
pkg update && pkg upgrade pkg install proot-distro - Install Alpine and log in:
proot-distro install alpine proot-distro login alpine - Inside the container, install the necessary packages: SSH, transmission-daemon, and dms. Example commands for Alpine:
apk update apk add openssh transmission-daemon ca-certificates curl # DMS - fetch from GitHub binaries
Tips and Tweaks
- For SSH, I use port 2222, as the standard port 22 may be blocked or unavailable.
- On Android, increase the limit for background processes to prevent Termux and the container from being terminated:
adb shell device_config put activity_manager max_phantom_processes 2147483647 - In Android settings for the Termux app, disable battery optimization and allow it to run in the background.
- After rebooting the phone, you’ll need to restart the container and services. To streamline this, you can add a startup script in
~/.ashrcwithin Alpine to check and launch necessary daemons:# --- Server Startup Script --- # 1. Start SSH Daemon (if not running) if ! pidof "sshd" > /dev/null; then /usr/sbin/sshd echo "🚀 SSH Server started on port 2222" fi # 2. Start Transmission Daemon (if not running) if ! pidof "transmission-daemon" > /dev/null; then transmission-daemon -g ~/.config/transmission-daemon echo "📥 Transmission Daemon started" fi # 3. Start DMS Media Server (background) if ! pidof "dms" > /dev/null; then /root/dms -path /sdcard/Download -ifname wlan0 -http :8200 -friendlyName "5T-Cinema" > /dev/null 2>&1 & echo "🎥 DMS Media Server started in background" fi echo "--- All services are active ---"
Outcome
- A simple and cost-effective solution emerges: an old smartphone transforms into a compact DLNA server, accessible to the television over the local network.
- Termux and PRoot offer flexibility without fully replacing Android.
- Lightweight components like Alpine, dms, and transmission-daemon fit comfortably within the resources of an aging device.