How to Install and Configure Dropbox on Ubuntu Server 12.04 LTS

Dropbox is a file hosting service that offers cloud storage, file synchronization, and client software. In brief, Dropbox allows users to create a special folder on each of their computers, which Dropbox then synchronises so that it appears to be the same folder (with the same contents) regardless of the computer it is viewed on. In this tutorial, I will try to show you the steps to make dropbox features and services available on ubuntu server.

Download dropbox from it’s Official website:

Dropbox for 32-bit Server:

wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86"

Dropbox for 64-bit Server:

wget -O dropbox.tar.gz "http://www.dropbox.com/download/?plat=lnx.x86_64"

Extract the Dropbox archieve:

tar -zxvf dropbox.tar.gz

Run the dropbox client deamon with this command:

~/.dropbox-dist/dropboxd

Ubuntu server will keep showing this message after few second, if it is not link to any dropbox account yet.

Copy the highligeted text and paste into the browser on separate computer and Dropbox will ask for authentication:

It will ask the password again in order to link Ubuntu server to this dropbox account.

Once it succeeds you’ll see the message

Client successfully linked, Welcome!

on your server and it will stop printing the authorization link.

Press CTRL + C to terminate the dropbox deamon process.

The next step is to create a script to start and stop the dropbox daemon:

sudo touch /etc/init.d/dropbox
sudo nano /etc/init.d/dropbox

This script is lifted from here:

#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS="arbab"
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 1
 esac
exit 0

Note: Replace the user “arbab” with the user whom you want to run Dropbox client.

Make this script executable:

sudo chmod +x /etc/init.d/dropbox

Add it to default system startup run levels:

sudo update-rc.d dropbox defaults

Start the dropbox and check it’s status:

sudo service dropbox start
sudo service dropbox status

Download the dropbox.py script to check the Dropbox  real-time status:

wget -O ~/.dropbox/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py"

Change the permissions:

chmod 755 ~/.dropbox/dropbox.py

Check the status by executing this command:

.dropbox/dropbox.py status

By default, dropbox daemon create a  folder named “Dropbox” in the home directory of the user that we mentioned in the script (in my case that user was “arbab“):

ls
cd Dropbox

Copy some data in this folder (Dropbox) and again check the status with python script:

.dropbox/dropbox.py status

Yes, it is working 🙂

Hope this will help you!

Please Remember me in your prayers!

2 responses to “How to Install and Configure Dropbox on Ubuntu Server 12.04 LTS

  1. Jhow Jhow May 14, 2013 at 3:35 pm

    Really really tankz!
    i’ll pray for you 🙂

  2. gabriel marques July 13, 2013 at 2:49 am

    Thanks, but how can I uninstall it?

Leave a comment