How To Install Dropbox In An Entirely Text Based Linux Environment

You will need:

1. Log in to your Linux server so you obtain a shell prompt, and change to your home directory.

$ cd ~

2. Use wget to download the Dropbox Linux client, using either the link to the latest stable version (32-bit or 64-bit), or go to the forums and find a link to the latest forums version.

# this example is the 32-bit build of version 0.6.427 of the client
$ wget -O dropbox.tar.gz http://dl.getdropbox.com/u/17/dropbox-lnx.x86-0.6.427.tar.gz

3. Use tar to extract the client. It will be placed in folder ~/.dropbox-dist/

$ tar zxof dropbox.tar.gz

4. Use wget to download the Python scripts needed to set this up.

$ wget http://dl.getdropbox.com/u/6995/dbmakefakelib.py
$ wget http://dl.getdropbox.com/u/6995/dbreadconfig.py

5. Run the dbmakefakelib.py script - this creates fake stub copies of the GUI libraries so dropboxd will start.

$ python dbmakefakelib.py
adding library libgtk-x11-2.0.so.0
adding library libgdk-x11-2.0.so.0
adding library libatk-1.0.so.0
adding library libgdk_pixbuf-2.0.so.0
adding library libpango-1.0.so.0
adding library libgobject-2.0.so.0
adding library libgmodule-2.0.so.0
adding library libgthread-2.0.so.0
adding library libglib-2.0.so.0
adding function gtk_tree_view_new
adding function gtk_toolbar_new
adding function g_threads_got_initialized
adding function gtk_grab_remove
adding function gtk_button_new
adding function gtk_frame_new
adding function gtk_major_version
... lots more of this ...
adding function g_static_rw_lock_writer_unlock
adding function g_value_set_boxed_take_ownership
adding function g_boxed_type_register_static
adding function g_datalist_clear
dropboxd ran for 15 seconds without quitting - success?

6. At the end of the last script, dropboxd should have run successfully for a few seconds - long enough to contact the Dropbox servers and construct the initial pieces of data required for the client to run. The most important of these for identification of the client is the host id, a 128-bit number uniquely assigned to every instance of the client. This can be displayed by running the dbreadconfig.py script.

NOTE: dbreadconfig.py fails on my machine (gutsy) when importing ctypes. Try deleting all the code which uses ctypes, since you only need that for Windows anyway.

Also, separately, please put each import statement on a different line so that debugging can go much faster, among other reasons (PEP 8). -jperla

I had some trouble with the python scripts, so I modified the scripts. Here are my alternate ones: (Linux only) - dickeytk

$ python dbreadconfig.py
host_id = 739bfe362f3bb3246da99dc8d20dbe2b
last_revision = None
schema_version = 6

7. Take the URL https://www.getdropbox.com/cli_link?host_id=HOSTID and replace HOSTID with the host id from the previous step. Go to this in a web browser on any computer (it doesn't have to be the Linux server, but it requires that you're logged into your Dropbox account) and fill in the details to register or link to an existing account.

Note: I could not get this to work at all. The only way I was able to register my machine was to boot an Ubuntu Live USB stick on my laptop, install the Nautilus GUI version, and go through the install. After I registered the machine to my account that way, I copied the $HOME/.dropbox folder on the laptop to /home/$my_user_account/.dropbox on the server machine I wanted to use with Dropbox. After doing that, I was able to start dropboxd and sync my files properly.

8. Create a folder ~/Dropbox for the Dropbox files.

$ mkdir ~/Dropbox

9. Run dropboxd as a background process; it should pick up the details you entered on the web page and set itself up completely.

$ ~/.dropbox-dist/dropboxd &

Following on from that, there are a few different options to run the Dropbox client on an ongoing basis. You could put the above line in your server startup scripts, e.g. /etc/rc.local, or maybe just a certain user's login scripts.

You can also use system service script to automatically run dropboxd, here's a sample script for Debian/Ubuntu (sample for Fedora/RedHat below):

# dropbox service
DROPBOX_USERS="user1 user2"
start() {
    echo "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
        start-stop-daemon -b -o -c $dbuser -S -x /home/$dbuser/.dropbox-dist/dropboxd
    done
}

stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
        start-stop-daemon -o -c $dbuser -K -x /home/$dbuser/.dropbox-dist/dropboxd
    done
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropboxd`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
        else
            echo "dropboxd for USER $dbuser: running."
        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

For Fedora/Red hat:

# chkconfig: 345 85 15
# description: Startup script for dropbox daemon
#
# processname: dropboxd
# pidfile: /var/run/dropbox.pid
#
# Source function library.
. /etc/rc.d/init.d/functions

DROPBOX_USERS="user1 user2" 

prog=dropboxd
lockfile=${LOCKFILE-/var/lock/subsys/dropbox}
RETVAL=0

start() {
        echo -n $"Starting $prog"
        for dbuser in $DROPBOX_USERS; do
            daemon --user $dbuser /home/$dbuser/.dropbox-dist/dropboxd 
        done

        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog"
    for dbuser in $DROPBOX_USERS; do
        killproc /home/$dbuser/.dropbox-dist/dropboxd
    done
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart}"
        RETVAL=3
esac

exit $RETVAL

for Gentoo:

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

DROPBOX_USERS=""
NICENESS=5


start() {
    ebegin "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
        start-stop-daemon -b -o -N $NICENESS -c $dbuser -S -v -e HOME="/home/$dbuser" -x /home/$dbuser/.dropbox-dist/dropboxd
    done
}

stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
        start-stop-daemon -o -c $dbuser -K -x /home/$dbuser/.dropbox-dist/dropboxd
    done
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropboxd`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
        else
            echo "dropboxd for USER $dbuser: running."
        fi
    done
}

Change DROPBOX_USERS to include all users that want to run dropboxd (separated by spaces), and save the file to /etc/init.d/dropbox.

Then for Ubuntu/Debian run:

$ chmod +x /etc/init.d/dropbox
$ update-rc.d dropbox defaults

For Fedora/RedHat run:

chkconfig --add dropbox

Then run ntsysv. If it worked you should see dropbox in the list.

To start the service, run

$ /etc/init.d/dropbox start

To stop it, run

$ /etc/init.d/dropbox stop

To restart it, run

$ /etc/init.d/dropbox restart

You can also check running status in the Ubuntu/Debian version with:

$ /etc/init.d/dropbox status

That's it!

Regole/TextBasedLinuxInstall (last edited 2009-06-16 09:08:53 by IlyaT1)