Friday, November 23, 2012

dropbox centos sync

Dropbox CLI for CentOS 5 the easy way

Alan Ivey's picture

Dropbox hardly needs any introduction; put files in your Dropbox and they show up everywhere else you have Dropbox installed and dropbox.com. A feature about Dropbox that is probably not as widely known is that free accounts come with 30 days of undo history and Pro accounts can get "Pack Rat" that keeps unlimited history of changes. The history of files, including reverting deleted files, was particularly interesting to me, since I could hook in my latest daily MySQL dumps from AutoMySQLBackup to Dropbox and have 30 days of backups for free available from anywhere dropbox.com is accessible.

The problem is that we use CentOS for our servers and the Dropbox Linux builds are geared for distributions like Ubuntu and Debian that have updated versions of required software like Python, libc, and others, that I did not want to upgrade by hand on my systems and risk the integrity of the system packages. But, I got it to work anyway, read on for how I got Dropbox CLI installed on CentOS without replacing any system files.

  1. Download http://www.getdropbox.com/download?plat=lnx.x86 orhttp://www.getdropbox.com/download?plat=lnx.x86_64 (Ref)
  2. Extract tar.gz file downloaded and leave in ~ of desired user
  3. Run ~/.dropbox-dist/dropboxd to get Dropbox to provide a URL to go to in your browser to link this computer to your Dropbox account
    $ ./dropboxd
    This client is not linked to any account...
    Please visit https: //www.dropbox.com/cli_link?host_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx to link this machine.
  4. After visiting the URL in a browser to which you've logged into dropbox.com, you'll see the following output:
    /usr/bin/nautilus
    cannot open display:
    Run 'nautilus --help' to see a full list of available command line options.
  5. If you cannot quit the app, open another a shell, get the PID by running $ ps -ef|grep dropbox, and kill PID. The output on your other shell should say:
    Terminated
  6. Download the official Dropbox CLI: http://www.dropbox.com/download?dl=packages/dropbox.py (Ref)
  7. dropbox.py won't work without Python 2.6, but let's not risk messing up our official RHEL packages. Download ActivePython 2.6 (AS Package) fromhttps://www.activestate.com/activepython/downloads (Ref)
  8. As mentioned in the AP documentation (Ref), run the installer with ./install.sh and install where desired. It defaults to /opt/ActivePython-2.6, which is fine because it does not conflcit with the system default python 2.4 install. For my purposes, I had created a user called dropbox that did not have root privileges, so I installed to /home/dropbox/ActivePython-2.6.
  9. Edit dropbox.py and change #!/usr/bin/python to the path you just installed AP to. For my installation, it's set to #!/home/dropbox/bin/ActivePython-2.6/bin/python
  10. Run dropbox.py without commands to see your available options.

No comments:

Blog Archive