User Tools

Site Tools


Installing Nextcloud on Turris

Currently it works only on Turris Omnia

What is Nextcloud?

Nextcloud is an application that provides nice web frontend to enable you to store data on your own server. This data can be files, calendar, contacts, news feed, to-do lists and much more. Files and PIM data is accessible using standard protocols such as webdav or carddav and caldav. This will make it easy to setup your computers or phones to synchronize with your own server so that don't have to trust an external cloud provider with your personal data.

Why should you use Nextcloud?

  • Safe handling of all data types.
  • An open source solution, which you have fully under your own control.
  • Synchronization and sharing of data made easy.
  • Mobile desktop and web client.
  • Monitors changes and allows document workflow management.
  • A space for your calendar and contacts.
  • Safe private voice and video calls, shared screens.
  • Editing documents using an online office interface.
  • Generous support, integration and third-party extensions

Requirements

Please put some caution into selecting the memory you decide to use for your cloud. It doesn't make much sense to use Nextcloud with just the small flash memory already included in your router. In fact, excessive writing to this memory will lead to it getting worn out and damaged soon. To get the most out of Nextcloud, it’s best to get an external hard drive or mSATA disk if you have Turris Omnia. Another alternative is to use the NAS box from our Indiegogo campaign.

How to set up Nextcloud

Disk formatting

First of all, you need to connect the disk to your Turris Omnia and format it to ext4 via LuCI and SSH. Easiest way to do this is to get a USB hard drive and connect it to the USB port of your router – Turris Omnia has two of those. Then you need to format it to something reasonable as most drives come pre-formatted to NTFS, this manual tells how to format it to ext4. If you are using an mSATA, the only difference is that you will have to take off the cover and insert the disk into the right slot; the rest of this manual should work same as with the external hard drive.

The drive will probably automount by default once you connect it. Go to LuCI → System → Mount points and unmount it, by clicking Unmount as seen below. Make a note of which device it was. It should be something like /dev/sda1. Now connect to your router via SSH and use the command mkfs.ext4 /dev/sdx1 where “sdx1” is the name of your drive. This will destroy all data on the drive and prepare the disk to be used as storage, so please make sure that it really is the drive you want to format. Congratulations, you just wiped your drive clean!

Migrating data and mounting

Now it's time to transfer data to the disk and mount it. Disconnect the drive and reconnect it. It should again appear in LuCI as automounted, most probably in /tmp/run/mountd. Now we need to move existing data from your internal flash memory like LXC containers to that drive. Do this for example using mv /srv/* /tmp/run/mountd/your_mountpoint through SSH (you can check what you mount point is in LuCI). Before doing so, shut down your LXC containers and anything using data from /srv.

The last step in this part is to edit the autogenerated mount point in LuCI and make sure, that the destination mount point is set to /srv. Click Save & Apply and reboot you devise just to be sure. Now your disk should be automatically mounted in /srv before any of the services that might use it start. This is precisely what needs to be done before proceeding to the Nextcloud installation itself.

Installing Nextcloud

Nextcloud is already included in our repositories, so you can get it simply by installing the package nextcloud-install by issuing the following commands:

echo 'Install("nextcloud-install")' >> /etc/updater/conf.d/auto.lua
updater.sh

This will install all the required dependencies, the Nextcloud itself and a simple script to help you with the basic setup. Alternatively, you can install only the package nextcloud and set up everything by yourself. If you decide to use the setup-script for simplicity, just call the following command after installation is complete:

nextcloud_install

This script will create the Nextcloud database and add a user on the MariaDB server running on your router, enable it and enable php support in Lighttpd as well. It will also create an admin account on your new Nextcloud server. After it is finished, you should be able to access your Nextcloud instance by using an URL like http://your_router_lan_ip/nextcloud.”

Using Nextcloud

Now you can enable access to your Nextcloud from anywhere on the Internet. You can either use VPN, which can be set up really easily from our web interface Foris or you need to open up some ports in your firewall (static IP recommended). Second option would allow anybody – including attackers - to try to log in to your Nextcloud instance and if you don't change the Lighttpd configuration then even to LuCI and Foris. So, please don’t do that unless you are sure what you are doing.

Hooray and congratulations, you have set up your Nextcloud! Now go and have fun using it.