NextCloud as a server on Android: possible?


Many people have “old” tablets or smart phones lying around on their desks, doing nothing more than attracting lots of dust. Still, many of these devices provide equal or even more CPU power than the Raspberry Pi, Aduino, or any other SOC, that are very often used as cheap and private NC servers.

Android devices provide wireless network, they bring their own UPS (their batteries), they don’t require any OS installation and no extra network setup. In other words: they are very much comparable to a Raspberry or similar device.

So: what about a NextCloud server as an app for Android devices?

Large files would still be very slow to synch, just like with the Raspberry. But if people just want to share contacts and calendars among several devices, such an app would be ideal to them: just one installation from the Android store, and you’re done!

Furthermore, if the Android device is powerful enough, it could act as an NC server and still be in every day use at the same time!

So, what do you think of this idea?

1 Like

You can install most server software on android, by using an app like “Linux Deploy” to install e.g. Debian on the device. Then you can connect to the device using ssh and install nextcloud. I would only recommend this for private networks though, as an old android device in the internet is no good idea…

A while ago I had Nextcloud running on an Android phone and documented a bit of it here:

Probably doesn’t work anymore exactly like that, but it might get you started :slight_smile:

Cloudy1: yes, of course you’re right about old Android devices and the internet. But my main idea was that you take a retired tablet, remove any app that is not needed, thus closing all unneeded ports, and then you install NextCloud to it. If the tablet is used inside your home network behind some firewall that will only pass port 443, I think it should not be much more insecure than a Raspberry.

Krishan: yes, that sounds pretty much like what I was searching for, thank you! :slight_smile:

I read about containers, but I have not yet used any. I know that there is even a complete NextCloud container for Linux, which consists of nginx, php, mysql, and of course NextCloud. Even LetsEncrypt is part of this container. If this container could be installed on an Android device, this could do the trick. If some one would write an Android app, that would install this container and configure it in one go, that would be the icing. :smiley:

Sadly Docker-containers can not be run with any of the GNU/Linux on Android solutions to my knowledge (or in general, judging from a quick google search).

Edit: seems promising to try (without Docker).





Where will it end.

how-to Nextcloud on Android

This is a working local cloud. I have just done this because

  1. I use NC for some time and wanted to know how the installation goes now a days. ( I am very amazed )
  2. see if it would run on unrooted Android 9

I Simply supply the steps i have taken. There are still errors in the admin overview but i’m so psyched I wanted to share this because it was SO easy.

You will need to setup the following package/programs ( LAMP Server )

  • Android Termux ( not the GooglePlay version )
  • Linux proot-distro
  • Apache
  • MySQL
  • PHP 7,4

Get Termux here

or install F-droid a alternative for Google Play Store

and search there for termux (terminal emulator)

open it when installation is finished. ( you need atleast 1 terminal open to keep nc running )

pkg upgrade;\
pkg install screen proot-distro -y;\
proot-distro install debian;\
proot-distro login debian

exit ( will close all proceses started in that shell )

Steps I took.

install apache ( here i include all packages needed )

apt update && apt upgrade && apt install wget apache2 php7.4 php7.4-zip php7.4-dom php7.4-gd php7.4-mbstring php7.4-curl php7.4-mysql php7.4-xmlwriter php7.4-xml php7.4-simplexml mariadb-server php7.4-intl php7.4-bcmath php7.4-imagick php7.4-opcache php7.4-gmp php7.4-apcu libmagickcore-6.q16-6-extra -y

adjust apache ports.conf change 80 to 8000 and 443 to 4443 because unrooted Android don’t allow usage of ports below 1024.

sed -i -e 's/80/8000/' -e 's/443/4443/' /etc/apache2/ports.conf

change 80 to 8000 in your 000-default.conf

sed -i -e 's/80/8000/' /etc/apache2/sites-available/000-default.conf

change 443 to 4443 in your default-ssl.conf

sed -i -e 's/443/4443/' /etc/apache2/sites-available/default-ssl.conf

here i started apache to check if that worked

service apache2 start

I didn’t have any php installed yet but got a apache default page @ http://localhost:8000

now since apache works I installed mariadb. It is included above so we continiou with.

service mariadb start

answer as you see fit. or as I did

  1. ENTER
  2. ENTER
  4. ENTER
  5. ENTER
  6. ENTER
  7. ENTER

Change the root password for MySQL user root

I went to looking for a zip to extract but found this setup script

wget -O /var/www/html/setup-nextcloud.php

while no php installed apache simply shows php as plain text. So I installed php7.4, because apache is installed it will also install those apachemod-php7.4

restarting apache to load the new modules

service apache2 restart

Now I got a nice Setup page @ http://localhost:8000/setup-nextcloud.php

If you want it accessible for other computers in your lan browse to http://local-IP:8000/setup-nextcloud.php

I have applied ssl later on still using the snakeoil so you have to accept ssl warnings.

after clicking NEXT I was presented a nice list of required php modules or missing so to say.

  1. zip
  2. dom
  3. GD
  4. xml Writer
  5. xml
  6. mb Multi Byte
  7. curl
  8. simplexml

only module mb Muli byte should be renamed to mbstring so it’s even easier for novice players to decode.

Since there all installed above you can simply continou on the setup fill in storage . (dot) remove the prefilled nextcloud. NEXT wait while nc is being downloaded and extracted. Page will reload when ready. ( 1 to 5 minutes )

fill in a new admin account for Nextcloud

select a data location outside the web root I used /srv/data

as database user fill in root

as password the password you created when finishing mysql_secure_installation

database as you like [nextcloud] if your creative

Install wait 2 to 3 min boem logged in local nextcloud. just like that.

solving errors

  1. data directory is accessible from the www
nano /var/www/html/config/config.php

change to or add

datadirectory' =. '/srv/data',
'memcache.local' => '\OC\Memcache\APCu',
'default_phone_region' => 'NL',

  1. missing php modules php7.4-bcmath php7.4-gmp php7.4-imagick php7.4-intl php7.4-apcu php7.4-opcache libmagickcore-6.q16-6-extra (included above)
  2. php memory below 512M minimum
sed -i -e 's/output_buffer = 4096/output_buffer = 0/' -e 's/memory_limit = 256M/memory_limit = 512M/' /etc/php/7.4/apache2/php.ini

  1. setting up ssl
a2enmod ssl
a2enmod rewrite
a2ensite default-ssl
<IfModule mod_ssl.c>
	<VirtualHost _default_:4443>
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html

<Directory /var/www/html/>
      Require all granted
      AllowOverride All
      Options FollowSymLinks MultiViews
 <IfModule mod_dav.c>
         Dav off

 <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
<IfModule mod_rewrite.c>
           RewriteEngine on
           RewriteRule ^/\.well-known/carddav remote.php/dav [R=301,L]
           RewriteRule ^/\.well-known/caldav remote.php/dav [R=301,L]
           RewriteRule ^/\.well-known/webfinger index.php/.well-known/webfinger [R=301,L]
           RewriteRule ^/\.well-known/nodeinfo index.php/.well-known/nodeinfo [R=301,L]

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		SSLEngine on.
  	SSLCertificateFile	/etc/ssl/certs/ssl-cert-snakeoil.pem
		SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

		<FilesMatch "\.(cgi|shtml|phtml|php)$">
				SSLOptions +StdEnvVars
		<Directory /usr/lib/cgi-bin>
				SSLOptions +StdEnvVars


if you gotten this far you know to change your config overwrite cli url accordingly

If you need a real certificate install certbot

  1. mail server. setup as normal. you may install sendmail. change port 25 to 2525 and 587 to 1587 or however you wish set mail server to sendmail with pipe (-t). you cannot send mail but nc thinks he can solves mail setting warning


The Goal was to see if Nextxloud would run on Unrooted Android. The verdict is It can.

Tho not suitable for production due to lack of permissions / security A rooted phone could work well as a Nextcloud Server.

10 minutes of software update / install. Installing LAMP on Android. Last 2 minutes setup mariadb

Final Steps setup-nextcloud.php

EDIT: added ssl / added imagick svg support