[EXPERIMENTAL] HowTo: Asus Tinker Board + NC Box

NextCloud on Asus Tinker Board Start to finish Guide EXPERIMINTAL

Guide by Greg Fordyce, most of this guide is a copy of a guide written by DrClaw22000 » Sun Sep 25, 2016 1:46 am
Original guide can be found here - https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=160874

First a little about myself. I don’t normally do write-ups but I have copied and adapted a guide to install Nextcloud on the Asus Tinker Board. This guide has the OS and Next Cloud running from the SD Card and uses the hard drive for storage. Hopefully it has all the protection needed to be safe to run and trust worthy, however I am by no stretch a Linux SuperUser. If anyone finds any issues in the guide or has ideas to make it better please feel free to contact me and I’ll do what I can to make it happen.

That being said I take no responsibility if you cause damage or have issues with your Tinker Board, NC Box or your data. Again this is a collection of info put in order for an easy smooth install.

Any real superuser feel free to make this a script and send it out should make the process much easier for people that way.

This is turn key. When you are done you will have a complete install with all the basic functions enabled and ready.

This tutorial uses the following files and versions. I did the best I could to make sure I worked with everything as up to date at possible at the time of this writing. (Make it a total pain to complete.) If done correctly you can have one up if a couple hours instead of days like to took me.

TinkerOS(raspbian-jessie)/NextCloud 11.0.1/PHP7/Apache2/MariaBD version?

##A couple preinstall things you can do to make life easier later.
If your router supports static mapping via DHCP thats really handy. Otherwise you will have to set one up on the Tinker Board yourself. I will not go in to that on this tutorial. You will need a named address so you can get a SSL Cert I use www.duckdns.org make sure it points to your house . If you have a decent router it will support a client with them and keep that address point correct. If yours doesn’t support that you can always get a linux or windows client to do that for you. If you don’t have a computer that stays in all the time I would install it on the Tinker Board itself and the site has instructions to do so. Next if your router supports DNS Resolver/Forwarder set it up to forward all internal requests for the external Named site to point to the internal address. This solves Many problems with the Cert later. If your router doesn’t do these things check out http://dd-wrt.com/site/support/router-database and see if you can upgrade your router to a better OS.


Download the image and write it to your card. https://www.asus.com/uk/supportonly/TInker%20Board2GB/HelpDesk_Download/

(I assume if you are attempting this you know how to do that if not https://www.raspberrypi.org/documentation/installation/installing-images/README.md.)

Insert the SD in the Tinker Board. Hook up all the cables except power.

If you can have the external hard drive wiped of all partitions as we will create them in the tutorial. If not we can delete the partitions in linux (Just easier to use GPARTED -=Linux=- or diskpart -=windows=-).

On first boot you will need to have a screen, keyboard and mouse connected.
Open a terminal and update your system.

sudo apt update
sudo apt upgrade
sudo apt install cron
sudo apt install tesksel

Then install the ssh server on your system

sudo tasksel

My prefered editor is nano, this step optional.

sudo install nano

Setup all your main settings Keyboard/Timezone/Location ect. after a reboot you can make this a headless box if you like.

dpkg-reconfigure locales
dpkg-reconfigure tzdata

##Create partitions on NC Box hard drive.
I had previously used the supplied NC Box SD Card image with a RPi2. That created the following partition table.

Device     Boot   Start        End    Sectors   Size Id Type
/dev/sda1          2048    4196351    4194304     2G 82 Linux swap / Solaris
/dev/sda2       4196352 1953458175 1949261824 929.5G 83 Linux

I simply deleted data on /dev/sda2. If you like you can look at the instructions from the original guide linked to at the top of this article.

##Now we need to specify mount points for our data and swap partitions.

nano /etc/fstab

Paste the following into the file

/dev/sda2              /NCdata       ext4      defaults              1      1
/dev/sda1              swap          swap      defaults              0      0

now we need to reboot to load on the new drive.

shutdown -r now

Finally the default user and password is linaro/linaro. Change the password to something more secure. I also think it would be a good idea to disable root user and auto login but that is not covered by this guide at the moment.

If possible use the SSH Client to log in from a computer for the rest of this tutorial. If you can’t or prefer not to you can do all the work from with in the terminal but when writing the script you will have much more typing to do. Also if you can’t cut and paste the command in to the terminal you might not get the intended results.

once in lets get admin status with the following command

sudo su

You will need to log back in to the system with your SSH if the box still has a head watch for errors on start if something went wrong you will know pretty quickly. Otherwise the boot process is about 30 seconds.

once in the box regain root with this

sudo su

##Install Apache2

apt install apache2 -y

##Install PHP7
Run all of the following command in order

apt install -t stretch php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip -y

apt install php7.0-APC -y

apt install mysql-server php7.0-mysql -y

The above step will ask you to set a password, remeber this password, you will need it later to connect NC to the database.

a2enmod proxy_fcgi setenvif

a2enconf php7.0-fpm

service apache2 restart (original guide used reload instead of restart, I'm not sure it makes a difference)

apt install libxml2-dev php-zip php-dom php-xmlwriter php-xmlreader php-gd php-curl php-mbstring -y

a2enmod rewrite

service apache2 restart

apt install mariadb-server -y

The above step also asks you to create a password, I used the same one as the previous password.

cd /var/www/html

nano index.html

Add the following line to the top where “MY.NEXTCLOUD.NAMEDADDRESS.COM” should be the address you created earlier.

##install Nextcloud

cd /var/www/

wget https://download.nextcloud.com/server/releases/nextcloud-11.0.1.zip

unzip nextcloud-11.0.1.zip

rm nextcloud-11.0.1.zip

cd /home/linaro

nano permissions.sh

Paste in the following

printf "Creating possible missing Directories\n"
mkdir -p $ocpath/data
mkdir -p $ocpath/assets
mkdir -p $ocpath/updater
printf "chmod Files and Directories\n"
find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
printf "chown Directories\n"
chown -R ${rootuser}:${htgroup} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/assets/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} /NCdata/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
chown -R ${htuser}:${htgroup} /tmp
chmod +x ${ocpath}/occ
printf "chmod/chown .htaccess\n"
if [ -f ${ocpath}/.htaccess ]
chmod 0644 ${ocpath}/.htaccess
chown ${rootuser}:${htgroup} ${ocpath}/.htaccess

if [ -f ${ocpath}/data/.htaccess ]
 chmod 0644 ${ocpath}/data/.htaccess
 chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess

##make it a executable and run it

chmod +x permissions.sh

sudo ./permissions.sh

##Configure Apache2

cd /etc/apache2/sites-available

nano nextcloud.conf

##Paste in the following

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
 Options +FollowSymlinks
 AllowOverride All

<IfModule mod_dav.c>
 Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud


##Do the following commands

ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

a2enmod headers

a2enmod env

a2enmod dir

a2enmod mime

a2enmod ssl

service apache2 restart

##Setup the DataBase

mysql -u root -p

enter the following commands Where it says “PASSWORD” enter a password for the database to use DON’T FORGET IT well need it later.


CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'PASSWORD';

GRANT ALL PRIVILEGES ON nextcloud.* TO nextclouduser@localhost;


##Setup SSL

cd /etc

git clone https://github.com/letsencrypt/letsencrypt

cd letsencrypt

sudo ./letsencrypt-auto

The above command will eventually ask you for a domain name for your machine (YOURDOMAIN.duckdns.org for example) and email address.

crontab -e

Enter the following line at the bottom of the file

* 1 * * 1 /etc/certbot-auto renew --quiet

We need to setup a cron job for nextcloud so run the command

crontab -u www-data -e

Enter the following line at the bottom of the file.

*/15  *  *  *  * php -f /var/www/nextcloud/cron.php

(When you log into your nextcloud, go to the Admin>Server settings page and change the cron setting from AJAX to Cron to activate the above cron job.)

Now were ready to login to the server to generate the configfile we need to edit
open a browse and go to the named address you created earlier it should take you to your cloud.
Enter the name and password you will use as the site administrator
Change the Data Folder to the following


the data base info is as follows with PASSWORD being the password you used for the DataBase


##Enable Mem Cache

sudo nano /var/www/nextcloud/config/config.php

Near the bottom, before ); insert

'memcache.local' => '\OC\Memcache\APCu',

##Clean the disk from all the mess
apt-get clean

##Set File size limit

cd /var/www/nextcloud

nano .htaccess

find the line that says php_value upload_max_filesize 512M and the line below it that says php_value post_max_size 512M
Change both to the size you want if in Gigs use a G instead of the M

nano .user.ini

Find upload_max_filesize=512M and post_max_size=512M
Change these to the same size you used before and don’t forget to change to a G if in Gigs

##Now harden the box as much as I know how by preventing Man in the Middle Attacks

cd /etc/apache2

nano apache2.conf

at the bottom of the file add the following

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"


shutdown -r now

When it come back up go to your browser and login to go to app page choose productivity and pick documents, now go to admin then additional settings and setup to use the libreoffice (Top option at the time of this writing) click save and test

Done and Enjoy. Everything is all set and you can configure the rest to your liking on the site.

1 Like

I’ve just got this working tonight and will be testing over the next few weeks. I am hoping that the extra ram and higher spec cpu will give a good performance boost over a RPi3.

Hey, Thank you for this Guide! I saw a little mistake at the beginning fro the guide.

But it should be:
sudo apt install tasksel


Thanks you very much OP for the tutorial!

Someone who has installed NextCloud in a ThinkerBoard can say me how much speed can download & upload?

Thanks everyone!

1 Like