Installing on a chrooted Linux under Android?

Has anyone tried installing Nextcloud as a “pocket-server” on Android?

It could be quite nice to have an option to sync files, calendars etc. with various devices when in hotspot mode.

In theory it should work by installing a full Linux in a chroot container via linux deploy ( https://github.com/meefik/linuxdeploy ). However I tried it today and ran into various issues that mariadb wouldn’t find a socket and that php wasn’t being recognized by the running apache2 server etc.

Has anyone come across a good tutorial to get a full LAMP server running under such a system?

https://play.google.com/store/apps/details?id=com.andi.serverweb&hl=en_GB ?

https://play.google.com/store/apps/details?id=ua.naiksoftware.phprunner&hl=en_GB ?

Interesting though as the cheap amlogic & rk3288 tvboxes or even http://www.gearbest.com/tv-box-mini-pc/pp_362732.html

I would prefer an open-source solution :unamused:

I think it is?

https://bitbucket.org/esminis/server

Seems like it is missing the webserver/apache2 component.

I am trying with another chroot app now:


lets see if that works better.
Edit: ok, looks not bad so far, at least the php is working and mariadb also got a proper root password. I guess this should be workable :slight_smile:

Ran into a small issue with php5-curl, but this did the trick:

Yeah the only bit that you might hit a cul-de-sac is Collobora & docker.

We are sort of on parallel paths as I think it would be great to Hotspot as you say and share with nextcloud on any mobile device.

I have a Beelink GT1 (Amlogic S912) and I am trying to get my head round turning it into a server and running https://www.armbian.com/ and doing pretty much the same as you but cutting the resource usage of Android.
Its actually got far more oomf than a PI 3 but it looks like it may be a bit of a head scratcher.

Might turn into tutorial how to brick a GT1 :slight_smile:

If you can do it your way, even with the resource hit of Android, it might be preferable as at a first glance its looking far from simple my way.

PS for any PI fans Downloads · Docker Pirates ARMed with explosive stuff seem to have the docker side sorted.
Also Docker comes to Raspberry Pi - Raspberry Pi but for others might be a struggle.

Ok, got it to work with the above methode on my x86 Zenphone2. Speed could be better, but Nextcloud11 seems to work fine, including calendar and tasks apps etc.

New I just need to set up my devices to sync nicely :slight_smile:

Edit: Ok it seems like the apache2 and msqld services are automatically stopped after a while of inactivity and have to be re-started manually. I am still trying to figure a convenient way to do so, but at least it will not drain the battery unnecessarily by default.

1 Like

You can make the apache2 and mariadb services autostart by adding a “.bashrc” file into the home directory (there is only one root user by default) with the following content:

service mysql start
service apache2 start

then each time you open the GNUroot terminal it will attempt to start the webserver and database (if it isn’t already running).

Note that due to a specific issue of the non-root installation the standard web port is not 80, but 2080, thus if you for example want to access the nextcloud webinterface via the android browser, type for example “http://127.0.0.1:2080/nextcloud” into the URL bar.

Edit:Very convenient is that Android always uses the same 192.168.43.1 IP when running it hotspot mode. So I can connect all my various devices to my shared 4G connection and use Nextcloud sync the same time via 192.168.43.1:2080/nextcloud

I hope this is interesting for others as well, as I think such a “pocket_cloud” is a really cool use-case for Nextcloud :wink:

So as an update on what I have been improving:

  1. This soft-keyboard really helps in using a terminal
    https://f-droid.org/repository/browse/?fdfilter=anysoft&fdid=com.anysoftkeyboard.languagepack.SSH

  2. This guide will show you how to get php7 running on Debian Jessie, which should speed up things a bit:
    https://www.cyberciti.biz/faq/installing-php-7-on-debian-linux-8-jessie-wheezy-using-apt-get/
    (I hope a future version of GNUroot Debian will come with a newer version of Debian).

1 Like

Really interesting for me as the all-in-one Nextcloud-Nas-Kodi center is a such a good complement.
If your on android you have all the Android goodies as well.
I have been waiting for some of the newer 4gb Ram boxes and SBCs with a bit more Oooomf to come available, which they have.

I am going to be trying just that as soon as I can get my hands on a RK3399 box, thats the plan so thanks.

So thanks for the info and keep it coming :slight_smile:

Ok cool, glad I am not the only one interested in this :wink:

Some general nice use cases for the handset is installing:
https://f-droid.org/repository/browse/?fdfilter=opentasks&fdid=org.dmfs.tasks
https://f-droid.org/repository/browse/?fdfilter=davdroid&fdid=at.bitfire.davdroid
For syncing contacts, calendars and tasks (with the respecitve nextcloud apps installed).

You can also sync with the Nexcloud Android client of course ( https://f-droid.org/repository/browse/?fdfilter=nextcloud&fdid=com.nextcloud.client ) but note that it duplicates files if you make them available in offline mode.

As I don’t want to run the Debian server all the time and also prefer not to duplicate a lot of files via the Nextcloud app, I added an local external storage (via the external storage app) that links to a subfolder in the GNUroot home directory. This way I can easily access files in this folder from the Android file manager without starting the Debian chroot.

I think it could be quite common as the price of set-top boxes has fallen and performance has increased for a home scenario Nextcloud on Android could be common.

I will be doing it both ways or at least that is what I am planning as the current crop of new boxes and SBCs with 2 - 4gb and some of the bigger Arm processors are capable of either a sort of all in one home entertainment center / living thing and to be honest stuck for wordage.

But having all your files available by WiFi / Ethernet collabora available on the web, Nas and a media streamer and what is essentially a console for ÂŁ50 -ÂŁ100 for many might be an option.
Nextcloud seems a good fit for this.

Also the same unit as a server could well serve a small workgroup of up to about 10 users and also be Nas, in a Linux headless offering.
The days of x86 might actually dwindling.

So been looking at both and yeah I think there could be a lot of interest.

Dunno if this is any interest but Android apps from another angle.

Supports the RPi and I am thinking you could run LAMP / Nextcloud under the hood.

Not sure why you would want to use something other than vanilla Linux if you can?

The idea behind this post is to show how to run Nextcloud on systems that for various reasons can only run Android (and might not even be rootable) or at least devices that you might want to keep using Android on for dual use purpose (i.e. Smartphones).

No Android apps with vanilla linux, the above is a Linux desktop with Android app compatibility.

Hence why I said from another angle as rather than the chroot, LAMP could be native and also still have the App eco-sphere.

We differ slightly as you are phone based and I am looking more at the tv-box area but the cross over is Android and apps.
With the TV-boxes its the apps I want and the OS could be any.

I am revisiting this with the idea of having an old Android phone as a home server now.
Seems like there is a new & better Android Chroot app:


(Supports Debian and Ubuntu18.04)

At first I wanted to go down the Docker route, but this is sadly not supported in non-rooted Android. But you can still do a lot of cool stuff with this :wink:

Does anyone know if this Nextcloud app for DynDNS works?

Otherwise I guess I could set it up similar to this way:
https://www.c-rieger.de/desec-dyndns-for-nextcloud/

In the end I never got it to work with UserLAnd.

For those interested there is also:

But I have not gotten around testing it.

Another option might be Termux: https://termux.com/

See also: https://parzibyte.me/blog/en/2019/04/28/install-apache-php-7-android-termux/

I’ve managed to run nextcloud on $30 tvBox (x96max+)

It is not the top speed …

Actually, if the x96max is one of those that recently got Armbian support (my x96mini has) than you might get a bit more speed out of it by running Gnu/Linux directly on it.