Sunday, April 10, 2011

Running Dropbox Headless

This article assumes that you have an Arch Linux server with zero GUI components installed (i.e. running headless), and of course that you want to link it to your Dropbox account.

I'm kinda wired right now, so apologies in advance if this is hard to read, hard to follow, or just plain weird.  Also, I skipped many of my usual editing steps like making sure capitalization is consistent.
  1. Don't even bother with downloading the Linux Dropbox client from their site.  Arch Linux has a PKGBUILD available in AUR for dropbox-cli.  So go grab that instead.
  2. Put the PKGBUILD in its own directory somewhere on your server (for the sake of these instructions, I'll use ~/dropbox-cli)
  3. If you've never used makepkg before, go edit /etc/makepkg.conf as root and change some stuff:
    1. If you know what CFLAGS you want to use, change that, otherwise, the defaults will work.  (You're not even compiling anything for this anyway lol)
    2. Go down to where it says "PACKAGER", uncomment the line, and then give yourself credit lol.
  4. Now, cd into ~/dropbox-cli
  5. edit the PKGBUILD file to remove the dependency for "dropbox".  Building the package with this dependency will cause a fair number of GUI-related dependencies to be installed.  Which will just eat up hard drive space unnecessarily given that you're running headless.  Also by "a fair number" I mean GTK.
  6. run makepkg -s.  The -s flag makes it get any dependencies you might need, which in this case will only be python2 if you don't already have that installed.
  7. after a short amount of time the package will be built.
  8. now type pacman -U dropbox-cli and hit tab to autocomplete the package filename.  Press enter and it's installed (if you ran it as root lol).  You're not done yet, though.
  9. run dropbox start -i.  Dropbox will download the one remaining piece of software it needs and then start.
  10. At this point it'll give you a link to visit to link this install to your account.  Go do that.
  11. Now.  Head on over to ArchWiki's Dropbox page.  There they have an init script you can copy/paste so you can have dropbox start up on system startup and terminate on shutdown.  Copy it, then open /etc/rc.d/dropboxd as root, and paste that shit in.
  12. It needs some modification, partly by design, and partly because, well, I dunno why.  Change the USER= line to set $USER to the username you're running dropbox as.  This is the modification by design.
  13. Change the PID= line so that the path to dropbox is /home/$USER/.dropbox-dist/dropbox
  14. Also, change the line below stat_busy "Starting Dropbox Service" to run /home/$USER/.dropbox-dist/dropboxd.  These are both the modification due to because, well, I dunno why.  My guess is that the locations in the original init script used to be correct but were changed at some point and that wiki page hasn't been updated yet.
  15. save that shit.
  16. now you can add dropboxd to the DAEMONS list in /etc/rc.conf if you want to.  Otherwise you get to run /etc/rc.d/dropboxd start and /etc/rc.d/dropboxd stop manually.
There you go.  At the very least, even if you don't want to actually run the client, you can use it as the "install dropbox on your other computers" step of Getting Started to get yourself a measly extra 250MB if you haven't yet installed it on anything else.

No comments:

Post a Comment

I moderate comments because when Blogger originally implemented a spam filter it wouldn't work without comment moderation enabled. So if your comment doesn't show up right away, that would be why.