Simple Owncloud Installation on Raspberry Pi 2

The Raspberry Pi’s low power consumption makes it well suited to the role of always-on server. This post describes how to install Owncloud onto the Pi. Owncloud is an open source software package providing remote file sharing services, similar to Dropbox. But with Owncloud, you retain ownership, security and control of the shared data. Owncloud works well on a Pi 2 and Pi 3 but will run very slowly on a Pi 1.

Update 20th November 2016 – There is a newer version of this article. Please see Simple Nextcloud Installation on Raspberry Pi. Nextcloud was forked from ownCloud in June 2016. It now seems to have become the natural successor to Owncloud. I recommend using Nextcloud rather than Owncloud. This article remains on line because it might be helpful to existing Owncloud users, particularly the parts about upgrading and using external USB media.

UPDATE 16th July 2016 – Nextcloud was forked from Owncloud in June 2016. The procedure below can be used both for Owncloud and the initial release of Nextcloud (version 9.0.52). Thanks to Dan for this information.

My Raspberry Pi 2 was purchased from RS Components in the UK. It was installed with Raspbian “Jessie” (Debian 8) by applying the image “2016-02-09-raspbian-jessie.img” downloaded from the raspberrypi.org downloads page. The following procedure was then performed without any further pre-work (other than enabling ssh in the basic setup).

NOTE: The below procedure describes how to install Owncloud version 9.0.1, the latest version at the time of writing (26th April 2016), but it should work for later/future versions too.

NOTE:Owncloud 9.0.1 is supported on Jessie but not seem to function fully on Wheezy. I experienced problems when testing it on Wheezy and would not recommend installing it on that version of the OS. Upgrade your Pi to Jessie instead, then install Owncloud 9.0.1.

NOTE: If you have already installed Owncloud 8.0 or 8.1, it can easily be upgraded to version 8.2.2. A section near the end of the article describes how to do this. See “Upgrading Owncloud to Version 8.2”. The same procedure also works, with slight alteration, for Owncloud 9. See “Upgrading Owncloud to Version 9.0.1”

NOTE: If you are already running Owncloud and you just want to know how to move the data directory, please see the section “Moving the Owncloud Data Directory”.

NOTE: This procedure was performed on a Pi 2 (the quad-core version of the Pi released in January 2015). It would probably also work on the older, single core Pi, but Owncloud performance would likely be very slow.

Install Apache Web Server

Log into your Pi, either directly or through ssh from another system. I am using ssh. Update the software sources as follows.
$ sudo apt-get update

Install the Apache web server:
$ sudo apt-get install apache2

When asked if you want to continue, type “y” for “yes”. Apache will be installed along with a number of other packages.

In a browser, surf to the IP address of your Raspberry Pi. If you see a page entitled “Apache 2 Debian Default Page”, then Apache is running correctly on the Raspberry Pi. For example, my Pi is using IP address 192.168.1.78. So I start a browser on my PC and surf to http://192.168.1.78/. Alternatively, if you are using the Pi’s graphical desktop, you could start a browser directly on the Pi, eg. Netsurf.

Raspbian Jessie (Debian 8) and Raspbian Wheezy (Debian 7)

Note: If you are using the older version of Raspbian, called Raspbian Wheezy, based on Debian 7, the page you will see is mostly white and has “It Works!” written at the top. You can tell what version of Debian/Raspbian you are using by typing cat /etc/os-release. If you are using version 8 it will say “VERSION=”8 (jessie)”. Whereas if you are using 7, it will say “VERSION=”7 (wheezy)”.

If your Pi is running Raspbian Wheezy/Debian 7, I would recommend you re-image it with Raspbian Jessie instead. However, if you want to stick to Wheezy for now, perform the extra steps below, then continue with the rest of the procedure.

If you are running Raspbian Jessie / Debian 8, skip straight to the next section, “Install PHP5 and Associated Packages”.

For Raspbian Wheezy / Debian 7 Users Only: Reconfigure Apache

If you are still using Debian 7, perform the following steps to change the Apache “document root”, that is, the default location where Apache expects web files to be. This is needed because Apache 2.2 (which comes with Debian 7) is configured slightly differently to Apache 2.4 (which comes with Debian 8).

Edit the default configuration file
$ sudo vi /etc/apache2/sites-available/default

Change the following lines:

DocumentRoot /var/www

<Directory /var/www>

to

DocumentRoot /var/www/html

<Directory /var/www/html>

and save the file.

Move the default Apache index file

$ cd /var/www
$ sudo mkdir html
$ sudo mv index.html html
$ sudo chmod 755 html

Restart Apache
$ service apache2 restart

That is the end of the special section for Debian 7 users. The rest of the procedure is the same whether you are using Wheezy or Jessie.

Install PHP5 and Associated Packages

Owncloud requires PHP 5 and few other packages. Install them as follows.

$ sudo apt-get install php5
$ sudo apt-get install php5-gd
$ sudo apt-get install sqlite
$ sudo apt-get install php5-sqlite
$ sudo apt-get install php5-curl

The software will be installed, along with other dependent packages. You might see several messages about Apache restarting.

Restart Apache

Restart the web server now with
$ sudo service apache2 restart

Install Owncloud

Okay, the system is ready for Owncloud to be installed. It is possible to install Owncloud using the apt-get command, but instead we are going to use a manual method, for reasons which will be explained later.

Surf to the Owncloud download page and click on the “Archive File for Server Owners” tab. Download the .zip file. Then copy it to the Raspberry Pi.

Alternatively, get the file on one step with this command on your Pi:

$ wget https://download.owncloud.org/community/owncloud-9.0.1.zip

At the time of writing (26th April 2016), the latest version of Owncloud is 9.0.1. The version, and the link to download it, might have changed by the time you read this article. If so, just change the link accordingly (check it at the download page above).

Now move the Owncloud package into place and unpack it:

$ sudo mv owncloud-9.0.1.zip /var/www/html
$ cd /var/www/html
$ sudo unzip -q owncloud-9.0.1.zip

Create the Data Directory

You must create a “data” folder for Owncloud and set permissions. Proceed as follows.

$ sudo mkdir /var/www/html/owncloud/data
$ sudo chown www-data:www-data /var/www/html/owncloud/data
$ sudo chmod 750 /var/www/html/owncloud/data

Create a Login for Owncloud

In a browser, surf to your new Owncloud web page. Use the URL:
http://your Pis IP address/owncloud

For example, the address of my Pi is 192.168.1.78. So I go the the URL: http://192.168.1.78/owncloud

You should see a mostly dark blue login page. Near the bottom is a “Performance Warning” about Sqlite. Ignore that. Near the top it says “Create an admin account”. Think of a user name and password and type them into the boxes provided. Then click on the “Finish Setup” button.

Hey Presto! After a short delay, you should see the Owncloud intro page with “Welcome to Owncloud” dialogue. Click the cross at the top right of the dialogue to dismiss it, and you should now be looking at the main Owncloud “Files” page. There you see a couple of folders and a PDF Owncloud Manual.

Configure Owncloud

Upload a file to Owncloud as follows. Click on the square button containing a plus sign (“+”) near the top of the page. A drop down menu appears. Choose the first menu item, “Upload”, and select a file. The file will be transferred and you should see it appear in the Owncloud list of files. However, if the file was more than 2 MB in size, it will not upload. Instead a message will appear at the top of the screen – “Total file size XX MB exceeds upload limit 2 MB”.

By default, the maximum size of file that can be uploaded is 2 MB, which is not enough for many people, Increase it as follows.

Edit the file /etc/php5/apache2/php.ini:
$ sudo vi /etc/php5/apache2/php.ini

Change these two lines:
post_max_size = 8M
upload_max_filesize = 2M

to:

post_max_size = 20M
upload_max_filesize = 20M

and save the file. Note: if you are having difficulty finding these settings in the file, they are at lines 660 and 810 respectively.

Restart Apache:
$ sudo service apache2 restart

And refresh your browser page. The upload limit should have increased to 20 megabytes, which you can verify by trying another upload, as above.

Conclusion

That is the end of the procedure for installing Owncloud. Your Owncloud installation should now be fully working. I hope this guide was easy to follow and not too long or fiddly.

There follows a section in moving the Owncloud data directory, followed by another section on upgrading Owncloud to the latest version.


Move the Owncloud Data Directory (optional)

Some readers have asked about moving the Owncloud data. For example: to another part of the file system or on to an external drive or USB stick. There are a couple of reasons you might choose to do this. Firstly for added security. Secondly because moving the data to an external USB drive could provide much more storage space than the Pi’s SD card.

To move the data to an external USB stick, proceed as follows. I am going to use a 2GB USB stick (aka thumb drive). If you are using an external spinning disk, the procedure would be the same.

Warning: The procedure involves reformatting your USB drive, which will destroy any data already existing on there. The formatting is necessary to make the drive’s file system of type ext4. If the file system were of type NTFS, for example, or VFAT, we would encouter problems with setting the ownerships and permissions on the Owncloud data, and a much longer procedure would be required to make Owncloud work with the USB drive.

If the file system type of your USB drive is already ext4 (or ext3 or ext2), you can skip the reformatting step and go straight to the section headed “Copy the Data”. Existing data on your USB drive would then be unaffected. If you want to check the existing file system type, use the blkid command.

Insert and format the drive

Plug your drive into a free USB port on the Pi. At the command line, check it with lsusb:

$ lsusb
...
Bus 001 Device 006: ID 13fe:1a00 Kingston Technology Company Inc. 512MB/1GB Flash Drive

There it is. Now use fdisk to identify the device name. Note that fdisk might also print a lot of stuff about “/dev/ram”, which can just be ignored.

$ sudo fdisk -l
Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1        8192  131071  122880   60M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      131072 2848767 2717696  1.3G 83 Linux

Disk /dev/sda: 1.9 GiB, 2063597568 bytes, 4030464 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc12da75b

Device     Boot Start     End Sectors  Size Id Type
/dev/sda1        2048 4030463 4028416  1.9G 83 Linux

The thumb drive is the device /dev/sda and the partition within it is /dev/sda1. We know this because fdisk reports the size as 2GB (“2063 MB”), and my thumb drive is the only 2GB drive connected to the system.

Format the Drive

Format the drive as ext4. This is the recommended file system type for Linux. Take care to get this command right, and not to accidentally format the wrong partition.

$ sudo mkfs -t ext4 /dev/sda1

As it works, mkfs prints a lot of stuff about blocks and inodes.

Copy the Data

Mount the newly formatted drive.
$ sudo mkdir /disk
$ sudo mount /dev/sda1 /disk

Use the df command to confirm that the disk mounted correctly.

$ df
...
/dev/sda1 1949776 2952 1829732 1% /disk

We can see that the device /dev/sda1 has mounted correctly at /disk. Create a folder for Owncloud:

$ sudo mkdir /disk/owncloud

Copy the Owncloud data as follows.

$ cd /var/www/html/owncloud
$ sudo cp -rp data /disk/owncloud/data

Check the copied data. Notice the ownerships and permissions have been correctly retained. This is important for Owncloud.

$ sudo ls -l /disk/owncloud/data
-rw-r--r-- 1 www-data www-data     0 Feb 16 11:23 index.html
drwxr-xr-x 4 www-data www-data  4096 Feb 16 11:27 fred
-rw-r--r-- 1 www-data www-data 93184 Feb 16 11:50 owncloud.db
-rw-r--r-- 1 www-data www-data     0 Feb 16 11:18 owncloud.log
drwxr-xr-x 2 www-data www-data  4096 Feb 16 11:23 updater_backup

Reconfigure Owncloud

Proceed as follows to tell Owncloud where you have moved the data to.

$ sudo vi /var/www/html/owncloud/config/config.php

Change the line
'datadirectory' => '/var/www/html/owncloud/data',

to
'datadirectory' => '/disk/owncloud/data',

and save the file.

Test

Finally, in your browser, log out of Owncloud if you are logged in, then reload the page and log into Owncloud again. You should see your files and folders as before, but now they are stored in the new location, eg. on the external storage.

Backup

Because we copied the data above (with cp), instead of moving it (eg. with mv), the old copy of the data still exists at its old location. Once you are satisfied that Owncloud seems to be working okay, delete that old copy of the data. Or move it and retain as a handy backup.

$ sudo rm -rf /var/www/html/owncloud/data

or

$ sudo mv /var/www/html/owncloud/data /home/pi/old_owncloud_data

This is the end of the section about moving the Owncloud data.


Upgrading Owncloud to Version 8.2.2 (on Wheezy)

Owncloud 8.2.2 was released on December 2015. If you have an older version already installed (for example 8.0 or 8.1) and want to upgrade to 8.2.2, proceed as follows.

In summary, the procedure is just to replace the Owncloud 8.1 software with the 8.2.2 version, while preserving your data and copying over the configuration file. In order to avoid confusion, please enter the commands below carefully, and in the order shown.

Note: For this upgrade procedure, I have assumed that your Pi is running Raspbian Wheezy / Debian 7, since this is the OS version you are most likely using if you have a requirement to upgrade Owncloud from 8.0 or 8.1 to version 8.2.2. The only material difference between the two, as it affects this procedure, is that the default web root is /var/www on Debian 7 and /var/www/html on Debian 8.

Obtain Owncloud 8.2.2

Surf to the Owncloud download page and click on “Archive File for Server Owners”. Download the .tar.bz2 file. Then copy it to the Raspberry Pi.

Alternatively, login to your Pi and get the file on one step with this command:
$ wget https://download.owncloud.org/community/owncloud-8.2.2.tar.bz2

Move it into place:
$ sudo mv owncloud-8.2.2.tar.bz2 /var/www

Rename the old software. This will stop Owncloud 8.1 from operating but the configs and data will be kept:
$ cd /var/www
$ sudo mv owncloud owncloud.old

Now unpack the new software:
$ sudo bunzip2 owncloud-8.2.2.tar.bz2
$ sudo tar -xf owncloud-8.2.2.tar

At this point, we have a directory called “owncloud” containing the new Owncloud 8.2.2 software, and another directory called “owncloud.old” containing the old version, Owncloud.8.1.

$ ls
index.html owncloud owncloud-8.2.2.tar owncloud.old

In order to preserve any configuration changes you might have made to Owncloud in the past (for example: moving the “data” directory onto a USB stick, as described above), it is necessary to copy over the configuration file from the old Owncloud installation to the new one. Proceed as follows.

$ cd /var/www/owncloud/config
$ sudo mv config.php config.php.org
$ sudo cp -p /var/www/owncloud.old/config/config.php .

Don’t forget the dot at the end of the last line. These 3 commands move the default config file that comes with Owncloud 8.2.2 out of the way (to an “org” version), and copy over the config file from the old version of Owncloud (8.1) into its place, thus preserving your original Owncloud configuration.

If you have previously moved your data to a separate place, (such as an external USB stick as described above), then you are pretty much finished the upgrade. If your data was never moved, and is still in the default location, copy it over now with these commands.

$ cd /var/www/owncloud
$ sudo cp -rp /var/www/owncloud.old/data .

Now, in a browser, surf to your Owncloud page. Or if you are already looking at it, just reload the page. You should see a message saying “ownCloud will be updated to version 8.2.2” and a button labelled “Start upgrade“. There is also a message about making sure you have backups. We do have backups, because, following the procedure so far, a copy of the data has been preserved under the old installation.

Click the “Start upgrade” button.

Messages will appear in your browser as follows.

Updating ownCloud to version 8.2.2, this may take a while.

Preparing update
Set log level to debug - current level: "Warning"
Turned on maintenance mode
Checking whether the database schema can be updated (this can take a long time depending on the database size)
Checked database schema update
Checking updates of apps
Checking whether the database schema for files_trashbin can be updated (this can take a long time depending on the database size)
Checked database schema update for apps
Updating database schema
Updated database
Updated "files_texteditor" to 2.0
Updated "gallery" to 14.2.0
Updated "files" to 1.2.0

After a few seconds, you should be looking at your files under Owncloud 8.2.2. All of your old data should be there.

Verify that you are running Owncloud 8.2.2 by clicking the drop down menu at the top right (your Owncloud login name). Select Personal, the first item in the menu. A new page will load. Scroll down the the very bottom of the page and you should see:

Version
ownCloud 8.2.2 (stable)

The upgrade is now complete.

This is the end of the section explaining how to upgrade Owncloud.


Upgrading Owncloud to Version 9.0.1 (Jessie only)

Owncloud 9.0.1 was released on 6th April 2016. If you have an older version already installed (for example 8.2.3) and want to upgrade to 9.0.1, follow exactly the same procedure as for “Upgrading Owncloud to Version 8.2.2” above, with two modifications:

– Replace “/var/www” with “/var/www/html”.

– Obviously, replace “8.2.2” with “9.0.1”.

NOTE: Owncloud 9.0.1 seems to be compatible with Raspbian Jessie only, it is not supported on Wheezy and I experienced problems when testing it on that version of the operating system. Do not upgrade to Owncloud 9 of you are using Raspbian Wheezy. Instead, upgrade to Jessie first, then install Owncloud 9.

Conclusion

I hope this guide was easy to follow and not too long or fiddly. Your Owncloud installation should now be fully working.

Using Owncloud, you can share data between devices in your house. For example, upload a file from your smart phone or tablet using your home wireless network. On the smart phone, surf to your Owncloud address (as above). Click on upload, and select your file. This is one way of getting smart phone videos and pictures onto your PC without needing an app or cable.

A Note on Security

Owncloud can also be used to share files across the Internet of course. This is one of its best features. Sharing across the Internet (that is, accessing Owncloud on your Pi from a remote location, such as your work) requires that you make your Pi “Internet facing” – by forwarding port 80 from your router. But before doing so, you should be aware of the attendant security risks and some of the measures needed to address them.

“Security hardening” (as it is called) is beyond the scope of this article. But a few common security measures are mentioned below. I would strongly recommend that you learn about and implement at least some of them before exposing your Pi/Owncloud installation directly to the Internet.

Having forwarded port 80 to your Pi, you can expect hackers on the Internet to try to log in to your Owncloud installation by guessing the name and password you chose above. Make both of them difficult to guess. In particular the password should be very long. Secondly, set up an http digest password in Apache. That password would then have to be typed in correctly before the Owncloud login screen is even displayed.

Thirdly, rename your Owncloud folder to something different. Instead of /var/www/owncloud, make it something like /var/www/something/johns_owncloud_24232. Hackers are then unlikely even to detect your Owncloud installation. Incidentally, this is why Owncloud was installed manually above, and not with apt-get. The manual install allows the Owncloud folder to be renamed. An apt-get install would not, because it would break your installation at the next automatic update.

Fourthly, obtain a certificate and use it to convert your site to https. Fifthly, consider running Apache on a high, obscure port number. High ports are scanned and probed far less often than port 80, which is very well known. If you do this, note that some firewalls may block it, eg. the firewall at your workplace.

170 thoughts on “Simple Owncloud Installation on Raspberry Pi 2

    • UPDATE: Article amended to include an optional section on moving the Owncloud data.

      To explain: M is talking about moving the /var/www/owncloud/data directory to somewhere that is not under /var/www. It’s another security measure that users might like to try, especially if they are exposing Owncloud to the Internet. The procedure involves moving the directory and making one or two small changes to the Owncloud Configuration.

      /var/www is, by default, the web server root, and any files under it are potentially visible to site visitors. Although existing Owncloud security (.htaccess) should prevent that. Moving the data away from /var/www is a further guard against unauthorized access. Consider it alongside other measures mentioned in the last part of the article. Remember, you don’t need all of these security measures, but some of them should be implemented if your Pi is Internet facing.

  1. I have problem of error.
    ‘PRAGMA journal_mode = WAL’: SQLSTATE[HY000]: General error: 13 database or disk is full
    how can i fix the error.

    • A strange error jtpark. Assuming your disk is not actually full (you checked, right?), it sounds like a problem with the SQLite files that Owncloud uses to store data. I would advise to re-image your SD card with a fresh Raspbian install and start the procedure again (in case the cause was file system related).

      If that is not desirable, Google for “General error: 13 database or disk is full”, it returns a lot of good ideas about this problem. Sorry I can’t give a more precise answer.

      • thank you for your advice! I fix the error. Re-extend my memory card and then i can join owncloud.
        But, I have one more error. ‘.htaccess’ file don’t work.
        And, i can’t join external ip and USB HDD. It work very nice when I use owncloud7 and pi b+. Can you give me some advice?

  2. I just bought by RPi this weekend and would like to try this tonight, but I’m curious to know how I might make an external USB HDD the drive that Owncloud will use for uploading files. Do I simply make the data folder on a my external drive once I have that drive mounted?

    My reason for asking is that I would like to be able to able to keep my sd card from handling the job, and to have much more space (my usb drive is 2 TB.)

    Thank you.

    • Hi Justin. I have just updated the article with a procedure for moving the Owncloud data, for example to an external USB drive.

      • Thank you very much! This was extremely helpful. I’ve had to start from scratch about 7 times on this whole thing, but I’m learning a lot in the process.

    • UPDATE 1st August 2015: I have added a section entitled “Upgrading Owncloud 8.0 to Version 8.1”.

      Give it a whirl. It is quite a quick process.

  3. I was able to get to install OwnCloud. But from there I had trouble on understanding what you do next to move it. Could you help me understand the next step? I’m looking to set this up as alternative DropBox and access it from my work computer and iPhone. Is this possible? Thanks!

    • Hi WillRob, if you are talking about moving the folder Owncloud uses for storing data, I have just updated the article with a procedure describing how to do it.

      • Thanks for responding. I was talking about the section that states, “Now move the Owncloud package into place and unpack it:”. I could not figure out how to get through these steps and then return to the root section. Also could you help me understand if this is possible to access from my iPhone and use an External HDD?

        • It should be possible to access from your iPhone, yes. I access Owncloud from my Android phone without a problem. I don’t bother with the app, I just use the phone’s browser.

          Sorry, I am not sure what you mean by “return to the root section”.

          • I am new at this and I apologize now for the lack of skills in figuring this out. I follow the command, “cd /var/www” and it seems to take me to another directory. I follow your commands from there, but each one I enter seems like it does nothing. Any suggestions on what is happening here? Is there a way to go back in directories? Maybe I’m typing something wrong. Thanks!

  4. Hi WillRob. The commands might not produce any output, but that doesn’t mean they haven’t done anything. Many commands in Linux do things without printing a message. If you typed the commands shown, and no message appeared, that is correct. That is what is meant to happen.

    It might be a good idea to learn a bit more about navigating directories on the command line before attempting the procedure above. A few basic commands are

    cd – go to your home directory
    cd dirname – go into subdirectory called dirname
    cd /some/directory – go to /some/directory
    cd .. – go to the parent directory

    Better explanations here http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html

    • Jim,
      Thank you this helps a lot and makes much more sense. So after this step, and after the command, “sudo tar xf owncloud-8.0.0.tar”. Do I need to go back to home directory or parent directory to create a data directory?

      • Just continue to enter commands as they appear in the article. It doesn’t matter what directory you are in, because the commands all use “fully qualified path names”, ie. paths that begin with a slash. The effect of typing each command will be the same regardless of what dorectory you happen to be in.

  5. Hello. I currently own a RPi, and it’s quite slow. I use Bittorrent Sync to keep my computers all synced up with attached USB drives. Performance (read / write) is never faster than 1.6/1.7MB/s… It’s QUITE slow. I’m thinking of upgrading to either the RPi 2 or Banana Pi. Banana Pi has Gigabit ethernet, while RP2 has faster processors. Which would make the biggest difference to run BTSync and Owncloud?

    I recently formatted my HD and syncing back all my data is a REALLY big bother! SO SLOW!

    Thank you and excellent tutorial 🙂

    • Hi Kent. Upgrading to a Pi 2 will improve Owncloud performance because all PHP scripts and javascript will execute faster. Banana Pi is less likely to improve performance, because download speeds are not the limiting factor here (ie not the bottleneck). Also, the Banana’s network performance is likely to be limited by the speed of its CPU. Unfortunately I can’t comment on BTSync, as I have not used it and it will depend on your overall setup. But I highly recommend the Pi 2.

  6. I’m having a little trouble with the very last part of this tutorial. As soon as soon as I change the owncloud directory I get ‘Internal server error’ when I try to log in through my browser. Any suggestions?

  7. Thanks for the tutorial. I’m having a little trouble though. My setup was going smoothly until I tried to change the data directory to my hdd. As soon as I try to log back in through my browser I keep getting an ‘Internal server error’. I’ve tried switching everything back to default and it all works fine again. Any suggestions?

    • Hi absolute, I am not sure what might be causing this error, I didn’t encounter it. Try checking the config.php file again for syntax errors. Also check the permissions on the data.

      • I think i made an error around the hdd mounting area. I think I’ll start again from scratch. Thanks for the suggestions, they got me out of a loop of trying the same things again and again!

    • Hi Rob. The /owncloud subdir should have been created by the command “sudo tar xf owncloud-8.0.0.tar”, which comes just a few commands before the “create a login for owncloud” bit. Check that the directory /var/www/owncloud exists, and that it contains other files and directories. If it exists, check the ownerships and permissions on it.

      (By the way your comment was delayed by my anti-spam software, which is why it might not have appeared for a couple of days.)

      • Hi Thx for your tutorial.
        I’m havig same issue as Rob. The owncloud/ directory is created under /var/www/html (if I followed everything right) Permissions were also checked:
        drwxrwxr-x 15 www-data www-data 4096 May 22 21:52 owncloud
        Can’t find the error. Could you give me a clue? Thx in advance!
        Ben

        • Hi Ben

          I need a little more information. What problem are you having ? The web page doesn’t appear when you surf to it ? What version of Raspbian are you using, wheezy or Jessie?

          • Hi!
            I’m using Jessie and my problem is that I can see the default Apache server page but I got a 404 when I try to open http:// pi-ip /owncloud. As far as I understand it should be visible because:
            sudo chown www-data:www-data /var/www/html/owncloud/data
            sudo chmod 750 /var/www/html/owncloud/data

            but there is no way to access it. I always get a 404. I tried moving the folder to the superior level (/var/www/owncloud) but there is also no difference.

            Anyway this is a great tutorial…I’m a bit rusty 😛
            Thx!!!!!!

          • Hi Ben

            You say you still get a 404 when trying to open http://pi-ip/owncloud. That is odd. It should definitely work. I have just run the procedure again on a new install of Raspbian 8 and it was fine. Please try the following (after you move the owncloud directory back to its correct location).

            1. Just after you get the 404, do a “tail” on the log file /var/log/apache2/access.log. You should see an entry corresponding to the 404 error. Post it here.

            2. Please post the output of the following commands:

            ls -l /var/www/html/owncloud
            grep -i grep -i documentroot /etc/apache2/sites-enabled/000-default.conf

            Cheers,
            Jim.

          • Hi!
            Just to tell you it’s solved.
            I started from scratch and no problem at all!
            Greeeeaaat tutorial!
            Thx again!

  8. hi.
    I have follow your guide and everything is working perfect except i cant move the data directory. I get stuck here: mkdir: cannot create directory `/disk/owncloud’: Read-only file system

    any1 knows how to fix that?

    Regards Tomas

    • Hi Tomas. It sounds like your disk has been mounted read-only, and so you can’t create data on there. This might be caused by the disk file system being of type NTFS. In order to use NTFS file systems, you have to install the ntfs-3g package. The answer could be as simple as typing “sudo apt-get install ntfs-3g”. However there might be other causes. For more information, see the following:

      https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=22957

  9. Hallo, I read your article and I was wondering about the performance. How fast does the pages load. Because I have a raspberry pie 1 model b and it slow it about 10 second for a page load and switching between settings pages takes about 35 seconds to load the page the upload however is pretty decent. So I wonder if I get big improvement if I upgrade to a raspberry pie 2 model b+ because I am considering.

    • Hi Cihat. A Raspberry Pi 2 should run Owncloud about 3 or 4 times faster than the Pi 1. I just tried a couple of tests. On my Pi 2 it takes about 2 seconds to browse into a sub folder. Selecting an option from the left hand pane in “files” takes about 8 seconds to load. I would definitely recommend getting a Pi 2 if you can. Owncloud is a bit too slow to be useful on a Pi 1.

  10. When I go to http://MyIPaddress/owncloud to dont get the blue page discussed. I get the following.

    <?php

    /**
    * ownCloud
    *
    * @author Frank Karlitschek
    * @copyright 2010 Frank Karlitschek karlitschek@kde.org
    *
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
    * License as published by the Free Software Foundation; either
    * version 3 of the License, or any later version.
    *

    Looks to me like php5 did not load correctly.
    Any ideas?

    • Hi Scott. (I have shortened your comment to remove most of the PHP script). What you are seeing is the index.php file from the top level of the owncloud installation. However, it is being displayed as text rather than executed, which suggests that PHP is not installed on your Pi. Did php5 install correctly ? Check it with php -v, you should see something like this:

      pi@raspberrypi2 /var/www/owncloud/config $ php -v
      PHP 5.4.36-0+deb7u3 (cli) (built: Jan 13 2015 01:07:43)
      Copyright (c) 1997-2014 The PHP Group
      Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

      If not, repeat the section of the procedure entitled “Install PHP5 and Associated Packages”.

      Cheers,
      Jim

  11. By far, the best / straightforward guide to setup Owncloud 8.0.0 on a Raspberry Pi.
    Moving to a Raspberry Pi 2 soon to improve performance of owncloud. 🙂

    (Maybe for people who just copy/paste commands from your guide, there’s a small typo when installing PHP5) :
    $ sudp apt-get install php5-curl
    should be:
    $ sudo apt-get install php5-curl

  12. Hi,

    Thank for the great tutorial, i have follow every step and its working great.

    Although can you help me put my cloud up on the internet? So i can access it via internet also i have search for ssl certificate key thing but there is no great walk through step by step tutorial. Can you help me on that?

    Thank in advance

  13. Hi Hoe. Accessing Owncloud from the Internet requires a setting on your Internet router to forward a port to your Pi. It is quite easy but varies from router to router, I would search Google for “port forwarding” and the name of your router.

    Regarding security, it is quite easy to put a password on your website, that users will have to type in before the Owncloud password. You will have to enable the digest module in apache (“a2enmod auth_digest”), then use the htdigest command to create the password, and edit your Apache config files to point to the password file. A detailed procedure is beyond the scope of this article, but there are plenty of guides on the Internet.

    Similary, you can generate a certificate with openssl, and make your site into “https”. Again, there are plenty of guides for that on the Internet,

    • Hi,

      Thank you for your replied. I have one more issue, right now I am mounting my USB Drive and copies data and its permission as your tutorial, when input the command instead of this

      $ sudo ls -l /disk/owncloud/data
      -rw-r–r– 1 www-data www-data 0 Feb 21 19:01 index.html
      drwxr-xr-x 5 www-data www-data 4096 Feb 21 19:50 fred
      -rw-r–r– 1 www-data www-data 99328 Mar 28 16:06 owncloud.db
      -rw-r—– 1 www-data www-data 1487 Mar 28 15:04 owncloud.log

      • I get this instead…

        Please help me

        pi@raspberrypi ~ $ sudo ls -l /media/Drive/owncloud/data
        total 96
        drwxrwx— 1 pi pi 0 May 10 05:19 admin
        drwxrwx— 1 pi pi 4096 May 10 14:17 data
        -rwxrwx— 1 pi pi 0 May 10 05:20 index.html
        -rwxrwx— 1 pi pi 89088 May 10 11:38 owncloud.db
        -rwxrwx— 1 pi pi 2160 May 10 11:34 owncloud.log

        • Hi Hoe. I think your copy command has gone slightly wrong, resulting in an extra “data” directory underneath the proper “data” directory. That is, you now have a directory /media/Drive/owncloud/data/data when it should just be /media/Drive/owncloud/data.

          This might be because you accidentally typed “sudo mkdir /disk/owncloud/data” in the previous command instead “sudo mkdir /disk/owncloud”.

          Without being there it is difficult to give the exact commands that will fix this, but you need to move /media/Drive/owncloud/data/data up one level, somehow, if you see what I mean. If the data directory contains real data that is valuable to you, take care not to lose it.

  14. I am looking to install this on my Pi2. My question is regarding the download of OwnCloud vs installing it via a repository and apt-get.

    I see your explanation as to why you chose one over the other (the changing of the directory name for security, but then doesn’t this leave me unable to install updates?

    Concerned about security, I would like to think that new versions address security issues, in the same way that the changing of the directory name addresses security concerns. Can you weigh out the pros and cons to help a newbie like me?

    ((and instructions on how to configure and use the apt-get to the repository, if appropriate would be helpful).

    Thanks.

    • Hi Len please see my response to Giancarlo who asked the same thing above (search this page for “Giancarlo”). You can still update Owncloud easily, even though it wasn’t installed with apt-get, so keeping Owncloud up to date shouldn’t be an issue.

      I would recommend staying in the latest stable version of Owncloud for security, especially if you intend to access it from the Internet. However this is probably less important that the other security measures mentioned in the last section of the article, entitled “A Note on Security”.

  15. Good morning
    I want to change the drive to a 1 TB and I followed the procedure, I’m very new in this environment:
    Change the line
    ‘datadirectory’ => ‘/var/www/owncloud/data’,
    to
    ‘datadirectory’ => ‘/disk/owncloud/data’,

    and save the file.

    Please, could you explain, how to save the file? ?

    • It depends which editor you are using Robert. I would recommend getting comfortable with editing and saving files before attempting the procedure above. File editing is used for so many tasks in Unix/Linux. Just google “how to save file in” and the name of your editor, eg. vi, emacs, or whatever it is you are using. Sorry I can’t be more specific.

      • Thank you for your response.
        The problem is, that I can’t open the file to edit it with the text editor. I’m using FXterminal. I googled it already before, but still no clue how to get this done.
        Maybe anybody else can give me a short explanation?
        best
        Robert

        • You use an editor to edit the file, such as nano or vi. To edit the file, just type “nano” or “vi” in the terminal followed by the name of the file you want to edit. For more help, Google for “edit a file in linux”.

  16. I installed raspberian from NOOBS (fresh download and install), then installed apache2

    But when i try to install from these lines,

    $ sudo apt-get install php5
    $ sudo apt-get install php5-gd

    It gives me an error that it cant find the link for that file , so the installation cannot proceed.

    Do i continue with the owncloud istallation or it will not work without
    Php an sqlite ?

    And why we need them ? Is that important ?

    • Hello Max. Owncloud will not work without PHP. I am not sure what you mean by “cannot find the link”. Please post the *exact” error message that you encountered when typing these commands. Cheers.

  17. I tried this on a RPI and it worked fine – however a few weeks later when I tried to set it up again I get the error “Error while trying to create admin user: An exception occurred while executing ‘PRAGMA journal_mode = WAL’: SQLSTATE[HY000]: General error: 13 database or disk is full”

    I’ve reflashed twice and tried the process exactly the same both times.

    The problem appears to be caused AFTER entering
    $ sudo mkdir /var/www/owncloud/data
    $ sudo chown www-data:www-data /var/www/owncloud/data
    $ sudo chmod 750 /var/www/owncloud/data

  18. Great tutorial, easy to follow. But I have a question regarding moving the data folder to an external drive. How can this be done to a drive that already has files on it. Say a music folder?

    • There should be no problem with that Mark. The music files can be on the same disk, so long as they are in a different folder to the Owncloud stuff.

  19. Hi,
    thanks four your tutorial, works fine for me,
    one question:
    everytime i restart or shut down the PI i have to manually remount the usb disk…
    is it possible to automount it on startup?

    thanks

  20. I cannot login after setting up everything, as I changed the location of owncloud data to the sharefolder.

    how can I remove/reinstall owncloud??

    I want to do the fresh installation without changing the rasp img as I have configured other things there.

    Appreciate the help!!

    • Hi Masood. I am not sure why you can’t login. However if you want to remove Owncloud, simply remove the Owncloud directory, for example with the rm command: rm /var/www/owncloud

      Then re-install by following the procedure again.

  21. Hi! Great guide, I really want to setup my owncloud with raspberry 2, I just have 2 questions.

    1. why are you using sqlite and not MySQL?
    2. what transfer Speers can I expect?

    Thank you very much for all this work! 🙂

    • Either MySQL or Sqlite will work, Joshua. For a large Owncloud installation where you have many users, MySQL might be the best. But for a small Owncloud instance, with only one user and running on a Raspberry Pi, Sqlite is s nice lightweight solution.

      Regarding network speeds, this will depend on your home network. However you won’t get any speed greater than about 10 or 12 Megabytes/sec, because that is the limit of the Raspberry Pi network interface (Fast Ethernet, 100Mb/s). From another PC on your home network, you might get 6 or 7 Megabytes/sec.

  22. After moving my own cloud fro /var/www to an external drive a described above, when I point my browser at my pi, i get the following error:
    An exception occurred while executing ‘SELECT “configvalue”, “appid” FROM “oc_appconfig” WHERE “configkey” = ?’ with params [“enabled”]: SQLSTATE[HY000]: General error: 1 no such table: oc_appconfig

  23. Hi Gene, obviously there is a database error, although it is difficult to say what is causing it. Can you undo the changes, and if so does the error disappear ? Also, are you running any other applications on your Pi that also use SQLite ?

    I think the easiest way to recover will be to just repeat the procedure again from the start.

  24. Hi , thanks for this great tuto , it is the one which bring the further !
    but I got a problem when I try to connect to Owncloud!
    http://192.168.0.16/owncloud ( 192.168.0.16 is my reaspi IP)
    I’am using : 2015-05-05-raspbian-wheezy.img at the start.
    Hi got this message below.
    Thanks a lot for your job!
    frd

    . * */ // Show warning if a PHP version below 5.4.0 is used, this has to happen here // because base.php will already use 5.4 syntax. if (version_compare(PHP_VERSION, ‘5.4.0’) === -1) { echo ‘This version of ownCloud requires at least PHP 5.4.0
    ‘; echo ‘You are currently running ‘ . PHP_VERSION . ‘. Please update your PHP version.’; return; } try { require_once ‘lib/base.php’; OC::handleRequest(); } catch(OCServiceUnavailableException $ex) { OCPUtil::logException(‘index’, $ex); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printExceptionErrorPage($ex); } catch (OCHintException $ex) { OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); OC_Template::printErrorPage($ex->getMessage(), $ex->getHint()); } catch (Exception $ex) { OCPUtil::logException(‘index’, $ex); //show the user a detailed error page OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); OC_Template::printExceptionErrorPage($ex); }

  25. Brilliant guide, inspired me to buy a pi2 and run my own instance of OwnCloud. The guide was super straightforward, useful and interesting. Thank you.

  26. Hey I reallllllllly appreciate this blog. I literaly lterally couple weeks to make owncloud.

    Have a question. I want to put my data from external hardrive( almost 2TB). Only through the web I could upload it? or can I just giving that permision to accest from the web? And can I acces owncloud file with samba?
    Thank you!!

    • Hi Yoonhwan. You can access your files over the web through Owncloud. You can also access them direct on your server including through Samba. Samba would work on your local network only, not over the web. Hope this answers the question.

  27. If you receive the error “can’t create or write into the data directory…” try this:

    $ sudo chown apacheUser:apacheUser /var/www/owncloud/data

    (replace apacheUser with the name of your apache user. In my case it was “pi”)

    $ sudo chmod 0770 /var/www/owncloud/data

    • Thanks Clinton. However, these commands are already part of the procedure, under the section entitled “Create the Data Directory”:

      sudo chown www-data:www-data /var/www/owncloud/data
      sudo chmod 750 /var/www/owncloud/data

      Incidentally, your Apache user should not be “Pi”. By default it is “www-data”. This is the user that owns the Apache processes. Check it with ps -ef | grep apache

  28. Now that owncloud 8.1 is out, i want to upgrade. I read your previews answer to the question:
    “move the existing owncloud installation (eg. sudo mv ownclod owncloud.old)”

    Just to be clear, I backup my owncloud data folder, and then I have to do all the previos steps? Install like a clean raspberry? (Skipping the part of creating folders) Im going to lose all the settings like in the config.php file?

    Sorry for the bad english
    Thanks for the tutorial! working great on 8.0.1

    • Good question Arturo. I have just added a section called “Upgrading Owncloud 8.0 to Version 8.1”. Please give it a try. It is quite easy. You don’t have to repeat any previous steps.

      • Thanks Jim, It was really easy. I had a little problem with the permissions of the config folder, but nothing i couldn’t solve.

        Thanks again

  29. Hi Jim,

    As a moderately experience user in terms of SSH and RPi stuff I was wondering why this guide doesn’t elaborate on how to force the use of SSL or HTTPS. With the installation instructions provided above the .htaccess will work just splendid but warnings are given off that Owncloud is running over HTTP and not HTTPS. I tried adding some lines in config.php as : "forcessl" => true, but not sure if that works. Could you guide me in the right direction to force SSL and HTTPS ?

    Cheers

    • Hi Frank. HTTPS configuration is part of the Apache web server, rather than Owncloud. Although the setting you mention may also be required.

      Configuring a site for HTTPS (SSL) involves generating a certificate with the openssl command, putting the certificate into /etc/Apache/certs, and changing the Apache configuration files as appropriate. A detailed procedure is beyond the scope of this document. I might write a separate article if I get time, but in the meantime there are plenty of guides on the Internet.

  30. Help !! Excelente explanation. When “Creating a Login for Owncloud” after nickname and clicking “Finish Setup” this warning “Can’t create or write into the data directory /var/www/owncloud/data”

    I surf in a browser in my Windows XP PC, because in Raspbian webrowser I put the Raspberry IP and the browser said “it not possible show this website”.

    Could you help me? … I don’t know anything about Linux.

    Thanks in advance

    PD. All previous install steps was OK

    • Hi Humberto, it sounds like the data directory is missing or has the wrong permissions.

      Check that you followed the previous step correctly, the part entitled “Create the Data Directory”. As the procedure says, you have to execute these commands:

      $ sudo mkdir /var/www/owncloud/data
      $ sudo chown www-data:www-data /var/www/owncloud/data
      $ sudo chmod 750 /var/www/owncloud/data

      Cheers,
      Jim

  31. Jim, great guide. Appreciate it.

    One question: my apache2 installation uses the html folder for public access. If I unzip owncloud to /var/www/ folder it seems inaccessible from the browser so I have to put it inside /var/www/html.
    Does this create any security issue when accessing files? (still putting ‘data’ folder with 750 permissions?

    Thanks.

    • Hi Marco, sorry for the long delay in replying. I don’t think using the “html” folder will create an issue. It just means that your Apache2 installation is configured to use /var/www/html as the default folder rather than /var/www. The setting is usually in /etc/apache2/sites-available/default.

      The “data” folder should be fine. Although for greater security, you could move it as described in the article. Cheers.

  32. Hi Jim
    Continuing the task, I have an external HDD formatted NTSF Samsung 2TB. Without adding anything connecting to the RPi2 perfectly I saw the files. But also installed ntfs-3g (sudo apt-get install ntfs-3g). (avoiding format to ext4)

    Could copy and move files without problems, the peculiarity is that using nautilus shows SAMSUNG apart from File System. like an entity independent. Apparently instead of / dev / … is / media / SAMSUNG.

    When I do a fdisk it shows as /dev/sda1.

    I not mount the drive because I see it and work with files in the HDDD (I understand that it was not necessary).

    I did all the steps and copy as the post says: I position in /var/www/owncloud then -rp data cp / media / samsung / owncloud / data and copy everything there, so check with nautilus. The route via /media/samsung / …. is valid and work.

    But when I modify the config.php and put that path /media/SAMSU/Owncloud/data … when trying to access from browser to owncloud it gives me having access problem.

    Should we modify only the config.php? Any suggestions for testing.

    From already thank you very much.

    • My research says perhaps permission on directories or files. Because when I copy (like you say “$ sudo cp -rp data /disk/owncloud/data
      Check the copied data. Notice the ownerships and permissions have been correctly retained. This is important for Owncloud.”)

      When I check the permission aren’t the same in both in my SD Card whith in my HDD) .. I tried to change with “sudo chmod ..” but i Can’t. I repeated the steps, before deleting from HDD and the cp -rp another time and always permissions change.

      Any help?

      best regards

  33. After change owncloud from SD to HDD (ext4) when I intend via IP this msg:

    Internal Server Error

    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log.

    Could you help me.

      • Hi Humberto, sorry it has taken so long to reply.

        Permissions under NTFS are different to those in native unix file systems like ext4. NTFS does not handle permissions in the same way, so you can’t use chmod to modify them, as you have found. Well done on getting it working in the end (using ext4), your persistence paid off.

        There probably is some way to get Owncloud to work properly with NTFS under Linux, but I am not sure what it would be. The nearest you can get to managing NTFS permissions in Linux is to modify the mount options. Better to stick with ext4 for now. Cheers, Jim.

  34. Hi Jim

    Thanks so much just got my owncloud working on rpi2 very excited to have my photos and music on here. All worked flawlessly even moving the data to my ext4 hd. except…

    The previously formatted ext4 HD has my music and photo folders in the root.

    From the web owncloud interface I cannot see the music and photos folders
    I was going to move my existing music and photo folders into the owncloud data directory from the command line. when I try to cd into /disk/owncloud/data I get
    -bash: cd: data: Permission denied

    Thanks

    • Hi Peter,
      You might need to be root to execute the data move. Perhaps move your data with a sudo command, something like this

      $ sudo mv /disk/myphotos /disk/owncloud/data/myphotos

      assuming your photos are currently in a folder called “myphotos”, in the root of your external disk.

  35. Hello, very nice tutorial.

    could you please give advice on how to make the transition to https on a raspberry pi?

    Also, If I decide to move the whole /owncloud inside another folder for security how will apache access it ?

    • Hi Dimitris, your question is similar to that asked by Hoe, above. Transitioning the site to https is an entirely different, and fairly lengthy procedure, beyond the scope of this article. See the answer I gave Hoe for more information. Sorry I can’t provide a fuller answer, but there are many guides on the Internet for setting up https.

  36. This is a clearly written tutorial. Thanks Jim.

    First just to share:-
    ================================================
    My root of my apache2 server defaults to /var/www/html. I got a 404 error when I tried to access owncloud at http:///owncloud. To make apache work root at /var/www/owncloud, I did the following:-

    edited /etc/apache2/apache.conf and made the following changes:-

    #
    # Options Indexes FollowSymLinks
    # AllowOverride None
    # Require all granted
    #

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

    Then I edited /var/www/apache2/sites-available/000-default.conf and made the following changes:-

    # DocumentRoot /var/www/html
    DocumentRoot /var/www

    ========================================================
    However I could not get owncloud to work after I changed the data directory to an external drive. The error report is “Can’t create or write into the data directory “.

    This is the owncloud directory at my external drive:-

    drwxr-xr-x 3 root root 4096 Dec 31 21:18 owncloud

    This is the data directory at my external drive:-

    drwxr-x— 2 www-data www-data 4096 Dec 31 20:59 data

    This is what is in the data directory:-

    drwxr-x— 2 www-data www-data 4096 Dec 31 20:59 .
    drwxr-xr-x 3 root root 4096 Dec 31 21:18 ..
    -rw-r–r– 1 www-data www-data 284 Dec 31 20:59 .htaccess
    -rw-r–r– 1 www-data www-data 11 Dec 31 20:39 htaccesstest.txt
    -rw-r–r– 1 www-data www-data 0 Dec 31 20:59 index.html
    -rw-r–r– 1 www-data www-data 1024 Dec 31 20:23 owncloud.db
    -rw-r—– 1 www-data www-data 279 Dec 31 20:23 owncloud.log

    Is there something that I missed out to get ownCloud (ver 8.2.2) to work?

    • Hi Mark. A 404 error is what I would expect if you tried to surf to “http://owncloud”. That is not the correct URL. Following the procedure above, you should be using a URL that contains your Pi’s IP address. For example “http://192.168.1.78/owncloud”. For more information, see the part of the procedure entitled “Creating a Login for Owncloud”.

      The changes you made to /etc/apache2/apache.conf would not have the effect of changing the Apache document root. The change you made to 000-default.conf might well do that though.

      You say an error is encountered: “Can’t create or write into the data directory”. In response to what action or command was this error message generated, and where did it appear ?

      • Hi Jim,

        Happy New Year and thank you for your reply.

        I made a mistake when I type in my issue not know that the page will render “” as a tag. You are right, to access ownCloud you need to enter http://myipaddress/owncloud.

        I got the “Can’t create or write into the data directory” at the ownCloud setup page (first time when I tried to create the ownCloud account). That means I got to http://myipaddress/owncloud. I entered the ownCloud account and then the path to where I want to store the data. When I click “Finish Setup”, I got the error.

        • Hi Mark. If Owncloud says “Can’t create or write into the data directory”, it means the permissions on the directory are too restrictive. Please make sure you typed these commands correctly during the procedure:

          $ sudo chown www-data:www-data /var/www/owncloud/data
          $ sudo chmod 750 /var/www/owncloud/data

          For more information, see the section above entitled “Create the Data Directory”.

          • Hi Jim,

            Thank you for trying to help me fix the problem. I did as you suggested but the result is the same. Has it got to do with the php.ini file?

  37. Hello Jim,

    thank you for your reply. I am wondering about the newest update 8.2.2 can I do it from the update app within owncloud?

    I followed your installation process and installed 8.2.1 directly in /usr/share/owncloud

    if I ask owncloud to update to 8.2.2 will it place everything in the correct place?

    at the moment I am backing up data folder of external drive and I will also backup usr/share/owncloud Probably it will be safe to return back if I have problems right?

    • Hi Dimitris,

      I don’t think you can use the update app within Owncloud to perform the upgrade. When I tried it, it failed because my web server user (www-data) does not have rights to modify Owncloud files. This is a Debian security feature and is best left unchanged.

      However, I have rewritten the upgrade section at the end of the article to cover updating to Owncloud 8.2.2, and I have tested it successfully today. Please follow the steps under the section entitled “Upgrading Owncloud to Version 8.2”.

      If you are backing up the Owncloud folder and the data folder, then yes, you should be able to recover from any problem situation by using those babkups (sometimes called a “roll back”).

  38. Hi Mark, I don’t think it has anything to do with the PHP file. Without more background information about your system, all I can suggest is dong the whole procedure over again.

  39. Hi, thanks for the clear tutorial. After accessing the http://myip/owncloud for the first time it throws the following deprecation warning:
    —-
    “PHP s configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code.
    To fix this issue set always_populate_raw_post_data to -1 in your php.ini”
    —-
    So I have done this in etc/php5/php.ini. I uncommented it and set the value to -1 to no avail. I’ve read a lot about it but none of the threads are leading me to a solution.

    Also, I had to change the directoryroot from /var/www/html to /var/www in the /etc/apache2/sites-available/000-default.conf file. It gave me a 404 the first time.

    Any ideas?
    Thanks, Fritz

    • Hi Fritz. Regarding the PHP problem, I am not sure what causes this. You encounter an error message “PHP is configured to populate raw post data…”. Where exactly does this message appear and in response to what action, please?

      Regarding the directory root issue, you received a 404 error. What exact URL were you trying to access that gave rise to this 404?

  40. I bought a WD MyCloud and was wondering if I could use a RPi 2 with ownCloud installed on it to use the data on the MyCloud?

    • Hi Dan. As I understand it, the MyCloud is a NAS unit (network attached storage) with built in file sharing capabilities. It therefore does the same job as Owncloud installed on your Pi. I am not sure what you have in mind about making the two work together. They are two, rather similar solutions doing the same thing.

      One thing you could do is back up the Pi (and Owncloud data) to the WD Mycloud.

      • Ohh, nevermind then! Was thinking I could connect a RPi 2 with ownCloud installed to my WD and then port-forward it so I can access it wherever I am, but use the storage from the MyBook rather the RPi 2. Thanks!

  41. It would be nice to make a step-by-step backup tutorial!
    It’s a bit confusing what exactly has to be backed up

    Is just the /owncloud in RPi2 and the data folder on external HDD enough if they are synced in another drive or SQlite has to be copied also?

    Best

    • Hi mDSP. You hit the nail on the head. Back up the owncloud directory and the data folder on the external disk.

      For users who have not moved the data folder, just backing up the owncloud folder is enough (/var/www/owncloud), because the data folder is inside that folder.

      You might want to consider just backing up the whole Pi 2, which will backup Owncloud and also anything else you might have on the Pi.

  42. Hello Jim

    nice instructions. I have installed owncloud using your tutorial. It seems I am going to expand it so that 3-4 family memebers will use it so probably its a better idea to move to MySQL. It would be great if you could point out how one can make the transistion.

    I have a lot of staff on the disk and I am afraid to move on

    Alfred

    • I would recommend leaving it as SQLite and see how it performs with the other users. However, one way to migrate to MySQL is as follows, although I haven’t tested it. Note you lose any existing users, so those will have to be created again, but the data is otherwise preserved (apparently).

      1. Edit /var/www/owncloud/config/config.php

      2. In that file, change
      ‘installed’ => true,
      to
      ‘installed’ => false,

      3. The above step makes Owncloud go through the install procedure again, effectively putting you back at the section entitled “Create a Login for Owncloud” in the procedure outlined in this post. Surf to your Owncloud address and you should see the dark blue setup screen again. Choose MySQL as the database and take it from there.

      These steps came from https://forum.owncloud.org/viewtopic.php?t=2964

    • Hi Gideon. “Command not found” means the command (bunzip2) was not in your search path, $PATH. Or perhaps bunzip2 is not installed on your Pi.

      Try typing the full path of the command instead:

      sudo /bin/bunzip2 owncloud-8.2.2.tar.bz2

  43. Hai Jim,

    I am running in to a problem after trying to enter owncloud in a browser, when I surf to my new Owncloud web page. Using the URL I get:

    Not Found

    The requested URL /owncloud was not found on this server.

    Apache/2.4.10 (Debian) Server at 192.168.1.7 Port 80

    Do you know what the problem is?

    • Hi Gideon it is difficult to say what the problem might be without further information. However, Apache identifies itself as “2.4.10” in your error message, which indicates you are using the latest version of Debian, Debian 8 (Jessie).

      The procedure has not been tested on Debian 8, only on Debian 7, so some small difference might be causing the problem. (There are small configuration differences between Apache 2.2, as supplied with Debian 7, and Apache 2.4, which is the default on Debian 8). I will do a test in the next few days and post the results back here, if I get the chance.

    • I just did some tests. What Kevin says is correct. In Debian 7 (Raspbian Wheezy), the default Apache document root is /var/www, but in Debian 8 (Raspbian Jessie) it changes to /var/www/html.

      I’ll update the article shortly, to account for Debian 8.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.