When I decided that I wanted an easy way to sync files with my Ubuntu 10.04 Lucid Lynx server, I thought that Canonical’s home-grown solution, Ubuntu One, would be the best option. To my surprise, I learned that Ubuntu One is not supported on the server; it requires a GUI to work.
Fortunately, it is possible to run Dropbox, a service I was already using on my Mac and Windows machines, on a headless Ubuntu (or other Linux) server. It is important to stress, however, that Dropbox isn’t “meant” to be run on a headless server, per se. It will work fine, but there is no special server package to install. You can either install the entire package, which installs all manner of Nautilus dependencies, or you can install the server daemon manually. I am sure that the proprietary nature of the server is why no one has repackaged it as a server install.
I did not want to install all sorts of graphical dependencies, however, so I followed Dropbox’s instructions for a text-based Linux install. At the top of the top of the instructions there is a notice that the instructions are no longer necessary, and a link to a forum post with instructions for a “normal install”. I didn’t know who to believe. I ended up taking bits from both sets of instructions, and omitting a lot of steps that simply aren’t necessary anymore, and I got everything to work. I’m reproducing my work here, so that you don’t have to go through the trial and error that I did.
Installing Dropbox
To install Dropbox with no GUI (specifically, Nautilus) requirements, download the most current Dropbox archive, extract it to your home directory, and run the dropbox command.
$ wget http://dl-web.dropbox.com/u/17/dropbox-lnx.x86-0.7.110.tar.gz
$ tar xzf dropbox-lnx.x86-0.7.110.tar.gz
$ .dropbox-dist/dropbox
Dropbox will spit out numerous messages informing you that you need to link your server to your Dropbox account.
This client is not linked to any account... Please visit https://www.dropbox.com/cli_link?host_id=blahblahblahblahblah23445435365 to link this machine.
Copy and paste that link into a browser on your client machine. You will then have to log in to Dropbox’s website using your Dropbox account. It won’t be obvious at first that anything happened. If you review the “Events” tab on the website, however, you will see a message indicating that your server has been linked to your account. Now you can go back to the command line.
Kill the Dropbox process with Control-Z.
Creating a Service to Run at Boot
I don’t want to bother running Dropbox manually. It’s a service, and should be set up as such. Dropbox provides excellent instructions on how to do this. I will replicate them concisely here.
First, create a script file.
$ sudo nano /etc/init.d/dropbox
Then, paste in the full dropbox script. which I pulled from the Dropbox web site. (I am in no way claiming authorship of this script.) You have to make one change to the script file. On the second line, set the DROPBOX_USERS variable to your user name, or a space-delimited list of all Dropbox users on your server. After that change is made, save the script and exit nano.
Next, make the script executable.
$ sudo chmod +x /etc/init.d/dropbox
Finally, set up the script to run at boot.
$ sudo update-rc.d dropbox defaults
Note that this script will actually run an instance of the Dropbox daemon under the account of every user specified in the DROPBOX_USERS variable. I have only installed Dropbox for myself (a single user on the system). If you wish to sync multiple users with Dropbox, you will have to go through the steps in the “Installing Dropbox” section for each Dropbox user on your system, prior to running it as a service.
Starting, Stopping, Restarting, and Checking the Status of the Dropbox Service
Now that Dropbox is a service, you can use Ubuntu’s standard commands to manipulate it. First off, you’ll want to start it.
To start the service:
$ sudo service start dropbox
When you first start the service, it will create a “Dropbox” folder (note the capital “D”) right beneath your home directory. Personally, I don’t see a need to change this folder location. If you do, Dropbox provides instructions (http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall).
To check the status of the service:
$ sudo service dropbox status
To stop the service:
$ sudo service dropbox stop
To restart the service:
$ sudo service dropbox restart
Other Stuff
Removing Botched Installs
If you have already downloaded Dropbox and it isn’t working, delete all the Dropbox files in your home directory to start again with a clean slate. After running the following commands, you can go through the “Installing Dropbox” instructions.
$ cd ~
$ rm -rf .dropbox* Dropbox
Command Line Utilities
I don’t see a need to peek into the Dropbox process very often. If you do, download the Linux CLI add-on.