Hello Hivian,
Isn't it mind-blowing what phones can do these days. Today, virtually all of us are carrying computers with us every day that can compete with the performance of a modern desktop PC.
Just a few years ago, mobile phones were still on the level of pocket calculators in terms of computing power. And when my enthusiasm for programming computers began (1986/87), a mobile phone with the power of a desktop PC would have weighed many tons. The battery of this fictitious device would probably even send a small cargo ship to the bottom of the sea.
Since I recently became aware of the power of my mobile communication computer again, when I was thinking about a more energy-saving alternative to my home server (old desktop PC), I got the idea to use my mobile phone for this purpose.
My home server just had to run fairly simple tasks anyway. Such as a monitoring tool for Git repositories, a household management server, backup scripts, and other minor tasks such as a couple of Hive bots. Most of these tasks were defined in Python scripts. Some of these scripts make use of the Beem package for Python, which allows you to use the Hive API services with Python.
None of this tasks would require computational power that could break the little guy's heart.
How I successfully managed to turn my Android phone into a mini but nice and Linux powered, Python(+Beem) capable home server, I would like to tell you about in this post.
NO ROOT REQUIRED !!!
Hallo Hivianer,
Wahnsinn, was Telefone heutzutage alles können. Fast jeder von uns führt heute täglich einen Computer mit sich, der sich mit der Leistungsfähigkeit eines Desktop-PCs messen lässt.
Noch vor ein paar Jahren, waren Mobil-Telefone in Sachen Rechenleistung noch auf Taschenrechner-Niveau. Und als ich damals anfing Computer zu programmieren (1986/87), wäre ein Mobil-Telefon mit der Leistungsfähigkeit eines heutigen Desktop-PCs, noch mehrere Tonnen schwer gewesen. Der Akku, dieses fiktiven Gerätes, würde wohl sogar ein kleines Frachtschiff versenken.
Da mir die Kraft meines mobilen Kommunikations-Computers neulich mal wieder so richtig bewusst wurde, als ich mir Gedanken über eine stromsparendere Alternative zu meinem Heimserver (alter Desktop-PC) machte, kam mir die Idee, kurzerhand mein Mobil-Telefon dazu zu verwenden.
Auf meinem Heimserver liefen ohnehin nur recht einfache Aufgaben, wie z.B. ein Monitoring-Werkzeug für Git Repositories, ein Haushaltsverwaltung-Server, Backup-Scripts und einige kleinere Aufgaben, wie z.B. ein paar Hive-Bots. Die meisten dieser Aufgaben sind in Python-Scripts definiert und einige nutzen das Beem-Paket für Python, mit welchem man die Hive-API Dienste unter Python nutzen kann.
Nichts davon würde Rechenkraft erfordern, die dem kleinen Kerl das Herz zerreisen könnte.
Wie ich es erfolgreich anstellte, aus meinem Android-Telefon einen kleinen aber feinen, Linux betriebenen, Python(+Beem) fähigen, Heimserver zu machen, möchte ich dir gerne in diesem Beitrag erzählen.
KEIN ROOT ERFORDERLICH !!!
It' s well known to the nerds and tech geeks among us - Android runs on Linux on the phone, basically.
Yes, really!
Linux represents the lowest layer of the operating system on Android devices. This is followed by the so-called hardware abstraction layer, or HAL for short. HAL provides the overlying OS layer with routines for handling the hardware.
Above that, in another layer, there are some native runtime libraries and the Android runtime environment, which is also just a piece of software that runs on Linux.
One layer above that is the Java API, i.e. public Android functions that are used by Android apps.
Normal Android users usually do not notice anything from the Linux brain of their device. Of course, this is intentional. After all, Android is designed to be a simple operating system that can be used by everyone. Even people without any technical knowledge.
Maybe that's why Android devices don't come with apps that could unlock the potential of the Linux base.
But there are some well working terminal emulators for the operating system. For example Termux.
Termux is an Android terminal emulator and app for using a Linux environment.
It works straight out of the box with no rooting or setup required. A minimal base system comes with the app. Additional packages can be installed via a package manager.
pkg update && pkg upgrade.pkg install pythonpkg install opensslpip3 install -U cryptographypip3 install -U beempkg install cronie termux-servicessv-enable crondtermux-setup-storage.ls ~/storage/shared.Die Nerds und Technik-Geeks unter uns wissen es - Android läuft quasi unter Linux auf dem Telefon.
Ja, wirklich!
Linux bildet auf Android-Geräten die unterste Schicht des Betriebssystems. Darauf folgt der sogenannte Hardware-Abstraction-Layer, kurz HAL. HAL bietet der überliegenden Betriebsystem-Schicht Routinen zum Umgang mit der Hardware.
Darüber liegen in einer weiteren Schicht, die nativen Laufzeit-Bibliotheken und die Android-Laufzeitumgebung, welches letztlich auch nur eine Software ist, die unter einem Linux läuft.
Eine Schicht darüber, liegt die Java API, also öffentliche Android-Funktionen, die von den Android-Apps verwendet werden.
Als normaler Android-Benutzer, bekommt man vom Linux-Gehirn seines Gerätes gar nichts mit. Das ist natürlich gewollt. Denn Android soll ja schließlich ein einfaches Betriebssystem darstellen, das von jedem Menschen verwendet werden kann. Auch ohne technische Vorbildung.
Eventuell werden Android-Geräte daher auch nicht mit Apps ausgeliefert, welche das potential des Linux-Unterbaus freilegen könnten.
Aber es gibt einige gut funktionierende Terminal-Emulatoren für das Betriebssystem. Z.B. Termux.
Termux ist ein Android-Terminalemulator und eine App zur Verwendung einer Linux-Umgebung.
Sie funtioniert direkt und ohne dass ein Rooting oder eine Einrichtung erforderlich ist. Mit der App kommt ein minimales Basissystem. Zusätzliche Pakete können über einen Paketmanager bezogen werden.
pkg update && pkg upgradepkg install pythonpkg install opensslpip3 install -U cryptographypip3 install -U beempkg install cronie termux-servicessv-enable crondtermux-setup-storagels ~/storage/sharedNow you not only have the power to run Python scripts on your phone, but you also have the power to run scripts that perform tasks in the Hive. Moreover, you can even schedule your scripts to run.
But that's not all you can do with Termux on your phone.
Of course, you can install a web server like Nginx using the package manager and use it to host websites on your phone.
pkg install nginx
You don't have to miss GIT either.
pkg install git
How about SSH to perform operations on other machines across a network?
pkg install openssh
Have fun with Linux on your phone! :-)
Nun hast nicht nur die Möglichkeit Python-Scripts auf deinem Telefon auszuführen, sondern damit auch noch Aufgaben im Hive erledigen zu lassen. Obendrein, kannst du deine Scripts sogar Zeit gesteuert ausführen lassen.
Aber das muss nicht alles sein, was du aus deinem Telefon noch machen kannst.
Selbstverständlich kannst du auch einen Webserver, wie Nginx mithilfe des Paketmanagers installieren und damit auf deinem Telefon Webseiten hosten.
pkg install nginx
Auch auf GIT musst du nicht verzichten.
pkg install git
Wie wärs mit SSH, um auf anderen Rechnern über ein Netzwerk Operationen durchführen zu können?
pkg install openssh
Viel Spaß mit Linux auf deinem Telefon! :-)
Best regards | Viele Grüße
QuantumG
╭━━⋞ ☙ My NFT artworks ≻≺ ♖ My dCity ⋟━━╮
╰━━━━⋞ ♫ My Rising Star(s) ⋟━━━━╯