OwnCloud on WDMyCloud V4 Firmwares

OwnCloud V8
OwnCloud V8

 

Disclaimer: As I’m frequently updating the original guides and installers here on TeaNazaR.com, I will not be responsible for any brick issues if you were to follow my obsolete guides copied elsewhere. Thus subscribe to this post to get latest updates. Modifying any part of a device may void its warranty.

 

Similar to my WordPress installation guide here, there’s two method of running OwnCloud, first with a secondary domain (http://secondary-domain.primary-domain.com) or sub-path (http://primary-domain.com/sub-path).

Sub-path method is fairly easy to install so I’ll skip it and proceed to secondary domain (a.k.a. subdomain). You can also use this method if you own a full qualified domain (http://www.domain.com).

1) Prepare your WDMyCloud
I’ve separated the Web Server perquisites and installations in another guide. Please follow the guide WebHosting on WDMyCloud V4 Firmwares then comeback to this post to complete your OwnCloud installations on the WDMyCloud.


2) Prepare OwnCloud
We’ll use the manual method instead of the online “setup-owncloud.php” because sometimes the download wizard may timeout. This is version 8.2.2 at the time of published. You can use this version then upgrade to the latest version (highly recommended) or look for a newer version on their official website. Issue the commands below on your SSH shell session:


3) Prepare Nginx WebServer
Edit a new config file:
nano /etc/nginx/sites-available/owncloud

Paste and edit below as needed. Take note of the server_name parameter and replace it with your acquired earlier DDNS subdomain or your full qualified domain if you own it:

When done, “CTRL+x” to exit and “y” to save changes to the file.


4) Enable the new configs
Activate the new owncloud config file:

Check if the new owncloud config is good:
service nginx configtest

If failed, find out why in the log and fix it:
more /var/log/nginx/error.log

Reload Nginx:
service nginx reload

Or if you have changed the listening ports:
service nginx restart

Note that you’ll also need to reload the PHP-FPM Daemon every time you make manual edits to the PHP scripts content or settings else you won’t see the changes. They are commonly files with “*.php” extension. This is perfectly normal for performance, due to precompiled scripts memory caching by PHP Opcache. The easiest way to clear the cache:
service php5-fpm reload


5) Setup OwnCloud
Browse to your domain or the free DNS forwarder you got earlier to start the setup:
http://my-freedns-subdomain-owncloud.mooo.com/

Or if you know what you’re doing and have set Nginx’s default server differently, just browse the WDMyCloud internal host/IP:
http://wdmycloud:5080/

a. Provide Username and Password of your choice under “Create an admin account“.

b. Click “Storage & database” and select “MySQL/MariaDB“.

c. Leave “Data folder” as “/DataVolume/owncloud/data“.

d. Provide the Database details:
DB-user=root
DB-password=(leave blank unless you’ve changed MySQL root password)
DB-name=owncloud
DB-host=localhost

e. Click “Finish setup“, the database will be created soon after you’ll see the main page. You can do system mount or OwnCloud mount or symlink your “/shares/user” but you’ll enjoy better experience after its internal cache build up complete especially if you have large libraries. For help and details or OwnCloud related errors, please refer to http://doc.owncloud.org.


6) Upgrade OwnCloud [Optional]
When there’s a newer version released, the “Update Center” sometimes doesn’t work due to timeout. But you could easily upgrade by just issuing the following command:
sudo -u www-data php /DataVolume/owncloud/occ upgrade

Updated: Guide updated to version 8.2.2. Note this is the last version of OwnCloud v8.

Enjoy (-:

63 thoughts on “OwnCloud on WDMyCloud V4 Firmwares”

  1. no se que hacer:

    http://192.168.1.37/owncloud/index.php
    Error interno del servidor
    El servidor ha encontrado un error y no puede completar la solicitud.
    Por favor, contacte con el administrador del servidor si este error reaparece múltiples veces. Incluya asimismo los detalles técnicos que se muestran a continuación.
    Pueden verse más detalles en el registro del servidor.

    Detalles técnicos
    Dirección remota: 192.168.1.36
    ID de la solicitud: Xbh6mSN8gKMUY44qYeFY

  2. no puedo configurar la base de datos

    1. Hello Sebastian,

      Sorry I don’t speak Spanish so I Google translated. I’ve installed OwnCloud quite a few times for several of my donors. I don’t seems to see such issue with the latest v4 firmware. Perhaps it’s the OwnCloud latest version that’s causing the issue, you could try the version that’s stated in the guide to start with.

      If you want to reset OwnCloud , remove all the files from the path and follow the guide again from top. You also need to remove the existing OwnCloud users, see my recent response here. Also before you redo everything, don’t forget to restart PHP after you removed and replaced the OC files service php5-fpm restart;.

  3. Updated: Guide updated to version 8.2.2. Note this is the last version of OwnCloud v8.

  4. Hi Nazar,
    Thank you for all of your hard work!
    I know you say that setting up sub-path domains is trivial, but any chance of a brief guide? I’ve installed OwnCloud (and the web prerequisites) following this guide. But, using free dynamic DNS providers I don’t seem to get access to subdomains. This seems to mean I just get the welcome page

    “Welcome to nginx on Debian!

    If you see this page, the nginx web server is successfully installed and working on Debian. Further configuration is required.”

    Any help would be much appreciated.

    Thanks

    1. Hello Rob,

      The sub-path method is merely placing your scripts into a new subdirectory under the www root path (/var/www/html/new-sub-path/) and accessing it directly with http://ip-or-domain/new-sub-path/ without the need to setup vhost (virtual host). I suggest you’d move away and symlink this path into the /DataVolume because it will be lost on firmware update.

      As for your DDNS, the vhost needs to be setup, have you gone through steps 3 and 4 of my guide? You need to edit the config file especially the server_name variable replacing it with your DDNS. Ensure the config is enabled as stated in the guide then reload it service nginx reload. Only then you can access it with your DDNS.

      1. Thank you for the quick reply and guidance! I’ve managed to get OwnCloud working now using the subdomain method. I’ve set up a root user and the database too. However, everything is running hideously slow (both the normal WD control panel and the own cloud install). I ran “top” in the shell and the CPU usage seems low overall, but the owncloud site frequently times out, and even if I can get the login screen up, I can’t do much beyond logging in. Any thoughts of what I might be doing wrong to make it quite so slow, or how I could find out?
        Thanks again for your help.

        1. I managed to get into the control panel, which showed me an error:
          “php does not seem to be setup properly to query system environment variables. The test with getenv(“PATH”) only returns an empty response.
          Please check the installation documentation for php configuration notes and the php configuration of your server, especially when using php-fpm”

          A forum suggested: Uncommenting the line “env[PATH] = /usr/local/bin:/usr/bin:/bin” in the file “/etc/php5/fpm/pool.d/www.conf” to remove the error.

          I have limited knowledge in this area, and don’t want to brick my NAS, can you provide any advice? Thanks

          1. Hello Rob,

            To make the changes, enter nano /etc/php5/fpm/pool.d/www.conf:

            Scroll towards the end of the file and you’ll see this ;env[PATH]. Remove the “semicolon” from the beginning of the line then CTRL+X to exit and save the changes.

            If you want to match the PATH environment to our MyCloud (recommended, see env|grep PATH), instead of uncommenting, enter a new line just below it and use this instead:
            env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.

            Then don’t forget to restart the PHP daemon, service php5-fpm restart.

            As for the slowness that you encountered, although I don’t use OwnCloud, I had spent some time playing with it and it seems ok.

            Some thoughts, in the top command, also take note of the followings:

            1. “wa” (IO wait percentage, in the %Cpu(s) row)

            2. “Swap” (used in KB, 1000KB=1MB)

            If the IO wait percentage is consistently hitting high and your swap usage is almost 300MB, then this is where MyCloud tends to slow down due to disk/Swap IO trashing. Do you have any other 3rd party apps?

            It’s also good to monitor the top command, enter “f”, scroll to “VIRT”, enter “s” then “ESC”. This is to sort the list by virtual memory (in KB, press “h” for help) to see which process is using relatively high memory and decide if you don’t need them to be running (like the wdmcserver, wdphotodbmerger, nfs, vsftpd, and/or replace Twonky with MiniDLNA or disable DLNA if you don’t need them, to stop service <service> stop, to disable/enable at boot use the update-rc.d <service> disable|enable) as MyCloud has only 256MB of RAM. This is how I manage my MyCloud running this site with all the installers and stuffs.

            1. Hi Nazar,
              Changing the env path seems to have helped a bit with speed and has removed a lot of errors. Although, I still get frequent timeouts. It seems there is a way to configure a memory cache to make page loads faster. Failing that though, I think I’ll try and uninstall owncloud and install something else. Could I ask what you use personally to access your files remotely? Thanks again, Rob

              1. Hello Rob,

                You could try using the APCu cache (Though I have not tried), set to your OwnCloud config.php: /DataVolume/owncloud/config/config.php -> 'memcache.local' => '\OC\Memcache\APCu',. Play around with the cache size: /etc/php5/fpm/conf.d/20-apcu.ini -> apc.shm_size=2M, default is 32MB, WD sets it to 2MB think due to the limited RAM. Note that you’ll need to reload PHP on every changes: service php5-fpm reload.

                Personally I use my own mod, CloudDAVMod v1.1 for WD My Cloud firmware V4, its WebUI is simplier and way much faster because it’s not using PHP. Note that the latest v1.1 (more functions like WWW-SSH, System Panel, searching and sharing) is reserved for donors and only v1.0 (need to downgrade to a specific firmware version) was released to the public, CloudDAVMod v1.0 for WD My Cloud firmware V4.

  5. Hi Nazar,
    I’ve tried to muddle through with OwnCloud but I’m not getting anywhere.
    My NAS shows between 5 and 8 seconds of lag if I try and install something from your server (namely CloudDavMod), but I can ping it in sub 1 second from my PC.
    If I wanted to start from a standard install of the MyCloud firmware again, what is the best way to do it without deleting my data? Can it be done from an SSH terminal?
    Thanks,
    Rob

    1. Hello Rob,

      Which part of OwnCloud are you having trouble with?

      As for the CloudDAVMod installation, I’ll contact you directly via your PayPal registered email.

      And for your last question, you can do it several ways. The easiest is to reflash the firmware from the Dashboard.

      1. Hi Nazar,

        Just for the benefit of anyone else reading this, it seems installing OwnCloud requires a bit of tweaking which was a bit beyond my capability.

        Reflashing the firmware (rather than just a dashboard reset) allows you to start with a clean slate, removing any OwnCloud installations or other mods.

        CloudDAVMod is awesome, but that goes without saying. Simple to install and very lightweight. Much better suited to what I was looking for.

        Finally, a point which I didn’t know. Using the Twonky Server, it is better to leave the scan rate at 0, it then can easily check for new files without rescanning. I had set it to ~4 hours, this meant it rescanned the whole disk every 4 hours, killing performance.

        A big thank you, to you Nazar, for all of your help and expert advice. My NAS is infinitely better for all of your hard work. 🙂

Leave a Reply

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

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax