I decided that I wanted backup/sync files to the cloud and also have a simple way to access select files from multiple locations (computers, phones…etc).
I have have been using Dropbox for a long time now on my computers and mobile devices; now I want to use it on my headless Ubuntu servers.
Fortunately Dropbox permits you to use their software without a graphical interface and even run it as a server.
I attempted to use the instructions from various posts; and that didn’t work out for me, so after much trial and error I have a solid method that works for me.
And with that I will share with you (and myself, to remember in the future).
To begin we log into our server (console or ssh)
Then we download the Linux version of Dropbox; depending on the processor version you may need to download the 32bit or 64bit version. You can verify this by typing the following
uname -a
Output may look something like:
Linux webserver 3.0.0-16-server #28-Ubuntu SMP Fri Jan 27 18:03:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
The links that I found where:
wget -O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86”
wget -O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86_64”
We then extract the active
tar -xzvf dropbox.tar.gz
We now need to run dropbox on our server
/.dropbox-dist/dropboxd
You will notice the following output
This client is not linked to any account…
Please visit https://www.dropbox.com/cli_link?host_id=*********
Keep this screen open and copy the link you received into any web browser and log into your Dropbox account to activate Dropbox on your server. You should see the following shortly after you activate.
Client successfully linked, Welcome!
Once the Dropbox client on your server is successfully linked it will automatically create a Dropbox folder under ~/Dropbox
And while you can now run Dropbox by /.dropbx-dist/dropbox I prefer to run as a service to start automatically on boot of my server.
This is done by creating a new file for the service management script
nano /etc/init.d/dropbox
Then we past the following script into the new file
#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS=”user1 user2″DAEMON=.dropbox-dist/dropbox
start() {
echo “Starting dropbox…”
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
HOME=”$HOMEDIR” start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
fi
done
}stop() {
echo “Stopping dropbox…”
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
if [ -x $HOMEDIR/$DAEMON ]; then
start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
fi
done
}status() {
for dbuser in $DROPBOX_USERS; do
dbpid=`pgrep -u $dbuser dropbox`
if [ -z $dbpid ] ; then
echo “dropboxd for USER $dbuser: not running.”
else
echo “dropboxd for USER $dbuser: running (pid $dbpid)”
fi
done
}case “$1” in
start)
start
;;stop)
stop
;;restart|reload|force-reload)
stop
start
;;status)
status
;;*)
echo “Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}”
exit 1esac
exit 0
You will replace the value of DROPBOX_USER with a comma separated linux users on your machine. In my case I am only using one account but if you wanted to you can use as many as possible to increase the “FREE” online storage syncing space.
Make sure you set the newly created scrip to be executable and add to the system default start up
chmod +x /etc/init.d/dropbox
update-rc.d dropbox defaults
You can then control the Dropbox client like any other Ubuntu service
service dropbox start|stop|reload|force-reload|restart|status
Enjoy!
And if you have a chance please join Dropbox with my referral link: http://db.tt/ok1dQSwD