alanthing

Linux and other things

Dropbox CLI for CentOS 5 the Easy Way

This post originally featured on the Echo & Co. blog.

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
2
3
$ ./dropboxd
This client is not linked to any account...
Please visit https: //www.dropbox.com/cli_link?host_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx to link this machine.
  • After visiting the URL in a browser to which you’ve logged into dropbox.com, you’ll see the following output:
1
2
3
/usr/bin/nautilus
cannot open display:
Run 'nautilus --help' to see a full list of available command line options.
  • 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

  • Download the official Dropbox CLI: http://www.dropbox.com/download?dl=packages/dropbox.py (ref)

  • 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) from https://www.activestate.com/activepython/downloads (ref)

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

  • 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

  • Run dropbox.py without commands to see your available options.

Optional: To suppress LAN Sync broadcasts, download dropboxp2p.py (ref), edit the first line to use the ActivePython binary as you did for dropbox.py, and run ./dropboxp2p -d to disable LAN syncing (unless you have other machines in the LAN with Dropbox installed, and your firewalls are set up appropriately).

Comments