Hello everyone. Sorry for posting on such an old post, but this is fairly relevant to what Iām trying to do so I thought this was better than creating a new post.
Iām installing Nextcloud 18.0.2 manually onto a Raspberry Pi 4 (Raspian 10 - Buster), using MariaDB. My first plan was to install it directly with a data directory (/mnt/MyData/nextcloud/data). I performed the following steps:
1. Download/extract Nextcloud 18.0.2.
2. mkdir -p /mnt/MyData/nextcloud/data
3. sudo chown -R www-data:www-data /var/www/html/nextcloud/
4. sudo chown -R www-data:www-data /mnt/MyData/nextcloud/
5. sudo chmod 750 /mnt/MyData/nextcloud/data
6. Go to the IP address of my Pi (ipaddress/nextcloud)
7. Create Admin account, select MariaDB as database, enter in /mnt/MyData/nextcloud/data/ for the data directory.
8. Finish.
I was given an error message, stating that Nextcloud could not read nor write to the given directory.
So I tried the original setup (putting data in /var/www/html/nextcloud/data), and got through the installation.
Then I tried to follow the instructions from @MichaIng to change the data directory (specifically Solution 1). I managed to get to step 8, but as soon as I try to switch off maintenance mode, I get the following error:
Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory
This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/18/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/html/nextcloud/lib/private/Console/Application.php:167
Stack trace:
#0 /var/www/html/nextcloud/console.php(98): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#2 {main}PHP Warning: fileperms(): stat failed for /mnt/MyData/nextcloud/data/nextcloud.log in /var/www/html/nextcloud/lib/private/Log/File.php on line 83
{"reqId":"kzyq8Uali4fwAG02lyFo","level":3,"time":"2020-03-15T20:01:46+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"fileperms(): stat failed for /mnt/MyData/nextcloud/data/nextcloud.log at /var/www/html/nextcloud/lib/private/Log/File.php#83","userAgent":"--","version":"18.0.2.2"}
{"reqId":"kzyq8Uali4fwAG02lyFo","level":3,"time":"2020-03-15T20:01:46+00:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at /var/www/html/nextcloud/3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/intl.php#18","userAgent":"--","version":"18.0.2.2"}
Does anybody know why this is happening? I have all the right permissions and there should be no issue with reading and writing, but it still occurs. Here is the output of sudo ls -la in my /var/www/html/nextcloud directory and my /mnt/MyData/nextcloud directory:
/var/www/html/nextcloud:
total 164
drwxr-xr-x 14 www-data www-data 4096 Mar 15 15:39 .
drwxr-xr-x 3 root root 4096 Mar 15 15:38 ā¦
drwxr-xr-x 33 www-data www-data 4096 Mar 11 10:56 3rdparty
drwxr-xā 49 www-data www-data 4096 Mar 15 15:47 apps
-rw-rār-- 1 www-data www-data 15752 Mar 11 10:52 AUTHORS
drwxr-xā 2 www-data www-data 4096 Mar 15 15:53 config
-rw-rār-- 1 www-data www-data 3910 Mar 11 10:52 console.php
-rw-rār-- 1 www-data www-data 34520 Mar 11 10:52 COPYING
drwxr-xr-x 23 www-data www-data 4096 Mar 11 10:57 core
-rw-rār-- 1 www-data www-data 5048 Mar 11 10:52 cron.php
drwxr-xā 5 www-data www-data 4096 Mar 15 15:46 data
-rw-rār-- 1 www-data www-data 2647 Mar 15 15:46 .htaccess
-rw-rār-- 1 www-data www-data 156 Mar 11 10:52 index.html
-rw-rār-- 1 www-data www-data 2976 Mar 11 10:52 index.php
drwxr-xr-x 6 www-data www-data 4096 Mar 11 10:52 lib
-rw-rār-- 1 www-data www-data 283 Mar 11 10:52 occ
drwxr-xr-x 2 www-data www-data 4096 Mar 11 10:52 ocm-provider
drwxr-xr-x 2 www-data www-data 4096 Mar 11 10:52 ocs
drwxr-xr-x 2 www-data www-data 4096 Mar 11 10:52 ocs-provider
-rw-rār-- 1 www-data www-data 3056 Mar 11 10:52 public.php
-rw-rār-- 1 www-data www-data 5235 Mar 11 10:52 remote.php
drwxr-xr-x 4 www-data www-data 4096 Mar 11 10:52 resources
-rw-rār-- 1 www-data www-data 26 Mar 11 10:52 robots.txt
-rw-rār-- 1 www-data www-data 2381 Mar 11 10:52 status.php
drwxr-xr-x 3 www-data www-data 4096 Mar 11 10:52 themes
drwxr-xr-x 2 www-data www-data 4096 Mar 11 10:53 updater
-rw-rār-- 1 www-data www-data 101 Mar 11 10:52 .user.ini
-rw-rār-- 1 www-data www-data 362 Mar 11 10:56 version.php
/mnt/MyData/nextcloud
total 12
drwxr-xr-x 3 www-data www-data 4096 Mar 15 15:41 .
drwxrār-- 4 pi pi 4096 Mar 15 15:51 ā¦
drwxr-xā 5 www-data www-data 4096 Mar 15 15:46 data
/mnt/MyData/nextcloud/data (identical to /var/www/html/nextcloud/data)
total 52
drwxr-xā 5 www-data www-data 4096 Mar 15 15:46 .
drwxr-xr-x 3 www-data www-data 4096 Mar 15 15:41 ā¦
drwxr-xr-x 8 www-data www-data 4096 Mar 15 15:47 appdata_octf179zqtl4
drwxr-xr-x 2 www-data www-data 4096 Mar 15 15:46 files_external
-rw-rār-- 1 www-data www-data 542 Mar 15 15:46 .htaccess
-rw-rār-- 1 www-data www-data 0 Mar 15 15:46 index.html
drwxr-xr-x 3 www-data www-data 4096 Mar 15 15:46 KimAdmin
-rw-r----- 1 www-data www-data 25937 Mar 15 15:49 nextcloud.log
-rw-rār-- 1 www-data www-data 0 Mar 15 15:46 .ocdata
Additionally, I have tried Solution 2 (symlinking), but I get stuck again on the same step (turning maintenance mode off) with the same exact error messageā¦
Thanks for the help!
UPDATE: I think Iāve finally managed to get it workingā¦ The permissions of the parent directories were likely insufficient. The entire /mnt/MyData now have permissions (set with sudo chmod -R 777 /mnt
ā¦ Iām not sure how secure this is but it works.