Install ownCloud in your Jail on Nas4Free

Now that we have a working jail we’ll go through and install ownCloud inside this jail

Click here to see how to create a jail in Nas4free.

Click here for video tutorial of this post.

To do this we’ll need to make use of putty again.

Start by logging into the jail from putty

  • jexec 1 csh
    • (note that the 1 indicates the jail number so if you have more than one jail make a note of this number)

1 Log into jail from putty small

Move to local user directory inside the jail


1c usr local directory small

Download the script to install and configure both MySql and ownCloud

  • fetch

1d fetch owncloud_install small

Make the file executable

  • chmod a+x

Before we install owncloud now is a good time to make a few little changes inside the script but before we do that lets install a text editor called nano

  • pkg_add -r nano
  • nano

1e nano crop

Customise IP and Port to suit your own requirements inside the script before executing particularly the network settings

  • Change owncloud version to “7.0.2” at the top and also the bottom

1f port and ip change

  • Change ligthttpd “start” to “onestart”

1f cloud version and onestart


Now run the script

  • ./ (note the period “.” in front of the “/”)

1g owncloud_injail fetching



  • Since we don’t have a password just press enter to continue

1h mysql config

  • Follow all the prompts and press “y”

1i set root password

  • Once you get to the RSA Keys there’s a few things to note
    • Obviously don’t forget your password created here
    • The common name is important especially at the beginning so I always use the IP I set for ownCloud or set here the FQDN you are planning to use

1j yes to all

  • Once you get to the end its time to log into ownCloud for the first time

1m finished



Open up your browser and put in the IP you set for ownCloud in the jail with the port number set as follows remembering to use https

  • (make sure to use the IP and port that you chose)
  • There will be an error or warning telling you it’s an unknown site. Ignore these warnings as it’s a self-signed certificate we created before so we know it’s safe to proceed
  • At the first login screen you’ll be prompted for a few very important things
  • Create an admin account – it’s preferable to choose a username other than “admin” but anything will do
  • Create a secure password
  • If you want to move the data folder to another location now is the time to do it as it can be difficult to do it later especially if you have lots of data default location is /usr/local/www/owncloud/data
  • Select MySql Database and it’ll open up and ask for your MySql information that you created earlier

2b owncloud

  • Database user is “root
  • Put in the password you chose earlier
  • Database name can be anything
  • Leave localhost

2c mysql

  • Click log in and it should come up with welcome screen

2d first login

Increasing ownCloud Upload Limit


One last thing before you finish by default php sets an upload limit of 2 MB which is obviously way too small to be practical so we’ll go and change that

  • Log into your NAS with putty and enter the jail
  • jexec 1 csh

1 Log into jail from putty small

  • Create a new file using the following command exactly
    • nano /usr/local/www/owncloud/.user.ini (Note the dot user dot ini -> the dot infront of the user is deliberate)
  • Enter these commands exactly and put whatever size file limit you wish
    • Note that if you are using a 32 bit system you will be limited to 2GB no matter what size you put in here

upload_max_filesize = “5G”
post_max_size = “5G”

  • Exit and save the new file

3b create userini crop

Now we need to give it the correct permissions and then restart the webserver for it to stick

  • chown www:www /usr/local/www/owncloud/.user.ini

3d chown userini

Restart the web server

  • /usr/local/etc/rc.d/lighttpd stop
  • /usr/local/etc/rc.d/lighttpd onestart

3c Restart webserver crop


Refresh the web browser and now you should be able to upload larger files.

3e New upload limit




Video Streaming inside ownCloud

4 video streaming


Sample Picture Gallery inside ownCloud

5 photo streaming


Congratulations on your very own Personal Cloud Server!

  • Stanley Johnson

    can this be done (mysql & owncloud) without creating/using a jail in nas4free?

    • Hi Mate. Technically yes. but you’ll have to install and configure mysql manually. I looked into it but to be honest it was just all too “hard” especially when there’s all these pre-made scripts for the jails. If its just for one user then you can install owncloud directly on your Nas4Free without the jail using sqlite but wouldn’t recommend it for more than 1 user.

      • Stanley Johnson

        Got it thanks!

        Finally rani it correctly w/ the script on the French how-to seems the pauses in the get list help.


        have you been able to webdav or sftp/ into OC in the jail, scratcing my head on that one.


        • Yeah you can actually ftp (i haven’t set sftp) into the NAS and directly into owncloud. There is a caveat with doing so though as it’s not recommended as if you don’t do it right owncloud won’t recognise it as it has to enter it into the database. In saying that i do it all the time as i know what i need to do to make it work inside of owncloud. where are you stuck at and i can help.

          • Stanley Johnson

            I undid the jail / owncloud setup for the time being as this server is a test bed at the moment, so I can teach myself for is proper deployment (somebody tossed a very nice Dell PowerEdge). Here’s what I have and any tips you can give will help greatly. As I want to try again next week while I’m on vacation.
            NAS was setup and working correctly w/ 9.3 and OC oudside the jail. On win 7 I use BitKinex for ftp, sftp AND WebDAV (it will update OC’s webdav database!!).

            Any way- I setup jail, mysql, OC using your blog and the French How-To once it was running I could access OC LAN and WAN.

            PHP warning about UT-8 character sets
            Best place to place the OC media folder OUTSIDE of the OC dir (I made /usr/local/media, but OC complained)
            I cant sftp/webdav (BitKinex) into the jail or the NAS in general. error states cipher error ( this was occuring w/ but when I downgraded back to i was able to do it fine, into ftp, sftp and webDAV

            Is mysql installed in the jail or out of it?

            Im thinking that 1349 has additional security that 1310 does not causing BitKinex to get denied


          • Stanley Johnson

            OK Scrapped the build. Downgraded w/ Nas4free & ownCloud 7.0.4 and now it works 99%.

            The final issue is accessing w/ WebDAV client to push directories w/ data. I can ssh no problem (of course the ownclowd database wont recognize the new data) But I cant WebDAV into /owncloud/remote.php/webdav/ in the jail.
            I have several other owncloud’s (not in a jail) and it’s flawless, Just can’t WebDAV into the jailCloud.
            set my data path as /usr/media and permissions set as www:www
            I cant get the WebDAV… tried cyberduck as a few others as well… no luck

          • Stanley Johnson

            Ok I should have looked at the WebDAV link in the lower left corner of the my OC page the path needs to be

            /remote.php/webdav/ NOT /owncloud//remote.php/webdav/.
            All seems to be working now

          • hey that’s great to hear!

          • Stanley Johnson

            yeah!! I decided to give it a real beating. I started an approx. 75-80gb push to it last night. Using BitKinex (for WebDAV client) over wifi. It has been chugging along around 3Mbs. Not bad… by now the SQLite instance of ownCloud would have been crawling a few Kbs.

          • that’s great to hear and yes SQLite would be really struggling with that kind of push so it’s worth it get a real SQL server running. Glad it’s working great for you 🙂

  • jenkinsm74

    Hi there
    I have ran this script many times and each time it failed. Just keeps skipping past mysql installation and wont’ run the sql install section. I have setup my jail in nas4free as per your instructions using “TheBrig” everything on that side worked fine. Just wondering would you have any idea’s why this is happening ?



    • @jenkinsm74:disqus
      the first thing to come to mind is to make sure you are running inside the jail?

      • jenkinsm74


        Thanks for the reply. Every time I ran the script I was
        inside the jail. I double checked that everything was as per your instructions,
        but still no luck. If you can shine any light on for me that would be great

        Thanks again

        • hmm. what errors do you get?

        • @jenkinsm74:disqus Hi Mark. i’ve been racking my brain and i think i know what the issue is. Initially when i started this i had lots of issues with mysql as well and it turned out that i need to check one box in the jail. check that you have the “enable mount devfs” check ticked.

    • @jenkinsm74:disqus
      Hi Mark

      i’ve been racking my brain and i think i know what the issue is. Initially when i started this i had lots of issues with mysql as well and it turned out that i need to check one box in the jail.

      check that you have the “enable mount devfs” check ticked.

  • disqus.os

    hey there,

    absolutely great tutorials !!!

    I managed successfully to setup thebrig and install the latest owncloud !! now what seems to be getting me some issue is how to use one of my zfs datasets (holding my own photografs) to be used as preconfigured LOCAL “external memory” from within OwnCloud..
    Within TheBrig jail settings I :
    1. added “allow.moint.zfs” into “In jail allow” section of parameters
    2. ticked “Enable mount zfs dataset” and also added the mentioned picture dataset with mountpoint “/mnt”
    from which I think that would be the “/mnt” folder in the jail… right ??? But this does not seem to work at all

    I can save and APPLY those settings but then no mounts appear in /mnt… also when stopping/starting the jail would not work suddenly.. seems pressing the button (start/stop) does not work.. even after reboot of my Nas4Free server..

    Any help would be much appreciated


    • Hey Oliver sorry for the late reply have been away for a bit. Have you managed to sort this issue out?

      • disqus.os

        Good afternoon to you (well at least here in germany 😉

        thank’s for getting back… and no prob for beeing late of course !!!

        Well to answer your question: Yes and No 😉

        for the YES part:

        I got further with Owncloud in a jail… using ” only fstab command
        and NOT using the ZFS mounting feature provided by TheBrig GUI… no
        idea what these settings are for .. or simply not functioning yet but in
        later versions of TheBrig… ??

        – Anyhow, got it to work with
        “manually” adding “/mnt/POOL1/pictures
        /mnt/POOL1/jail/TheBrig/owncloudjail/mnt/TEST nullfs ro 0 0” within
        TheBrig GUI but also needed
        the user www to be included into the
        wheel group “pw groupmod wheel -m www” in order to be accessible from
        within owncloud (I have my ZFS picture dataset owned by root and group

        Now, for the NO part:

        – To me, using owncloud in
        the jail, even from withgin only my own home network, seemd to be
        incredibly SLOW and completely useless.. watching pictures with my iPad
        using local OwnCloud with Gallery+ App… It takes ages to show only
        one folder with pictures (from my ZFS picture dataset).

        -So I
        thought to compare the JAIL install with a regular Owncloud install on
        Nas4Free using the “regular” WebServer service. Unfortunately usin this
        way of installing..
        a.) only SQLight but not MySQL is available (without further complicated installs of MySql)
        b.) access to my ZFS dataset does not seem to work using the same way (user permissions) as used above in The JAILED install..
        “pw groupmod wheel -m www” did not give me access to view the mount…
        although owncloud accepted the mounting as beeing correct (link wise at
        least 😉

        – So at the moment I got stuck with setting correct user permissions for the picture zfs dataset …… Any suggestions ??

        Many many thank’s,


        • @disqusos:disqus hmm i’m not too sure why you’re having that issue. have you watched my video on installing owncloud on the nas (outside of the jail) it should be pretty straight forward.

          • disqus.os

            yes I did 😉 and everything regarding the install worked fine… up
            to the point, which you are actually not describing, … when I try to
            “access” my ZFS dataset from within Owncloud (admin settings by adding a
            “LOCAL” external share”)… I can’t figure out the correct group/user
            permissions for actually viewing the picture contents in th before
            mentioned ZFS datasets 🙁

          • @disqusos:disqus hehe yeah i don’t actually use datasets much i just use the pool and create the folders i need in the pool especially at home. have you tried that rather than using the datasets as they seem to be giving you much grief 🙂

          • @disqusos:disqus just touching base to see how you’re coming along with it all?