Just another WordPress site

Main menu

Post navigation

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 fromownCloud 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: 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).

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).

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.

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:

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.

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

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.

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.

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.

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?

Hi jtpark, unfortunately I haven’t experienced these problems or had time to investigate them myself. Also I don’t understand what problem you are having. All I can suggest is looking for answers on Google, or by posting to the Pi forums at http://www.raspberrypi.org/forums/.

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.)

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!

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?

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!

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

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.

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!

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.

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?

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 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!
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.

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.

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:

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.

/**
* 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.
*

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:

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?

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 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.

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).

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”.

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’,

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”.

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.

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.

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

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.

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

Hi Fredvol, you are seeing the text of a PHP script, which is being displayed instead of executed. This suggests PHP has not been installed. Please see my reply to Scott’s comment above for more information. He reported a similar problem.

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.

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

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 ?

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.

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?

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.

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.

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.

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.

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.

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

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.

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:-

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 “.

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 ?

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:

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”).

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.

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?

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!

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 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.

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.