Linux.com

Home Learn Linux Linux Tutorials How To Synchronize Dropbox and ownCloud on Linux

How To Synchronize Dropbox and ownCloud on Linux

The ownCloud personal cloud server bundles a lot of big-time cloud technologies into an elegant, simple interface. As founder and CTO Frank Karlitschek outlined at the January 2010 Camp KDE, the goals of ownCloud include easy setup and management, access to your data wherever it may be from whatever device you want, with privacy and user control.

ownCloud supports integration with external filesystems such as FTP, Webdav, Openstack Swift, and SMB servers, and external cloud services like Amazon S3, Google Drive, and Dropbox. Dropbox integration is one of the most-requested features, and at last this is available in ownCloud 4.5, which is scheduled for its official release this week. You can set up your own personal, private cloud that syncs with Dropbox and then share an entire Dropbox, or selected files, from your ownCloud server.

Installing ownCloud

fig-1 setup owncloud

ownCloud is included in the major Linux distributions so you can install it from your favorite package manager. But if your particular flavor of Linux includes an older version, you'll have to install the latest release manually, and you need 4.5 to get Dropbox integration. I'm running 4.5 RC2. ownCloud's download and installation instructions are pretty good. But I ran into some problems installing the necessary dependencies on my Linux Mint 13 system. The installation instructions include this:

# apt-get install apache2 php5 php5-json php-xml php-mbstring php5-zip php5-gd

Which gave me this error message:

E: Unable to locate package php-xml
E: Unable to locate package php-mbstring
E: Unable to locate package php5-zip

And the second apt-get incantation resulted in this:

# apt-get install php5-sqlite curl libcurl3 libcurl3-dev php5-curl php-pdo
[...]
E: Unable to locate package php-pdo

fig-2 external store

I would like to say that I carefully researched this, and came up with a correct package list. But the reality is my main system is a hodge-podge of repos from everywhere, mixed releases, and source builds, and somehow it has whatever ownCloud needs to work. So I can't say that. I did a quick test with the following on a clean Ubuntu 12.04 system:

# apt-get install apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser sqlite

This ran without error, and ownCloud operated correctly. Whatever version of Linux you're running, you need php5 (>= 5.3), php5-json, php-xml, php-mbstring, php5-zip, and php5-gd. These are listed as optional: php5-sqlite (>= 3), curl, libcurl3, libcurl3-dev, php5-curl, php-pdo.

First Run

fig-3 dropbox app

Follow the ownCloud instructions for setting up Apache and you should be good to go. I took the easy way and stuck all of the ownCloud files in my webroot at /var/www/owncloud for testing. Don't do this on a production server because it's unsafe. Docuwiki has a great page on the right way to set up Webservers, so consult it when you're ready to set up your live server. When your installation is complete you'll see the ownCloud setup page in your Web browser at http://localhost/owncloud (figure 1). This is where you create an admin account, choose your data directory, and choose which database you want to use: SQLite or MySQL.

fig-4 dropbox verify

Configuring External Storage

Now we get to the fun part. Go to the Apps tab and enable the "External storage support" app. Then go to the Admin tab, and you should see the External Storage configurator (figure 2.) Check "Enable User External Storage" to allow users to sync their own Dropbox accounts.

As you can see, this is where you connect to Dropbox, Google Drive, and other filesystems and cloud storage. With Dropbox you have to jump through some extra hoops and create a Dropbox app. That is what Dropbox requires to manage authentication to your account. Don't worry because it's easy.

Create Your Dropbox App

Go to Dropbox My apps and log in, then click Create an App. Make up a name for it, and a description. You can select either App Folder or Full Dropbox, depending on what you want to share in ownCloud. Then click Create. You'll see a page full of stuff, starting with figure 3. You can go back and edit and delete your Dropbox apps, so don't be nervous.

fig-5 dropbox access

Under App Status, do NOT click "Development (Apply for production status)." This is for apps that you want to release publicly. Fill in the rest of the forms, enable additional users if you have some extra testers, and upload an avatar or your photo. When you're finished click the Create button

Note the App Key and App Secret in your Dropbox app-- go back to your Admin or Personal tab in ownCloud, go to External Storage, click Add Mount Point, and select Dropbox. You can enter anything for the Mount point; this will be the name of the local mountpoint, and ownCloud will automatically create and configure this. Copy your App Key and App Secret into the appropriate boxes, and then click the Grant Access button. This button should appear when you press the Tab or Return key after entering all your information. You should then be greeted with something like figure 4.

fig-6 OwnCloud files

When it succeeds you'll see an "Access granted" message in ownCloud. Now you can configure which users have access to your Dropbox files in the Applicable box (figure 5.)

Seeing Your Dropbox Files

As of the 4.5 RC2 beta, you have to manually add your Dropbox files to your Files page. It's easy: all you do is create a new folder with the name of your Dropbox mountpoint, which in my example is carla-dropbox. Give it a few minutes and your files will appear. If you want to speed it up, go to the Apps tab and enable the rescan_fs app. When you click this it scans and update your ownCloud files view. Don't be fooled by its animated circling arrows, which makes it look like it's always running. It runs only when you click on it, and it gives you status messages while it's running.

After all that your Dropbox files will show up in your Files view just like all of your other files (figure 6), and will synchronize between ownCloud and Dropbox. I expect that it won't be long before your Dropbox shares appear automatically, and any remaining rough edges get smoothed over. Look for the final 4.5 release this Thursday.

 

Comments

Subscribe to Comments Feed
  • Tri Nguyen Said:

    Hi, I tried to follow your tutorial all the way through, and it seemed fine all the way to the end. However, when I get back to Files -> My Dropbox Folder, I got a bunch of errors like this: Warning: fopen(/home/tridn/public_html/owncloud/data/tringuyen/files_versions/Dropbox/a-directory-in-my-dropbox-folder/a-file-name) [function.fopen]: failed to open stream: No such file or directory in /home/tridn/public_html/owncloud/lib/filestorage/local.php on line 112 Any idea?

  • BlackSmile Said:

    Hi, Get the same trouble !! error messages for owncloud/lib/filestorage/local.php on line 112. It seems to come from files in a shared dropbox folder any ideas cause I can't use my owncloud files location !!

  • Ricardo Said:

    Hola, es la primera vez que accedo a esta web y me encuentro con este gran artículo, he de decir que tengo instalado OwnCloud en esta nube de torrents, por favor si querçeis pasar la voz y descargaros todo lo que queráis, http://www.alecaom.com/ (Acceder a la Nube) o bien directamente http://www.torrent.alecaom.com/ Un saludo y pasar la voz, es sin fines lucrativos.

  • John Said:

    Works well for me. I downloaded latest install of ownCloud yesterday, and the folder mounted automatically for me. Files are sinking as I write. Thanks so much.

  • samnjugu Said:

    Thanks Carla followed you tutorial and got my dropbox synced up. Great article.

  • Antonello Said:

    Hello Carla, I am going crazy ... with connect to dropbox. I have Dropbox Key ... and when I click "grant access" I am not received nothing ... but I see this error: Error core Creating OC_Filestorage_Dropbox storage failed I have read your guide ... and owncloud example ... but nothing ... sigh ... Where I mistake ? thanks Antonello

  • Eric Said:

    In case anyone else is having trouble adding Dropbox, try with Google Chrome. Firefox was failing silently (Grant Access, back to Personal settings with no error and no Dropbox configuration). Chrome added Dropbox successfully.


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board