I have an old OnePlus 5T that has LineageOS installed. I don’t really do anything with it and I thought it would be cool to host my first ever website (static) on it.
What I’ve done so far:
- Got the HTML file for my website.
- Got the CSS style sheet for that site.
- Purchased a domain name.
I request help/guidance with:
- Minimal install of Debian, nginx, Docker, and Fail2ban. (I feel I need help with the Debian installation because the rest is seems easy enough).
- Hosting my website from my home, so like if I should consider subnet or vlan for my home to protect other devices when I expose port 80 (http) and 443 (https) of my router so other servers can access my server phone.
I know this sounds like complicating matters for something I have never done before, but any help would be greatly appreciated. I have hosted stuff at home (pihole, LibreTranslate, etc) but I think this website project may not be straightforward.
As said in another comment a bare metal Debian install likely wouldn’t be very smooth, or you’d have to run it within Android. Alternatively, if you want to run Linux directly on the phone you could try postmarketOS https://wiki.postmarketos.org/wiki/OnePlus_5T_(oneplus-dumpling)
I can’t help as much with the exposing outward (I’m a basic bitch and just use ddns to expose mine since I can’t get a dedicated IP) but a separate vlan with rules to allow your primary vlan devices to see/talk to it, and block it to be able to see out of it’s own VLAN, would definitely be recommended.
With Termux on Android, it’s possible to install Debian in a proot environment.
More about this here: https://github.com/termux/proot-distro
I guess using this envirinment, it’s possible to set up your server to your needs.
One thing I don’t know is how to autostart Termux at boot, but there must be a way, “worst-case” a Tasker routine can do it. Also, another thing to considerate with this setup is Android’s memory management and to detect if your proot distro gets killed. But then again, maybe Tasker is good for that, too.
Good thing with this proot-distro thing is that it’s really easy and straightforward to set up, and basically you have a full Linux environment in your pocket. There are limitations, of course.
As for installing/flashing full Debian on an Android phone, let’s say it’s not possible. Your closest best bet would be Ubuntu Touch on a supported device.
First things first: you may be misunderstanding how phones run Linux. A stock Debian install certainly will not work for a number of reasons, but mainly drivers. Storage is second. Phones are flashed with specific images created to work with the storage in each specific phone.
Second: you’d need to make sure the bootloader on your phone is unlocked and able to be used for such a thing. Quick search shows that Ubuntu Touch did work on it at some point, but was deprecated long ago.
Third: if you just want practice, you can probably find packages to install on the phone that will run an HTTP server. That might be a simpler path.
I’m not saying don’t try, but you’d be starting from scratch, and if you aren’t familiar with these things already, I’m not sure this is a forum to get enough help on the VERY involved process of bootstrapping just a basic running kernel on your phone model. It probably can be done, but you’d be doing it from scratch it seems.
if they got lineageos on the device it’s already unlocked right?
anyway it seems supported decently enough by postmarketos, which is currently the best distro (imo) for Linux mobile
their site has install instructions (on the OnePlus 5 page that is linked)
anyway I wouldn’t use docker or anything, using nginx on bare metal to host a website is easy and extremely lightweight
Your best bet is probably PostmarketOS, its not debian but alpine, but does support the phone and aparrently still gets some updates.
Theres a link on the page to the non T variant with flashing instructions.
https://wiki.postmarketos.org/wiki/OnePlus_5T_(oneplus-dumpling)