debian, linux, networking, nextcloud, raspberrypi

NextCloudPi, a ready to use NextCloud image for Raspberry Pi

I would like to introduce NextCloudPi, ready to use Raspbian 8 image with the latest Nextcloud 12.

NextCloudPi is an official NextCloud project as of 05-31-2017.

Features:

  • Raspbian 8 Jessie
  • Nextcloud 12
  • Apache 2.4.25, with HTTP2 enabled
  • PHP 7.0 (double the speed of PHP5!)
  • MariaDB 10
  • 4.9 Linux Kernel ( NEW 03-13-2017 )
  • nextcloudpi-config for easy setup ( RAM logs, USB drive and more )
  • Automatic redirection to HTTPS
  • ACPU PHP cache
  • PHP Zend OPcache enabled with file cache
  • HSTS
  • Cron jobs for Nextcloud
  • Sane configuration defaults
  • Secure

Extras:

Extras are not activated by default. Configure them with sudo nextcloudpi-config

NextCloudPi is now also available for the Raspberry Pi as an ARM docker container. ( NEW 06-08-2017 )

Get it

Please, if possible use and share the torrent to keep the hosting costs down.

NextCloudPi 12.0.0 torrent ( 668 MB )
md5sum a3adfb4dc194267046aa23cb7bebe347

NextCloudPi 12.0.0 magnet link ( 668 MB )
md5sum a3adfb4dc194267046aa23cb7bebe347

NextCloudPi 12.0.0 image ( 668 MB )
md5sum a3adfb4dc194267046aa23cb7bebe347

NextCloudPi 11.0.3 image( 612 MB )
md5sum a43266881091ce4a17eb46e6b74be75e

At this moment, the images do not provide a desktop environment, though it can be added through apt.

 

Please, report any issues here.

Please, before asking technical questions, look here if it has been asked before.

Use the official forums to ask questions, opinions and participate.

Installation

Follow the classic instructions to copy the image to an SD card.

Replace sdx  to your SD card device.

Windows users can install the image with Etcher as explained in this post.

Usage

Connectivity and basic setup

Upon first boot, you should do the usual, such as change the default Raspbian password, maybe configure the network connection, enlarge the partition with raspi-config , and enable SSH if you so desire.

If you are going to connect though a network cable, make sure it is plugged in before turning the Raspberry Pi on. If you are doing manual configuration of the network, such as setting up a static IP, reboot when you are done so that NextCloudPi can detect it.

You can connect to your home Wi-Fi through nextcloudpi-config

You can access your private Nextcloud just typing the IP or URL in the navigation bar of your browser. It will redirect you to the HTTPS site

The admin user is admin, and the default password is ownyourbits. Login to create users, change default password and other configurations.

Extras

You can activate and configure the system and any extras with

USB external drive

By default, your data will be kept in your SD card. You will probably want to connect an external USB drive to your Raspberry Pi in order to host your files.

First, you can enable the nc-automount feature. This will result in your drives being auto-mounted to /media

Then, set your Nextcloud data folder in the drive using nc-datadir.

Updating

Please, keep in mind that you will be exposing your own private data to the internet and you are the only person responsible for its security. Update your system frequently to get the latest security updates.

Upon login, you will be notified for new NextCloudPi updates

in order to upgrade to the latest version, type

Try it on QEMU first

You can try NextCloudPi first with qemu-pi.sh  from the last post

Apache logs for Nextcloud are located at /var/www/nextcloud/data/{access,error}.log .

Advanced configuration

In order to access your private cloud from the internet, you should setup a Dynamic DNS and open your ISP router 443 port for HTTPS access.

I use no-ip free plan for my DDNS. It is already included in the FULL version of NextCloudPi.

If you want to avoid the “Untrusted Certificate” warning and make everyone’s life easier, get a Let’s Encrypt signed certificate for your DNS domain through nextcloudpi-config .

You can explore some alternative ways of accessing your files in this post.

Again, type sudo nextcloudpi-config  to get everything set up. Follow the dedicated posts on this blog for details on each entry.

Details

Nextcloud is awesome. It allows us to own and control our information without relying on external companies. These companies could change things outside of our control or even shut down the service and we realize only too late that we do not own the software that we use. Nextcloud is certainly a huge tool to protect our privacy and our data.

The big issue though is that it is a web service, so it needs to run on top of an operating system. Setting that up implies long hours of installation, dealing with package versions, configuration and troubleshooting. Many people are not willing or do not have the knowledge to accomplish this task, and I think it is a big reason why it is not that popular outside of the geek niche.

I thought it would help to facilitate already configured images to the public with Nextcloud included, so I automated the process. Let’s go for it!

In the last post we learned how to use qemu-pi.sh  to launch Raspbian on a QEMU virtual machine. We will use this to automatically generate a Raspbian image with Nextcloud 12 installed.

I recommend to setup qemu-pi.sh  to use a static MAC address so you can always get the same IP through DHCP after each reboot. This is important to automate the process, and for that reason it comes as the default configuration.

Write down the IP that your Raspbian gets from DHCP, and launch

This will get the code from github, and

  • Download latest Raspbian image.
  • Resize the partition.
  • Update the system.
  • Install Apache with HTTP2, PHP7, Mariadb and all that is needed to run Nextcloud.
  • Install Nextcloud.
  • Configure the system.

You can use your own image by setting DOWNLOAD=0 at the top of the script. You can also choose between Raspbian or Raspbian Lite by setting the IMG variable. See the code for details.

At the end of the process you end up with an image that you can write on an SD card and use on your Raspberry Pi.

The good thing about this method is that it is an automated process, so we can easily produce newer versions as Raspbian, Apache and Nextcloud receive updates.

Also note that you can change the following parameters at the top of install-nextcloud.sh

This was tested on Raspberry Pi 2 and Raspberry Pi 3.

Screenshots

The basic configuration and optimizations are already in place, so there are no warnings on the Admin section. We can see that we are using the recommended cron method.

Nextcloud main settings

Also, you can see the default maximum upload size to a sane value of 1G by default. PHP operations time out at one hour. This is important to allow for long uploads and downloads for big files or slow connections.

Other settings

In order to test that you are using HTTP2, look for X-Firefox-Spdy: h2  in the network tab.

HTTP2 test

PHP configuration

PHP Zend OPCache Settings
PHP ACPU settings

If you have ever manually configured a Nextcloud instance, the auto-configuration parameters by default are equivalent to this

Nextcloud default configuration

Code

github

References

https://docs.nextcloud.com/server/11/admin_manual/contents.html

https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=160874

Raspbian on QEMU with network access

 

Author: nachoparker

Humbly sharing things that I find useful [ github dockerhub ]

279 Comments on “NextCloudPi, a ready to use NextCloud image for Raspberry Pi

  1. Hey I’m trying to run this locally and I keep getting “invalid certificate.” It seems to be forcing all traffic through 443. Is there any way I can make it so http traffic is allowed? Or maybe I could have valid certs for local traffic somehow? While I’m messing with it I’d rather be able to make sure everything is secure and set up before opening it up to the world and I can get it a domain name.

    1. [EDIT] nextcloudpi-config now has an option to disable forcing HTTPS

      I like having secure defaults. If you are only going to use it in your local network it is not such a big deal, but make sure to go back to HTTPS one you have your public domain.

      In any case, even if you have HTTPS with an untrusted certificate, you can just add an exception on your browser. When you have your domain, follow the instructions for Let’s Encrypt on the “advanced configuration” section to get trusted HTTPS

  2. After running:


    I receive this error:

    Data directory (/mnt/Store/ncdata) is invalid
    Please check that the data directory contains a file “.ocdata” in its root.

    1. I just re-checked it and it works for me. Are you sure that the directory exists? Make sure to modify your fstab to mount your USB hard drive on every boot.

      I included the mkdir line in the instructions to make sure that the directory is created if it does not exist (/mnt/Store in your case).

      If we do not do this step, it works fine but everything stays on the SD card which is more limited in space.

      Write the image again on the SD card, then set up the USB drive mount to /mnt/Store, then copy and paste the instructions again. It should work

      1. Don’t know what happened on the first run. Started from scratch, mounted USB drive, and ran the lines, all good now. Raspi sitting next to the router attached to an old 2TB drive for Nextcloud with the data being rsynced to raid array. Cheers!

  3. I love the simplicity of this for newbie’s. I have very thing working well, except the virtual host. I am unsure as to which file I should be adding the lines to.

    need a pointer

    1. Thank you for your feedback

      My intention is that this is as easy to setup as possible, so I will simplify this for the next release, expected to come out tomorrow

      If you do not want to start from zero again, paste this on the command line

      There is information about virtual hosts here

      https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
      https://httpd.apache.org/docs/2.4/vhosts/examples.html

  4. Hi Nachoparker,

    I tried the method you described above for transferring the nextcloud data directory to an external USB drive, but there is still a problem, here is the listing of my try. Note that my nextcloud data directory is in /var/nextcloud/data.


    Any suggestions? Note that my USB drive is mounted at /mnt/nextcloud/…
    Thanks

    1. you are using /var/nextcloud. If you used my image you should be using /var/www/nextcloud. You have to be on the nextcloud installation folder for this line to work

      1. I have not installed nextcloud from your distribution, so you don’t have to answer. In any case my nextcloud works perfectly well as long as the data directory is on the sd card. It sits at /var/nextcloud/data on the sd card. The problem is how to tell nextcloud that the data directory should now be at /mnt/nextcloud/data which sits on an external USB drive… Thanks

        1. Ok, I see

          Then it should be just a matter of doing

          another way of doing the same thing would be to edit /var/nextcloud/config/config.php and changing the line of datadirectory

        2. Thanks for your help. Alas I had already done it both ways exactly as you describe. I think the problem is that the config.php file on my installation sits at /var/www/html/nextcloud/config, not in /var/nextcloud.

          As I said everything works fine if all is on the sd card, specifically data in /var/nextcloud/data and the config.php file in /var/www/html/nextcloud/config, again on the sd card. The reason the data directory was moved to /var/nextcloud comes from a suggestion that this is more secure… Here is theexplanation and the URL follows

          Secure the Nextcloud Data Directory

          It is highly recommended to make Nextcloud more secure by moving the “data” directory to a secure location. Let’s move it to /var/owncloud/data. That will prevent any unauthorized users from accidentally gaining access through the web browser.

          Move the data directory:
          $ sudo mkdir -p /var/nextcloud
          $ sudo mv -v /var/www/html/nextcloud/data /var/nextcloud/data

          Configure the new data location into Nextcloud. Using vi or another editor of your choice, edit the configuration file. Make a backup copy first, just in case there is a mistake with the edit:

          $ cd /var/www/html/nextcloud/config
          $ sudo cp -p config.php config.php.org
          $ sudo vi config.php

          Change this line:

          ‘datadirectory’ => ‘/var/www/html/nextcloud/data’,
          to this:

          ‘datadirectory’ => ‘/var/nextcloud/data’,
          Be careful not to delete the comma at the end of the line. Save the file and exit the editor.

          http://unixetc.co.uk/2016/11/20/simple-nextcloud-installation-on-raspberry-pi/

          Many thanks

  5. Very nice! Thanks for the work! One question, in what file would I add the


    to redirect?

    1. See the answer to lstehr question above.

      I am uploading the new version right now anyway (2-18-17), so if you copy the new one to the SD card you won’t have to do that.

      In the new version, you access nextcloud by typing the IP or URL in the browser, do not need to specify https://, nor include /nextcloud

    1. The image is built to be run on the Raspberry Pi, so you can copy it from windows or linux, it does not matter.

      I do not use Windows myself, so I cannot recommend you a solution. Maybe another reader can, or maybe Google can help you 😉

      EDIT: added etcher as a recommendation to the post

  6. First, thanks a lot for publishing this great piece of work!

    I used to set up owncloud myself on a raspberry pi, but it was always hard and time-consuming to set up and maintain. Now I consider using your nextcloud image. I have one question:

    How will updating work? In particular, how to keep nextcloud up to date? Will it update with the usual apt-get upgrade?

    1. Hello, you are very welcome 🙂

      Well, if you look at the installation code I basically take the latest files from Nextcloud, so the installation is manual.

      As per the official docs,

      https://docs.nextcloud.com/server/11/admin_manual/maintenance/upgrade.html

      There are two options
      1) “Updater” app, which is a Nextcloud App. I have not tried this yet but I will try it first thing when NC 12 comes out. I will let you guys know how it goes if you follow the blog.
      2) Manual upgrade, using

      3) I will continue releasing images, so when NC 12 comes out I will release another ready to copy image. If your data folder and database are on an external USB drive that could be relatively easy(or not).

      There is no raspbian package for Nextcloud that you can apt-get install as far as I know.

      Nextcloud’s weakest point is probably upgrading. Not an easy process for sure.

      I hope this all makes sense.

      1. Thanks for the swift clarification! Yes, this all makes sense. If the updater app works as expected, it will be great improvement over previous (owncloud) versions. Let’s hope for the best 😉

        Again: thanks for sharing!

        1. Update:

          a new minor release came out. In my first test using the updater app, there are a couple things to adjust for this to work out of the box.

          I will get them fixed for the upcoming release

          🙂

          Update: it works on the latest release

  7. Thank you!!!!!!!!!!!!!!!

    The easiest tutorial for installing nextcloud on raspberrypi using https in the net.

    And (a little detail) it works!

  8. Hello! I am a total noob at all this stuff. I used your image and for the most part it is OK. I can’t seem to change the max file upload and download size. How do I do that? Thanks!

    1. [EDIT: nextcloudpi-config can now configure this with the nc-limits option

      in the files /var/www/nextcloud/.user.ini and /var/www/nextcloud/.htaccess

      you can use the following piece of code. Paste in the terminal

      I have not tested more than 2GB

      1. Hmmmm. I must be doing something wrong. Still not allowed to change it in next cloud and it is stuck at 1GB.

        1. Ok, I spotted the problem. There was a typo in my build scripts that I even copy-pasted to you without noticing. The right command is

          Any way, I am currently including this in nextcloudpi-config for the next release. It will be easier that way for everyone

      1. Yes…I did both those things. But when I enter your commands it seems to make that dir on the micro SD card. The drive is auto mounting. but I am not super clear on what steps to check to force it to use the the drive on sda2. Thanks so much!

        1. Here is what it says:

        2. Okay, I can see that your drive is mounted at /home/pi/RAID1

          Suppose you want to use the folder ncdata inside your hard drive. This folder does not exist yet. Paste the following

          Then, your private cloud data will be in the ncdata folder inside your external drive.

          I will also make this easier in the next release

  9. I’ve done it the other way around I installed the image without fail2ban and it worked for me. Trying to setup fail2ban but I’m missing something and not sure what I’m doing wrong so I’ll wait for this new image to save me the headaches.

    Great work by the way. 🙂

    1. Well… it does… 😉

      Very nicely done. And quite fast, too. I wonder, if I could just replace my old setup with this one. However, my current installation is setup against LDAP and also hosts its data and database on a different server. I think, I should be fine by just copying over the config.php.

      Again, great piece of work!

  10. I want to use this for my Pi zero W that came yesterday. After writing the image to the SD card, putting a ssh.txt file to the root of the SD card in order for ssh access and after mounting the written SD card and altering /etc/network/interfaces before booting up the pi so that it uses the correct wlan connections and settings i cannot get a ssh connection to the pi. i also do not see it when using a dhcp scanner. does this image work on the pi zero w? the process of ssh.txt and interface file editing does work with the original image of rasbpian.

    1. Hello,
      I have not tested this with a Raspberry Pi Zero or an original Raspberry Pi, but it should work. It will be quite slow though. I was running Owncloud on my RPi B before RPi 2 came out and it was usable… but very slow. The zero has a bit more power.
      I will test it on zero when I have time. Also any feedback is welcome.
      To answer to your questions… the procedure for activating SSH with the ssh.txt file should work (see https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/ ).
      From the top of my head, in order to get network access you can edit /etc/dhcpcd.conf, and include something like this

      It should come up as 192.168.0.8. I am writing this without testing it, just a pointer 🙂

      1. I will try this, thanks! Will report back if it works. I did not think of altering the dhcpd.conf but instead changed the entries in the /etc/network/interfaces file. Maybe that is why i do not get a connection (and this would explain the non working ssh also)

  11. So. your image does boot up on my pi zero w, but it won’t bring up wlan0. I guess there is a driver problem. Is your image based on Debian 9 stretch instead of the current stable branch? I booted up Debian 8 jessie on my zero w and wlan worked without problems, but as soon as i upgraded to stretch testing branch, the wlan also broke there. So I guess it is not a problem with your image in particular, but with Debian 9 stretch branch as for now. As the wlan chip on the zero w an the rpi 3 B are the same, the problem should occur on the rpi 3 also though. Anyone can confirm that or can anyone provide a solution?

    1. Debian 8 based, a release from Feb (about to release an update though)

      I have not had the opportunity to get my hands on a zero w yet, but what you say makes sense: same chip, so should work just the same.

      What is the output of ip link and iw dev wlan0 info and ethtool -i wlan0?

      (need to sudo apt-get ethtool)

      1. Fixed it! Copied the contents of /firmware/bcm…. directoy of a backup of jessie to the directory in stretch and overwrote the files there. now wlan works again. so this is a thing if one upgrades to stretch. Next thing to try is to copy these backup files to your image and see if that also fixes wlan in your image for my zero w.

  12. Can’t get your image to work correctly with the zero w. It does not bring up wlan0 at boot, always says “device not found” or “there is no such device”. I guess the wlan-driver is not loaded at all or can’t be loaded. Maybe this has something to do with the kernel in your image? I already installed the firmware for the wifi-chip (same as rpi3) and also copied over existing files in /firmware/brcm to the zero w from an original raspbian 8 image to your image (on the original raspbian image, the zero w works with wifi). still no success. Did you change the kernel in your image?

    Btw: These are the drivers that are used for the wlan/BT chip on the rpi3/zero w:

    https://packages.debian.org/jessie/kernel/firmware-brcm80211

  13. Hello,

    I have a single RPI3 that I use as a multimedia center with OSMC, and would like to have Nextcloud on it too. Do you think you will do in the future an image based on OSMC instead of Raspbian lite, or do you have some pointers on how can I do it myself?

    Thanks!

    1. I do not think I will create an image based on OMSC, but I do publish the code for building and configuring Nextcloud. If you follow the instructions above, you can install NexCloud on you any Raspbian based image!

  14. Why not Nginx ? It seems that Nginx , especially for small device’s like the PI is more suited.

    I’s searching all over the net to find a good tutorial “how to:

    raspbian lite
    mariadb
    Nginx
    Letsencrypt
    php7

    and so on,,, Your write up is very close, but lack’s Nginx
    Would love to see the “perfect” tutorial for a nextcloud installation that can be used live with a hostname for example https://nextcloud.mydomain.com

    1. Well, nginx really shines in high load high concurrency situations. In this case you will not see a difference.

      I chose apache because it is what I was already using, and because it had easier support for HTTP2 at the time. If you really want to use nginx, just follow the rest of the building script. I share all the code.

      In any case, I have many plans for this blog. I already am starting to build some dockers that I plan to use on RPi. Nginx included. I want to experiment with lighttpd to see if I can make it work with Nextcloud, if you pull the container you will see that it is only 67.8 MB, so about a 10 MB increment from minidebian!

      Also, Let’s Encrypt is the next thing I am going to include in nextcloudpi-config

      Stay tuned!

      https://ownyourbits.com/2017/02/19/creating-a-minimal-debian-container-for-docker/

      1. Hi men!
        Great guide and well scripted.
        I have a question about the HTTP2 mod on the latest raspbian Pi3. When I try to install the HTTP2 module on the lastest apache from the default disto I get the following error message:

        sudo a2enmod http2
        ERROR: Module http2 does not exist!

        How did you solve this problem?

        Cheers!

  15. Thanks, awesome work!

    I came across your site by accident, I was looking for something to lets say pre-configure an image like Raspbian or whatever. All this so I would be able any time to replicate my current setup just in case something goes wrong.

    I’ve look at Nextcloud before, among numerous other possible solutions, such that I could access my PI from anywhere and show off photos of my little girl on whatever system. Like you I’ve got myself a domain name from no-ip.com and my router provides an auto update feature for noip, easy. After a zillion tries, I found setting for my monitor that works fine so I burn the image from my WIN 10 PC and replace the config.txt file with my version. Unfortunately for me, I decided to use the BTRFS file system for my 5T USB drive and I intend to get a few more. Anyway, all this to say I’m beginning to have memory problems and I want to setup a quasi fail safe system with redundancy, security and the works. At minimum, 2 PI3 in 2 distinct location and 2 large USB drive (BTRFS) each. Currently I’m setup to boot from a micro-SD card but the root file system is on a USB flash drive (EXT4). I want to be able to rebuild any part of the system as easily as possible.

    Your image file will definitely bring me very close to what I want. I see you provide indications and or snippets for many different options or solutions. For example with LetsEncrypt, I’ll use that one for sure. Just to give another example, I don’t want any of my users to be login all day long idle most of the time so I want to shut them down after some period. It’s not very complicated to do but every time you burn an image you have to start over from scratch. It’s prone to error, it’s very likely you’ll forget this or that and I’m sure you see me coming.

    Does your image provide and or would be easily adapted to self update as much as possible? I mean security wise at minimum? I’d like your advise also on how you would proceed to create a snapshot of the system such that I could (relatively) easily recover from some device failure, be it the PI itself, the card or the USB drives. Yes, it’s possible I’ll never use a micro-SD again and I’ll also go all the way with the BTRFS.

    Thanks again, I’m burning the image as we speak…
    Yves

    1. well, thanks!

      I am busy right now, so I’ll answer in detail tomorrow ( it’s late here )

      Just wanted to say that 10 minutes ago I released a new image with some improvements. Burn that one instead 😉

  16. I’m glad I tried it and it work fined until I used this code to use :

    I have install letsencrypt certs and dnsmasq as explained above and all seems to work fine, except that the nc data directory doesn’t work now.

    Any idea why?

  17. I tried again one line at a time and here is the result:

  18. After using the full img and using raspi-config to get a desktop after installing lightdm. There is no possibility to log in with the user pi. Wether you’ve changed the passwd or not

    1. Your issue is a Raspbian Lite issue, so I cannot help you right now. When I have time I will include the steps to get a desktop environment, but as of now that is out of scope.

      I suggest you look for the correct procedure to install and start a desktop environment in Raspbian Lite, as it ships without one.

  19. I’d like to add some observation and comments if I may, hopefully constructive.

    Yesterday, I burn the full image using win32diskimager, booted up the new image and then ran raspi-config to setup a few things, password, etc.

    All of this directly from PI but through SSH. When I came to the nextcloudpi-config part above (usage) the only choice I add where dns-masq and no-ip scripts. Why not the same as we see above?

    I notice you practically always refer to QEMU and if I’m not mistaking this mean one need another machine with some linux distro, right?

    Just when I installed the 2-18-17 version you where uploading behind the scene the 3-13-17 version and unless I mist something really big this would mean all of us would have to start over from scratch, yes?

    This is one of the reason I was searching for some mean to at minimum be assisted in some way to install and especially configure the packages and or services one need, by this I mean passwords (so your first login is with the proper password), the services I want to run like say ssh +++ setting it properly, everyone agrees, passwords is not a good idea so why not configure it right away for public key or at least having the choice. Maybe, yes password login but setup firewall for ssh over LAN only. One last thing, IMHO I don’t think most people will stay on a SD card file system for very long, a single video would bust most of the available space from the start. Why not have the possibility to set this up before installing nextcloud and even the complete web server for that matter. By this, either use an existing drive or drives, format it if necessary and set it up in fstab. Then go one.

    You obviously put a lot of effort into this and I don’t want you to think I don’t appreciate your work. I also know the one size fits all theory doesn’t work either but I recall some 40 years back when I installed my Redhat distribution on my my super duper Intel 386 with 256K + 256K ext of memory. All of these thing I speak above (almost) where part of the installation process, so why not have the same or similar for the PI. I almost forgot, that included setting locale, time zone, keyboard and many other stuff before your first login.

    I’m curious as well if it would be possible to “UPGRADE” instead of starting over each time you produce a new version? I know, much more work, just some thought.

    Thanks a million,
    Yves

    PS. I don’t see a donation button anywhere here. Ounce I’m all setup and running I would certainly give something. I would go as far as proposing my help for translating stuff in French if it’s any help for others here.

    1. Hello Yves,

      First, thank you for your encouraging words and feedback.

      You wrote about many things! so I’ll try to answer to things one by one.

      First, this is an ‘in progress’ project.

      It is already usable but I am not done yet, so there are things that might change over time. Feedback that people like you provide is really valuable for me to realize what is more important for people.

      The first reason I started to do this is that for the third time I want to upgrade from owncloud and it is such a pain that I decided I could do it in an automated way and share the result.

      Many people would use this but lack the knowledge or time to do it. NC is a great product but it needs an underlying system (such as Raspbian). I figured I could help spread it this way.

      I am kind of planning things as I go, and seeing what people’s response is. For instance, I realised that many people struggle with setting things up in Linux, and that is why I came up with nextcloudpi-config

      With this I mean to say (again) that this is still in a maturing process and that is why the old release did not contain everything in nextcloudpi-config.

      I do plan now to work on figuring out some easy way to upgrade the system so people’s clouds get the latest security updates. As for NextCloud, the latest release was fixed to allow for upgrading using the updater app from NC.

      I still do not know how I will do it exactly, but I have some ideas.

      The next things I have in mind are

      – auto-upgrade for security
      – let’s encrypt in nextcloudpi-config
      – automount USB drives

      When that is working I do not know if I will continue adding things or not. (suggestions welcome). This means that until then, things can change (improve) quite a bit from release to release. In any case, you do not need to start from scratch to get the latest thing, as you can use the installer.sh method to add my new things to your working image on a running RPi.

      I do not know if it makes sense. For example, imagine you are using the latest image, and then I come up with Let’s Encrypt and add it to my next release. You can always just add it to your working image without starting from zero by updating my git repo and running ./installer.sh letsencrypt.sh 192.168.0.130 (assuming that is your RPi IP).

      I’ll say that again because I want it to be clear for everyone.

      People that already are running NextCloudPi can just use installer.sh and keep adding the latest things to their running setup. There is no need to start over 🙂

      https://ownyourbits.com/2017/03/05/generic-software-installer-for-raspbian/

      You mention you had some problems moving the data folder. A bunch of people have come to me asking for help with this. Get the latest release. You can configure it from nextcloudpi-config. I have tested it in all cases I could think of, but of course if someone finds something just tell me.

      I do ask everyone to be patient. This all takes a lot of my time and I do my best to listen to what you say, but there is only so much time I can dedicate to this. I will get there, but not immediately.

      Talking about a data redundancy system I have a basic thing set up myself using raspberry pi and mirror USB drives. It is very basic, but I want to post about this at some point. I’ll make a post about this using rsync and brtfs, maybe write some little util. Again, when I am done wit Nextcloudpi

      QEMU is a virtual machine where I run Raspbian. I use it for testing and for building images (see my Raspbian on QEMU post). You do not need it for using Nextcloudpi on a Rasberry Pi.

      https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/

      I am really flattered about your offer to help and donate. I do not accept donations because I just write this blog to spread what I like and what I consider good for people from the field of technology, like owning and controlling your own private data. Just that. Many thanks anyway!!!

      Nacho

  20. Hi,

    I would add a step in your installation instructions to first unmount the disk, like this: sudo diskutil unmount /dev/sdx

    Otherwise you will receive a resource busy error message.

  21. Hi,

    I’m trying to connect an external USB drive to store my data. I have mounted the drive (ext4) under /mnt/nextcloud. Then I have changed my config. php file to point the datadirectory to that location.

    For /mnt/nextcloud I have changed the owner to www:data recursively. I have also changed the permissions recursively to 700.

    In the NextCloud UI, I’m getting a ‘Data directory (/mnt/nextcloud) not writable’ error message. Just to test, I have given the /mnt/nextcloud dir a 777 permission, but the error message is always there (note I restart Apache each time, just in case).

    I have no idea what could be wrong here. Can you help me with this?

  22. I am using this amazing piece of software on a RPi3. I observe high ongoin cpu load (>3) generated by php-fpm. What do I need to change in the configuration to lower the cpu load and have a more responsive setup?

    1. can you explain what you mean by high CPU load?

      If I use it non-stop changing dirs, loading content and such I cannot get php-fpm over 40% CPU in brief spikes. I can only saturate the system to 1.6 load average like this.

      During an upload, the apache process can take up to 50% of the CPU in my testing. Up to 70% during a download

      I consider all this normal. NC is pretty responsive to me.

      What is your setup? have you changed the data directory or made any other changes? what class is your SD card?

  23. Thanks for your Raspberry Pi image for Nextcloud. I really hope the next version Raspberry Pi supports USB 3. Currently, Raspberry Pi 3 only has USB 2, it makes me concern the I/O speed when installing Nextcloud on Raspberry Pi.

  24. Hi,

    Thank you for this image! I am trying to install the nextcloud app passman so i can replace lastpass. It won’t get past, and hangs when creating a new vault. I tried the passman demo and creating a new vault took 2 seconds. Is this a permission problem or something of the kind?, and how do i fix it?

    Thanks in advance!

    1. Hello,
      I have not tried that App but NextCloudPi is just a normal NextCloud, so it shouldn’t be different from other NextCloud installations.

      Do you have any extras installed or custom configurations? Did you activate modsecurity? I recommend to disable it whenever we are installing new apps or if we find something weird.

      It comes disabled by default

  25. When uploading anything over 2mb (i think) i get a error; request entity too large displayed in my browser.

    I tried;

    followed by a reboot but that didn’t fix it. ;/

    1. Hello,

      You do not need to use that code anymore. You can configure that in the nc-limits section of nextcloudpi-config

      Try from

      In any case, I have successfully uploaded big files, for instance, 500 MB. I have never seen that error before. I do not think it is related to the upload limits. In general you can upload things up to ~700 MB according to my testing.

      Again… did you enable modsecurity in nextcloudpi-config by any chance? Any configuration? Did you move the data dir to an external USB? how big is your SD card?

      Can you copy the exact error message or provide a screenshot?

      1. Yes, I have moved the NC data to /data/ncdata, afterward I changed the limits in the next cloud piecing it. The error happened and then I added the code I pasted above. I also have modsecurity installed. Where can I find the log?

        1. Thank you!!

          I just disabled modsecurity and both my problems are gone, i can upload according to the nextcloudpi-config settings and passman works.

          Damnit, sorry! Going to read your references on the subject cuz i feel like an idiot.

        2. haha I am glad it works

          modsecurity needs more testing as people install Apps, I need to refine the rules gradually and that is why it is marked as experimental.

          If anyone runs into an issue like this, it would be awesome that they explain what App they were trying to install or what operation they were trying to perform and failed, and post the contents of /var/log/apache2/modsec_audit.log

          https://github.com/nachoparker/nextcloud-raspbian-generator/issues

  26. Hi,
    I’ve just installed your image and I’m impressed with how it has gone.
    I am however having difficulty connecting to my wifi network, which is important to me.

    I’m using a new raspi 3 model b with an external self powered usb drive. I have static IP addresses set at my router, and the address for this mac address is 192.168.0.142
    Everything works fine until I use nc-wifi when I select ok to choose a network, no networks are found.

    My /etc/network/interfaces file looks like this:


    and ifconfig wlan section like this:


    The wifi was working fine when I tried a plain raspbian image, and the ethernet connection works fine now picking up the static address from the router.

    I’m stuck, how do I get the wifi to work?
    Colin

    1. when you go to nc-wifi, hit ‘P’ (for preferences) and in the box “wireless interface” type “wlan0”.

      Hit F10 to save, and then ‘R’ to scan

      I will automate that step on the next release

    1. [EDIT: this manual configuration is not necessary anymore, just use nc-automount in nextcloudpi-config]

      you have to set it up in /etc/fstab to mount at every boot.

      1) write the line in /etc/fstab
      2) type ‘sudo mount -a’

      It should now show up. Look up on google “fstab USB drive debian” and you’ll find tons of info.

      I will make this easier on upcoming releases

      1. i figured this out and mounted it to /media but how do i get around the permissions?
        i chmoded the mount dir to 775 and also changed ownership to pi but when i try to chdir or ls /media i get a permission denied.

  27. the “swapon -s” return
    Filename Type Size Used Priority
    /dev/sda1 partition 67108860 0 -1

    what shoud I put in the “nc-swapfile”? is it /dev/sda1?

    Thks

    1. Are you using NextCloudPi? if so, you must have changed it to use a partition as swap.

      The default is /var/swap and is a swapfile of ~100MB.

      In nc-swapfile, type something like /media/USBdrive/swapfile, not a partition like /dev/sda1.

      You should have a USB drive connected and mounted to /media/USBdrive first

  28. Did every thing to mount USB and chmod 770 but I get still an error moving the data and database directory to USB.

    what exactly the permission should be?

    1. moving the data directory only seems to work but still I could not find the directory for the new user that I created on the disk though the files show in web interface. The “admin” user and the files are on the disk.

      I have a 2nd pi that is connected to a hard disk. The data partition is NTFS. And here I got in to permission problem. I get “Please change the permissions to 0770 so that the directory cannot be listed by other users.”

      I have “UUID=F21841E01841A487 /media/nxtclud ntfs-3g nofail,uid=pi,gid=pi,umask=0770 0 0” in fstab.

  29. i got this error on my firefox but i can go through with ie by clicking on trused.

    Your connection is not secure

    The owner of XXX.XXX.X.XXX has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website.

    also when i tried connecting the nextcloud windows app and the pi it gives me this error. is it ok to tick trust this certificate anyway?
    "Cannot connect securely to XXX.XXX.X.XXX:

    The host name did not match any of the valid hosts for this certificate The certificate is self-signed, and untrusted

    with Certificate raspberrypi Organization: Unit: Country:

    can you explain the error received and possible action i should take? sorry just being paranoid

      1. the tutorial involves me getting a domain in no-ip right? for now i dont have intention on making my server online yet. is there a solution for just local offline?

        1. I am afraid not. Only if a certification authority (CA) verifies that your certificate is valid it can be trusted. That is why it is called third party authentication. You need internet access for the CA to verify that you are who you say you are in the certificate.

          In most cases, just accepting the warnings and adding the exceptions works fine. Most software I have seen allows for use of self-signed certificate.

          It works anyway, it is just that it warns you about that.

    1. well, I am considering including other DDNS clients, but the priority is very low. Other people have asked for duckdns and freemyip.

      I would have to run a poll or something to measure the interest.

      🙂

  30. thx 4 the quick request. I have think its only a small quick change in a script. but it looks like its more.no problem.
    I also want thanks for your great job. in the moment i let it run on a RPi3. In next time i get the Nextcloudbox and than i put it there. I saw here also a tut how to bind external hdd. If i have problems i think i can ask there.
    cYu

  31. Hello,
    here some really noobs question
    1. I get next time the Nextcloudbox. So i want to install the NextCloudPi on the card.But i want the accounts and data transfer to the hdd.Maybe after a new installation i have all my data back (Useraccounts and Data are not deleted). Have somebody something like a step by step tutorial how to make this ? I saw the post from Marck Buckmann, but i think this is only to store the data on the hdd, not the accounts. If everything work like i want, what i need to do after a fresh install of the SD ?
    2. I read to change the passwords. OK. pi/raspberry on the pi and admin/ownyourbits in the browser. Do i need change more passwords somewhere ?
    Again, i really happy about your project and the most things are really easy to make.Great great job and support of you.
    cYu

      1. You can export news(.opml), contacts(.vcf) and calendar/tasks(.ics) and then re-import them.

        I do not think you can export the users though.

        You can also change the database password if you want, but you also have to change it in /var/www/nextcloud/config/config.php

        The external drive allows you to use a HDD that appears as a special folder inside your data directory.

        The difference with nc-data is that you move all of your data directory to the USB drive

        1. Hello,
          i think that is what i mean
          “The difference with nc-data is that you move all of your data directory to the USB drive”
          After a new installation of th Card i only need to bind the folder on the hdd and everything is like before.Or?
          cYu

  32. Thanks a million for providing us with NextCloudPi. It’s great work, and we very much appreciate your effort. Thank you!

  33. Hello! That you for putting this together. Although I am having some issues with the Let’s Encrypt piece, I HAVE had the overall server up and running for about a month, now, and there haven’t been any issues. Keep up the good work!

  34. Thanks for this ready to go .img (so easy to install nextcloud now since I had problems doing it myself, with community tutorials hehe)

    I have problems using an external usb, I tell you what I did:

    In Nextcloud I added the external drive “/media/usbstick” and it shows up green and accesible but it says [You don’t have permission to upload or create files here] 🙁

    I would like to use it as a usb stick to plug and unplug when I want to get files from there.
    Also will be great if it can auto detect when I plug but first part for me is to be able to write or read in it 😀 thank you in advance for any help here.

    1. Automount is the next thing on the roadmap of features

      NextCloud from the point of view of your system is the user www-data. You need to make sure that www-data has permissions to write/read/access that folder

      Investigate the options to mount vfat, such as umask.

      1. Thank you, I’ve found how to, and learnt about umask and chmod/chown options, if anyone looks for this: I’ve set 755 permissions to the mountpoint folder for the nextcloud user www-data, remember to give it also in the fstab with umask:0002 for the automont.

        I havn’t tried to unplug the usb while Nextcloud is active, but will be nice to know if I can plug and unplug as much as I need to while the raspi stills powered on with Nextcloud running and if it won’t break my FS.
        For now I’m doing sudo shutdown -h now and then poweroff the raspi for unpluging the usb

        Now I’m also trying the encryption module, It works great, it doesn’t secure the filenames.

        1. awesome, good job

          for safely unmounting, you would have to sudo umount /media/USBdrive (or whatever is the mount point). It will fail if you are using any file at that moment.

          what is the encryption module? some NextCloud app?

  35. every thing is working good. But 16GB SDcard on my pi2 gets quickly filled up though I migrated data and database folders to hard-disk. Checked the file system to see where all the card space is gone and there is a 13.5 GB taken by /var/log/. Is that normal?

    1. wow, that is not normal at all.

      Did you install any extra software?

      Let’s see, what is the output of the following command

      find /var/log | while read f; do du -s $f; done | sort -nr

      1. It doesn’t let me Reply to your question again so I quote you here.

        nachoparker says: what is the encryption module? some NextCloud app?

        The moudle (under applications) :
        Default encryption module 1.4.1
        por Bjoern Schiessle, Clark Tomlinson (Licencia AGPL)

        I tested it, works perfect, it is not too secure becouse you can still see the thumbnails created from gallery previews in the thumbnails folder (the community knows and is trying to fix it, for now you have to disable thumbnails)

  36. Noob question. I’m new to linux, so I’m new to setting up fstab or auto mounting/ etc. I have the nextcloud Box setup w/ Pi 3. For nextcloudPi, do I need to- 1.) setup nextcloudPi via its SD card– 2.) fstab? or format? or mount? The WD Labs PiDrive? Any pointers or links to a step by step tutorial would be greatly appreciated. Please & Thanks You.

    1. Actually my recommendation is that you wait for two days until I finish the automount feature. I keep answering this common question, so I think it is better to make it easier for users. I am almost done.
      You can also browse the comments above.

      Now
      1) setup stuff through nextcloudpi-config
      2) format to ext4 the HDD
      3) set it up in fstab

      In two days (hopefully)
      1) setup through nextcloudpi-config, including activating automount feature

      1. (Whining voice) “2 days is soooo long! I want one now!!” Just kidding, you put a lot of hard work in. For this I thank you. Maybe I can use that quemu program to learn w/o physically touching the Pi3. Or just do it to learn in “now” steps & erase SD card & format PiDrive w/ my pc in 2 days to test your new version.

        If this goes well, I can probably convince a few other people to do the same setup & finally dump Dropbox/google services/iCloud sync. (So, excited to do this!)

        1. awesome!!

          I do everything on the QEMU virtual machine, but I warn you that it is pretty slow.

          It is great though to try things out, break stuff and learn.

          For mounting an external USB though, you are probably better learning on a real system with USB 😉

          You can just erase the SD card over and over if you mess up. Just be carefull to sudo halt and unplug before removing the SD card, or it might get damaged.

          Good luck with that!

  37. My router supports DDNS with no -ip. Should I use that? Or is that complicating things & might mess up the lets encrypt step for SSL?

  38. Just a heads up. Today I couldn’t get my HDMI to work on first boot. So I tried to log in via SSH on my local lan, & was able to via default raspberry user credentials. I only use it to shut down (Sudo halt) the pie, until I can get a new hdmi monitor. Am I supposed to be able to log in ssh to pi on 1st boot?

      1. Interesting….using the version from- (3-13-2017), I was able to ssh in from a computer on my local LAN, on fresh first, first time putting an sd card in Pi3. I copied img using etcher, not sure if that matters. Also, I’m new to Linux, so I wasn’t sure if that is a default setting or not.
        Also, I plugged in a different HDMI monitor & now that’s how I’m going to do setup. I just wanted to pass along that info about ssh. I can send pics if you’d like.

        1. I am on vacation now so I have limited internet access.

          Thank you very much for the feedback and offering. That was a mistake in the construction of the image. It is fixed now for people that download the new image.
          Enjoy that cloud! It seems that you got it working
          🙂

    1. [EDIT: I recommend to use nc-backup before trying this. If it fails, just go back with nc-restore]

      I know, but that is not the issue with NextCloudPi because I ‘fixed’ the permissions. I created that issue to report it to them. (look, it is reported by nachoparker 🙂 )

      I fixed the permissions so you could upgrade from 11.0.1 to 11.0.2.

      BUT do not try to upgrade to 11.0.3 in any case, because when I tested it I discovered that it fails.

      I also reported this other bug to the NextCloud developers, as you can see here

      https://github.com/nextcloud/server/issues/4505

      If you already did and NC is broken for you, unfortunately, you will have to manually restore your backup (it is performed automatically during the upgrade process).

      Today I uploaded a fresh version of NextCloudPi with NC 11.0.3, but you would have to start over (recopy your files, re-import your calendars, etc)

      Sadly, it seems that the updater is not very stable. At this point I do not recommend it.

      1. The upgrade from 11.0.2 to 11.0.3 fails prior to the actual upgrade because of the permissions check. So NC is fine, it’s just still on 11.0.2. At this stage the only way out as I see it is to manually set the permissions back to sane values, which I do not see as a workaround in any of the pages I read. I’ll wait a little longer until the NC people sort it out. But, removing the hardening of permissions in the documentation isn’t going to solve the problem for those already stuck with the hardened permissions…

  39. How come i setup my pi, got wifi to work, everything works great, but i cannot get acces to the nextcloud part of it.

    It tells me its unsecure in chrome, though letsencrypt is setup properly.

    http error 500. 🙁

      1. Thanks for sharing. Once you had your dongle recognized by the raspberry pi… Did you try connecting through nc-wifi in nextcloudpi-config?

        That is the recommended method in NextCloudPi and it should be easier. If you had a problem with that please let me know

        1. I initially tried the nextcloudpi-config option to configure my wifi, but it would never accept my passphrase. The issue was that I needed to download and install the linux driver for my dongle, before it wanted to play right. Since I was at the command line, I just stayed there to configure the wireless dongle and the only problem I had after installing the driver is that the dongle would not be recognized after I rebooted my Pi. After some research I found that using the lsmod command along with modprobe, I was able to wake up my wireless dongle.

          The challenge was to figure out how to issue this command at start up. I just created a .sh script with
          modprobe 8188CUS

          made it executable and placed this script in my etc/init.d directory and I was good to go.

        2. I see, good job

          As long as it works for you that’s fine. If you want to learn further, a more standard approach is to configure the wifi module to start upon boot in /etc/modules.d or /etc/modprobe.d, depending on the distro .

          Then nextcloudpi-config or what you did wpa supplicant script on boot will make it connect on boot

          🙂

  40. Maybe i could PM you the adress for the box, i would gladly give you telnet-access.

    Actually it’s open right now, just give me a way of giving you the adress in private.

  41. The fact is that i cannot access it. It just gives me an blank page.

    Everything has been an success, though i’ve yet to try an usb-drive to the box, thats the next step.

    I’ve successfully managed to setup this on LAN cable, but its my first try on wifi, and it cannot work.

    I setup letsencrypt after i connected and had a working wifi connection.

  42. I’ve tried to set this up with my raspberry pi 3.
    The problem is that apache is reaaaaaally slow. I can hardly load nextcloud or anything else.
    Also, when I reload nextcloud (or anything else), the SSH session gets killed.
    Any ideas on this? I didn’t expect it to be so slow.

  43. If I want to start from scratch? I was just testing some things before. Are the steps to re-image my SD card & place back in Pi, then use fstab to mount my USB HDD? Then setup extras via nextcloudpi-config ?
    Thanks for your hard work NachoParker!!

    1. Yeah, just copy the image again and setup fstab, then reconfigure with nextxloudpi-config.
      after vacation I will include automount so the fstab step can be automatic

  44. Ok, I managed to fix the slow apache / ssh kill problem (it was the power supply).
    But I now have another big problem.
    I want the nextcloud data to be on my Synology NAS. I therefore mounted the share via CIFS in /etc/fstab, and it gets mounted without any error and nextcloud can read the data folder, BUT it cannot write or delete anything in there.
    So for example if I want to create a folder in Nextcloud I just get an error.
    It must be a permission problem, but I don’t know how to fix it.

    This is inside of /etc/fstab:
    //192.168.X.X/abc/xyz /mnt/xyz/ cifs defaults,owner,noauto,nofail,user=##,passwd=##,uid=33,gid=33,rw,noperm,x-systemd.automount,x-systemd.requires=network-online.target 0 0

    I set uid=33 and gid=33 so the files inside of the mounted folder are owned by www-data (so Apache can read it) but this “rw” for read/write doesn’t work. I also tried to set the permissions to 770 with “dir_mode” and “file_mode” but this didn’t change anything until I set ‘nounix’ aswell (then the files/folders are really 770), but then ls -l only shows some ???? at the mountpoint.

    NFS is not an option as my NAS uses different users than the PI for the http folders.
    Because of this, nextcloud doesn’t even write anything in the log (as it somehow doesn’t have the permission to write in it, strangely).
    Is it maybe an Apache problem? That it doesn’t grant the access?

    I would be so glad if anyone could help me solve my problem! Thank you so much!
    And thanks a lot for the image, nachoparker!

    1. I am on vacation now so I have limited internet access.

      Try to follow my post on samba or of tutorials.

      Make sure the folder has write permissions for 33 before mounting. Then mount with correct permissions and user 33. Set up the server with nextcoudpi-config

  45. After some effort I finally was able to get my Edimax wireless dongle to get recognized. I then needed to do some research on how to get it recognized after each reboot. I needed to do a modprobe command to get my dongle to wake up. So I created shell script and placed it in my init.d directory and everything is okay with wifi.

    When I first launch the browser on a Windows PC using my ip addresss/nextcloud I get this error message:

    “You are accessing the server from an untrusted domain.

    Please contact your administrator. If you are an administrator of this instance, configure the “trusted_domains” setting in config/config.php. An example configuration is provided in config/config.sample.php.
    Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain.”

    Do I need to run each option in the nextcloud config option before I can expect to have a functional Cloud service on my Raspberry Pi? As things stand now I can’t login to my nextcloud server due to the error above. I know this is supposed to make things easier on inexperienced users which I would include myself, but I’m stuck in the mud right now and don’t know how to get out.

    1. I am on vacation right now. whatever you write on the browser must be in config.php trusted domains section.
      Nextcloudpi puts your ip automatically or it should, you can check online how to edit that file and add the IP or URL

      Can’t help more, I am on vacation, writing from my phone

      You are almost there

      If I am not detecting your IP correctly I would be interested to know why. Please open an issue on github with relevant info. at least output of

      ip address

        1. nachoparker thanks for your response while on vacation. I am currently looking into OpenMediaVault as another option with my raspberry pi.

  46. nachoparker says:
    “Like I said… either copy your files/calendars/whatever and install a fresh NCP 11.0.3 or do the update manually”

    That fix isn’t acceptable since I’ve already made many non-NC configurations, and rebuilding an entire system just because of some messed-up file permissions is not a good advice.
    On that note, I will move to a ubuntu/snap build of NC since that way a cock-up in setting up NC won’t result in rebuilding the entire system.

    1. Hope you will be satisfied with the changeover. However, do not forget that the GNU license is clear:
      “#
      # This script is distributed in the hope that it will be useful,
      # but WITHOUT ANY WARRANTY; without even the implied warranty of
      # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      # GNU General Public License for more details.
      #”
      For me… Thanks NachoParker! Excelent work.

    2. Like I said, I fixe the permissions for the upgrade from 11.0.1 to 11.0.2.

      When I tested the upgrade to 11.0.3 I did not have an issue with permissions (I had a different issue, which I reported to NC), but I would be interested in seeing what happened to your NCP instance.

      Would you kindly open an issue on the github for the project? post details of configuration, the error message, etc

      https://github.com/nachoparker/nextcloud-raspbian-generator/issues

      Also, if it is a problem with permissions, you can just fix the permissions yourself so the updater does not complain, but like I said, I do not recommend using the updater because NextCloud still has to work in improving it.

      In any case, it would be great to get feedback of any problem that I did not encounter, and in case it needs to be dealt with, fix it

      thank you

  47. Sorry for this stupid question but i know nothing about Linux.
    I installed this fantastic piece of software and everything works fine – but.
    I’m used to use owncloud for synchronizing contacts to windows phones. Now i want to switch to nextcloud. Therefore i need to download the certificate to install it on the phone. I did this let’s encrypt config but cannot find the certificate file which i assume is called something like .pem

    Please…

    1. You don’t need to install any self signed certificate. Letsencrypt signs the certificate for you and your phone can verify it without installing anything

      Please read the post about letsencrypt carefully for a longer explanation

  48. Love the work you’ve done and really appreciate it. I took the time to use your image when I had to migrate to another DDNS provider after I had to get a new router (no DD-WRT so I couldn’t do a custom one). Anyway, I’ve got an A- on the Mozilla Observatory and a B on Security Headers. Both mention Content-Security-Policy containing ‘unsafe-eval’ which should be removed. My question is, where did you set this policy? I set it from scratch when I followed another tutorial on my previous install, but rather than search for it, I’d figure I’d ask you first. There is also the Public-Key-Pins and Referrer-Policy. I feel like only the Referrer Policy can be set, but not the other, since I’m using a DDNS, correct?

        1. Hi

          If I remember correcty, CSP is determined by the Nextcloud server code.
          Same thing with the referer policy, it is set to ‘never’ in the server html

          I don’t see the relationship with DDNS

  49. I just found NextcloudPI and am interested in using it to set up a Nextcloud instance for my home.
    I am confused and want to make sure I get this right.

    I am trying to create an image (using Raspbian Lite?) to run Nextcloud on a RPi3. I already have an external hard disk. In reading your instructions, I am confused about the Qemu stuff. Since I am running directly on a RPi, do I need Qemu at all? I think not.

    Do I just create a bootable image of your nextcloudpi image file and boot on a RPi? Once I’ve done that, is Nextcloud installed in running, or do I need to use the install script to install Nextcloud? I think I just need to run nextcloudpi-config to setup everything, correct?

    Thanks for all your work on this!

    1. You can download the image and copy it to the SD card. Boom working in 3 minutes.

      Then, use nextcloudpi-config to configure things like USB hard drive and other extras

      If you want to build the image yourself, you can use QEMU for that and the resulting image you can copy it to an SD card. It will have nextcloud working

      Or you can install nextcloud on any raspbian with the scripts provided, directly on the rpi

      Those are the options

  50. This is impressive and works flawlessly right from your image. Just a question and I am not an expert mind you. I read on another site that it is recommended to use nginx on a Raspberry Pi because Apache is so resource demanding. Do you have any opinion on this one way or the other?

    Again, thank you for this excellent project

    1. Hi
      Thx
      So many people asking the same thing haha I should write a post about it.
      Basically nginx shines in high concurrency situations… If you are hosting a web with hundreds of connections per second..

      For a personal hosting only accessed by you you won’t feel a difference

      Apache has many modules, and they can be loaded dynamically, meaning that is easier from apt without compiling to install and manage.

      Nginx is only starting to do this and is still not easy to accomplish

      If you read my post about NC security

      https://ownyourbits.com/2017/03/25/nextcloud-a-security-analysis/

      https://ownyourbits.com/2017/03/23/modsecurity-web-application-firewall-for-nextcloud/

      I really value the added security of modsecurity for Apache.

      Those are my reasons, but of course it will depend on each use case

      Look this for more details

      http://www.hostingadvice.com/how-to/nginx-vs-apache

    1. You should first run “sudo raspi-config” and then choose the first option to access to nextcloudpi-config.

  51. Dear friend, I would like to migrate from apache2 to nginx as my nextcloud server proxy, is there any recommanded processes I can do?

  52. Hi nachoparker,

    Thank you for this excellent installation method, I’ve been struggling with owncloud for a while.
    I’m stuck now at the point of trying to add an external USB storage. I use exFAT file system, so I know I need exfat-utils.
    No matter how I mount it, it does not work.

    Could you please be more specific on what is “properly configured to automount upon boot”?

    I’m aware on the need to use fstab, but I could not make it work so far.

    Thank you.

    Jose

  53. Hey,
    thanks for great work! why not provide an image based on full rasbian?
    or….when can I find step by step guide to install your NC over raspbian without QEMU?

    1. I am on vacation so can’t help much but look into the code.

      if the IP for your raspi is 192.168.1.10 for example, you can install the LAMP with

      ./install-nextcloud.sh 192.168.1.10

      And nextcloud with

      ./installer.sh nextcloud.sh 192.168.1.10

      Look for instance in

      https://github.com/nachoparker/nextcloud-raspbian-generator/blob/master/batch.sh

      If you need more info for example about different user and password from defaults look at post

      https://ownyourbits.com/2017/03/05/generic-software-installer-for-raspbian/

  54. Hello,

    Thanks for the great work. Everything works out perfectly! I am just left with one more question, is it possible to use a VPN as well / is it recommended?

    Thanks

  55. Hello friend,

    Thanks for your amazing works.

    I currenttly have nextcloud installed on my SD card, and the card’s I/O speed limits to about 10~20MB/S, I have two methods to improve I/O performance for optimizing nextcloud:

    1. Using a higher speed SD card for example UHS-3 level(But I read that Raspberr Pi 3 doesn’t support this speed level SD card);
    2. Storaging NC’s database and files in an external USB driven hard disk.

    Which method above can effectively improve Raspberry Pi 3’s I/O performance? Or both? Or another method?

    Thanks!

  56. I’m trying to up the max execution time from 3600 seconds the 7200 seconds to allow for larger files or slower connections. How can I adjust this?

  57. Hello,

    I am currently having the problem, that my Nextcloud config at /var/www/nextcloud/config/config.php is always resetting as soon as I reboot my RPi. This causes the problem, that my domain isn’t in the white list anymore and I have basically no access to my cloud. So I have to edit the file each time my RPi is rebooting.

    Do you have any idea how I cloud solve that?

    Btw great work!

    1. You are probably editing the trusted domain list directly in config.php

      Then, add your trusted domain in position number 3 or greater of the list. Number 1 is overridden on boot to your IP, and number 2 is used by dnsmasq / noip in nextcloudpi-config

      Either that, or disable the behavior

      sudo systemctl disable nextcloud-domain

  58. Hi,
    I downloaded the 612 MB Image and put it on the SD Card. Afterwards. I was able to access nextcloud via local IP. Afterwards I issued a new certificate with Letsencrypt. Then I changed the external data on /media/USBdrive/ncdata and saved it in fstab.
    I am getting the issue with ocdata but the error attempts only when I redirect to my website when connected in LAN. CA is ok Outside I am not getting so far and receiving fault ” unsecure connection with err_cert_authority_invalid but inside LAN OK. I created ocdata via bank and saved in root =>” /” and changed owner to www-data. READ PERMISSION is granted. All without success. A reinstall is to critical I had in the past issues with Certificate so better no new install. What can be the problem and how can I solve it. Any ideas.? Best regards flipthemouse

  59. Hello,

    Do you know how I can remove index.php in the URL bar? I already checked a couple of guides but non worked.

    Thanks for your help!

  60. Hello!
    im pretty new.. so i understood right that i have to do following things:

    – Iso -> SD Card
    – Input no-ip data
    – DDns data
    – open Ports
    Then i should be rdy to connect from internet?

    1. Yes.

      Steps 2 and 3 are the same, noip is a DDNS but you can use other if you want.

      You also should set up dnsmasq to update your trusted domains. In the future this won’t be needed

  61. I am having a terrible time getting the NC data stored on a usb stick. I have tried the 2 items in Nexcloudpi-config and also tried to edit the fstab file. I can mount my usb as /media/USBstick, but I get an error when I try to access the web login. It states that the directory does not have proper permissions. I cannot seem to figure this out. Can you post a sample of all steps to setup a usb stick that is sda1 and anything needed to make it mount at boot. Thanks

  62. Hy, ich Follow your instruction to install nextcloud on Pi.
    But i have a problem.

    My domain isnt trusted and i get an error, to trust it.

    Now i have found anyone about Config/config.php to add a trusted domain.

    How i must do it and where find i this file ?

  63. Dear NachoParker:

    This has been the easiest and best cloud setup I have ever used. I used to have ownCloud setup on my RaspberryPi then I read about ownCloud vs NextCloud goals objectives regarding Open EchoSystem (development transparency). I wanted to make the jump from ownCloud to NextCloud with clean setup and you have amazed me with the simplicity of setup including usage of fail2ban and ddns as well as additions added to your image and creating free SSL cert and ModSecurity bundled…all I can say is WOW!

    Thank you so much for your dedicated time to create this and so much for continuing to embrace “Peace of Mind”. Keep up the awesomeness…looking forward to many other bright features.

  64. Hey,
    just installed this nice image on my RPi3 (4GB microSD). Thanks for the nice work :). I added the PiDrive from WDLabs as a ext4 to the system and moved the files with “nextcloudpi-config: nc-databse and nc-datadir” to the mounted drive at /media/PiDrive. In the folders for the db and data are some nextcloud files, but by copying files on the cloud, nextcloud claims there is no space left. Do I have to do something else?

    Kind regards 🙂

  65. Hi,
    Thanks for your work and sharing it. I am successfully booted into the image on a Raspberry Pi 3.

    Few things here that I am not able to work out:
    * I am currently running it locally through an IP address and the browser says it is not secure. How can I solve that? I read that I can disable the https connection but I want to use it via Internet as well then that is not an option! When I ask the browser to remember the exemption for the IP address then the nextcloud gives a message asking to “Add as trusted domain”. I need to do it every time I change/update the domain?
    * SSH is not enabled by default ?

    1. SSH is not enabled by default. This is standard and is the default behaviour in Raspbian and is also desired to prevent people unadvertedly having an open SSH port with default pi credentials.

      Read the post about Let’s Encrypt in order to obtain a trusted certificate. Actually, read all the posts, in particular the one about dnsmasq in order to use a domain name instead of an IP so you can access from inside or outside.

      https://ownyourbits.com/2017/03/09/dnsmasq-as-dns-cache-server-for-nextcloudpi-and-raspbian/
      https://ownyourbits.com/2017/03/17/lets-encrypt-installer-for-apache/

  66. Hi men!
    Great guide and well scripted.
    I have a question about the HTTP2 mod on the latest raspbian Pi3. When I try to install the HTTP2 module on the lastest apache from the default disto I get the following error message:

    sudo a2enmod http2
    ERROR: Module http2 does not exist!

    How did you solve this problem?

    Cheers!

  67. Hi man,

    thanks a lot for the nice work and effort. I am not very skilled with web servers. After following your guide, I cannot open the website. This is what happens when I type https://192.168.1.100. The browser complains about it cannot be trusted, but I just clicked ‘proceed anyway’, and then:

    This page isn’t working

    192.168.1.100 is currently unable to handle this request.
    HTTP ERROR 500

    mmm I am quite lost and I do not know where to look at, any hints?

    Thanks!

  68. I want to upload a 7 gig file but keep getting bad request error. Here is the message from the log. Max file size has been changed in both .htaccess and user.ini for 20000M
    Sabre\DAV\Exception\BadRequest: HTTP/1.1 400 expected filesize 7039108893 got 2147483647

    1. I was able to get some more information. It can upload fine via the windows program but only happens on the web interface. I have an older version of nextcloud with php5 and the web interface didn’t have that issue.

      1. That seems like a NextCloud issue to me. I have also tried different sizes from the web interface and there seems to be a practical limit of ~800 MB.

        What I did not suspect is that the sync client would not have that problem. That sounds strange.

        I suggest you seek for help at the nextcloud forums or report the bug on NC github, I think it can be a bug with the web client.

        [EDIT: there is an architectural limit of 2GB due to php 32bit limitations. I am working on a fix for this]

  69. Would there be any restrictions on number of user accounts? Is there like 1 admin user and 1 regular user?
    I had idea to create several users for family members. Managed to create one. Every additional user i want to add makes the webserver unresponsive until i reboot the pi through ssh.

  70. Hello,
    just 2 questions; I’m using your last image:
    1: I want to use the last version of fail2ban but I see it’s already installed but not active. can you confirm?
    2: looking at apache log files I’ve seen the external ip address connecting to nextcloud is never the one of my ISP; which apache module is causing this behavior?
    thanks!

    1. I think I fixed it, not sure how but I left comments in the github link about both my setup process steps, how it appeared to break, and then how I tried to fix, ended up with NO web GUI, then how I reversed it and now it’s working ok.

  71. Dear Nachopacker,
    Good to see you are so active. Tried today the new Nextcloud 12 image, still has issues with adding multiple users, however works in a way. Here’s what i am doing.
    – Created SSD card, changed user pi password and enabled ssh
    – Logged in on my local nextcloud as admin
    – On admin -> users, added user1, works ok
    – On admin -> users, added user2, now webserver becomes unresponsive
    – By ssh sudo shutdown -r now
    – Logged in on my local nextcould as admin, check admin -> users

    On NextCloudPi 12 the user2 was created after all,
    on previous NextCloudPi there was no user2.

    So still undesired that admin -> users screen hangs the webserver.
    However it now succeeds in a way.

    1. Hello Rrrr

      I just setup NC12 from scratch image and I was able to login as admin and create user1 and user2
      I gave user1 admin group membership
      user2 I created a new group called users for it
      see my above posts but somewhere I lost access to the GUI and am maybe wondering if it was permissions (likely) or 2nd user add that broke it, although in my case rebooting didn not resolve it.

      At any rate if you look at the github link above I comented and resolved my permissions issue BUT I was also able to delete and re create user1 and user2 and they both work without any adverse web GUI issues, you might consider trying that? just a suggestion since it worked for me.

  72. Hey! Great work! Loving how easy it is to setup everything. I’ve got only one problem: Can’t setup my external drive. The automount works flawlessly, but when I go to the nc-datadir option and set it to /media/Cloud (the drive’s name is Cloud) I get a message: “/media/Cloud is not empty” and nothing happens… The drive was formatted to ext4 on my Mac and has only the lost+found directory inside… What am I missing?

    1. hi,
      for nc-datadir you need to input either an empty folder that you have created or a folder name that does not exist and it will be created for you.

      But if you input a folder that is not empty will refuse to use it.

  73. Thanks for a great article. Very helpful.

    Curious if you are aware of pagekite? http://pagekite.net/ Seems to be a smarter alternative to using DDNS. No router port forwarding settings to deal with. And for added security, why not use ZeroTier to create an encrypted network between the nextcloud on the pi and devices which will access it?

  74. Hey Nachoparker,

    I updated my PHP 7.0 using sudo apt-get update + upgrade and then updated my NC instance to v12.
    Now I’m having the same error as these folks. https://help.nextcloud.com/t/php-opcache-not-correctly/12925/10
    The admin console keeps saying that my opcache isn’t configured properly.

    Is there anything I can do using nextcloudpi-config to fix this without losing all my data? I’ve modified the php.ini files in cli and fpm, restarted apache. Modified opcache.ini file. Restarted, no avail 🙁

    I should note that my Rpi3 installation was originally done with Nextcloudpi and it’s been running incredibly smoothly!

  75. Hi there, the other day the installation just died. apache seems to be up and running, i can ssh into nextcloudPi but no webdav nor https to the cloud. any suggestions for troubleshooting?

    best sfb

      1. thanks nachoparker for replying;

        no, maybe an unattended one but other than that, no – it was the hottest day yet in Berlin an the device was real hot. otherwise no.

        When i connect to the server via browser it just gives me a blank page no error or anything like it, I really don’t know where to start troubleshooting

        1. Same here!
          Mine just died aswell..
          At first, Apache didn’t start anymore.
          Now it’s running but it doesn’t load any page anymore…
          Maybe it has something to do with the letsencrypt renewal?
          It’s about 1 month now since I installed it. Any thouhts on this?
          Apache Log doesn’t tell anything spectacular.

        2. Same here. Just stopped working. SSH works but nothing else.
          i moved my data so i tried:
          tail -f /media/USBdrive/ncdata/nextcloud/data/*.log
          but i get a permission denied.

          I hope somebody can help.

  76. Can’t make it work 🙁

    I installed NextCloudPi but when I open the IP of the the Pi in the browser (from PC in local LAN), it gives me the following message on a page with NextCloud logo in the background (translated from german by me and my english is not that good):

    You access the server from a not trusted domain.

    [ EDITED: transferred to https://github.com/nextcloud/nextcloudpi/issues/21 ]

    Thought this would be easier 😉 Any advice would be highly appreciated!

    Best Regards
    Ralf

      1. Sorry, this was just the first page google took me to. I saw that people get questions about NextCloudPi answered here, so I posted my question here as well.

  77. Sorry for the delay, here is what the log says:

    '==> /var/www/nextcloud/data/access.log /var/www/nextcloud/data/error.log /var/www/nextcloud/data/nextcloud.log <==
    {"reqId":"WRTjwH8AAQEAAAQXTHgAAABI","remoteAddr":"94.223.166.113","app":"core","message":"Trusted domain error. \"94.223.166.113\" tried to access using \"abcdefeg.net\" as host.","level":2,"time":"2017-05-11T22:20:50+00:00","method":"PROPFIND","url":"\/remote.php\/dav\/","user":"--","version":"11.0.3.2"}'

    I understand there is no place on the device left, which makes me wonder whether I configured the hard drive correctly, on the other hand there had been far more data on the device than the sd-card would store?

    but there seems to be some certificate trouble too.
    Can you make sense of it?

  78. This part was lost in the reply: log_config:warn] [pid 1366:tid 1698690096] (28)No space left on device: [client 178.8.22.79:55972] AH00646: Error writing to /var/www/nextcloud/data/access.log

      1. all right, sd ran out of space. though the data folder is located on a harddrive. cloned the system on to a lager sd, now everything works again. thanks nacho

  79. Hi, as I understand it, because of the architecture rasbian os , the maximum download file is only 2GB?

    File handling
    Maximum upload size
    16 GB
    (max. possible: 2 GB)

  80. I flashed the img, navigate to the IP and it was taking forever to load. Then this:

    Service Unavailable

    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
    Apache/2.4.25 (Raspbian) Server at 192.168.1.90 Port 443

    Not what I was expecting to see. What is the issue? Thank you

  81. If I wanted to install this on an existing running raspian installation (I do not want to create a new image, but add this to an existing one), I should run ./nextcloud.sh with the
    Resize and part of the Update sections removed?

    1. You are right, Nextcloud and also the extras can be installed individually.

      From your PC, remove those sections, and then the following command will install the webserver and database through SSH (assuming your rpi in 192.168.1.15)

      ./installer.sh nextcloud_lamp.sh 192.168.1.15

      The following will install nextcloud on top of it

      ./installer.sh nc-nextcloud.sh 192.168.1.15

      See the documentation about user and password

      https://ownyourbits.com/2017/03/05/generic-software-installer-for-raspbian/

      I am currently separating the first step in two, so the resizing and updating would be in step 0 for this same purpose.

  82. I must be missing some code. All the code posts I see above are called nextcloud.sh and install-nextcloud.sh. You reference nextcloud_lamp.sh and nc-nextcloud.sh in your post above. What have I missed?
    Thanks!

    1. Sorry, that file structure has changed a bit, and the code from the original post was also a little bit old. I just updated it.

      In any case, check out the git repo if in doubt 😉

      If you get stuck or have further technical questions about the project, I recommend that you access the forums or the corresponding github section (see links at the top of the post)

  83. I changed the admin password, but in the file /var/www/nextcloud/config/config.php there is the line ‘dbpassword’ => ‘ownyourbits ‘. Is this a security problem?

    1. That is the database password. Definitely a good thing to change it, not only in that file but also for the database. In any case, if some attacker had permissions to read that file, they would already have permissions to access the database content through NC.

    1. Thanks for your generosity, but for now this is a hobby project and I do not take donations.

      If anybody wants to help, contributions, testing and feedback are really welcome 🙂

  84. Thank you for the image!
    I cannot access the console after the system boot up, what is the default password for nextcloudpi?

  85. i have 1 external usb hdd, i would like to use it for “nextcloud” “torrent download” and “samba share” for my TV.

    can i do this? i’ve concerns about permissions. (e.g. hdd includes 2 folders one for Nextcloud and one for samba share and torrent download)

    a few times i did samba share FIRST for my tv and THEN installed Nextcloud or Owncloud and never get permissions to write nextcloud data to external drive

  86. Hello! Great Guide and easy install.
    But I cannot sync my CardDav and CalDav with my different Devices: Thunderbird/Lightning, Android CalDAV-Sync and CardDAV-Sync. Any ideas?
    File sync works.
    Just tell me if you need more information or if I should ask somewhere else.

      1. WTF! This was it, thank you very much! A shame something like that make it into a stable release but mistakes happen.

        1. Strange problem occurred. Your solution worked with my user account on the Android device but not in Thunderbird, more strangely the admin account syncs fine with Thunderbird. I only chance dav to caldav but it still disables itself but works fine on android.

        2. Sorry for the Spam but I created a new calender and it works now. Something more is buggy the some missing letters.

        3. I cheered too fast! It still doesn’t work with my user account in thunderbird. I will shut up now

  87. NextCloudPi is great, but we ran into a problem early on, and almost gave up and moved on to something else because we didn’t realize what was happening.

    We have a hard drive connected and made the mistake of using the nc-database option to move the database to the hard drive. After doing that, any time the Pi was rebooted and we tried to access the web interface, it would go to a blank white screen. Moving the database to a different location would make it work again, but only until the next reboot. We finally moved it back to the SD card, and then the web interface would come up after a reboot without an issue.

    The first problem is we didn’t remember where it was originally saved, we would have liked to have put it back there but didn’t remember the original directory path. So maybe for the nc-database option, “restore to original location” should be a choice. Would you please reveal where the database is normally saved if you haven’t moved it?

    But the second is I think we have stumbled across a race condition and NextCloud is losing (or winning, actually, but that’s not what we want). My guess that NextCloud is coming up before the external drive(s) are fully mounted. So maybe what you need is an additional option in the nc-database script or elsewhere that allows you to specify a “sleep” time in the NextCloud startup, to give hard drives time to spin up and initialize.

    Thank you for all the time you have put into this!

    1. Thank you very much.

      I am getting many reports of that, like this Issue.

      Getting a white screen is an indicative that the USB drive is not on, has been removed, has decided to go to stand by or something similar.

      I am going to make it more clear in the nextcloudpi-config instructions that this is a potential issue with moving the database.

      Your second issue… I am afraid I do not understand it very well.

      In any case, I would like to ask everyone to report issues, ask technical questions and feature requests in the corresponding Github section for the project.

      It is much cleaner and easier to manage, keep conversations separate, request for more information and such.

      Thanks for the feedback

  88. Hi! I’m so glad I came to look at this. I remember I had posted a couple months back, but never received a heads-up e-mail of your response. I don’t believe that matters all that much, today, because…

    I’m going to perform a full upgrade using the version 12.0.0 image at the top of this page. I have the image, now, but am holding off upgrading for a week. This will be a complete fresh install into a formatted SD card and formatted external HDD (the ones in use, today) I wish there was a simple command line command that would kick off an upgrade, otherwise I would do it, this weekend.

    1. What do you mean a command line that would kick off an update?

      If it is what I think it is, you have ncp-update for that.

      Looking at your previous comment

      https://ownyourbits.com/2017/03/17/lets-encrypt-installer-for-apache/#comment-258

      It seems that you have a very old version of NCP that did not have remote updates yet.

      I recommend that you do the upgrade as you are planning to do, and from then on, you will be able to upgrade from the command line without having to start from scratch.

      1. It must be. It appears I may have had pulled and older full version. I have a couple of them. I kicked off that command and received…

        sudo: ncp-update: command not found

        It appears a full upgrade from scratch is needed. I did some screen grabs to know what to put back in. It won’t take too too long. Luckily, I pulled the 12.0.0 for this upgrade and let folks know I’ll be performing it, next weekend.

        I did notice syncing large video files (and/or groups of the same) takes quite a long time to sync and that just direct uploads from inside the application, itself, seems to yield better results.

    1. Hi,
      I have not tried it. Somebody around here made it work on a raspi zero though.

      My guess is that it should work, although it will be slow. Last time I checked, you could flash Raspbian on a Raspberry Pi 1, and this is based on Raspbian so it should work.

      Let us know if you try!

  89. Someone have problem com “smbclient”? In my image, external storage show “smbclient” in not installed.

Leave a Reply

Your email address will not be published. Required fields are marked *