Home Dropbox How To Install Dropbox In Ubuntu 18.04 LTS Server

How To Install Dropbox In Ubuntu 18.04 LTS Server

By sk
Published: Updated: 4.3K views

We already looked at how to install and configure Dropbox in Ubuntu 18.04 desktop. Today we are going to discuss how to install Dropbox in Ubuntu 18.04 LTS server edition. Setting up Dropbox on a headless Ubuntu server that has no GUI is entirely different, but easy! And finally we will see how to install and configure Dropbox CLI client and how to use it to sync files.

Install Dropbox In Ubuntu 18.04 LTS Server

Like desktop version, Dropbox cli version is also available for both 32 and 64 bit editions.

For 32-bit:

$ cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -

For 64-bit:

$ cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

This will create a new hidden folder named .dropbox-dist in your $HOME directory.

Now, run the following command to start the Dropbox daemon from the newly created .dropbox-dist folder.

$ ~/.dropbox-dist/dropboxd

You will see an output something like below.

This computer isn't linked to any Dropbox account...
Please visit https://www.dropbox.com/cli_link_nonce?nonce=d6015chy89ksf023kskfc037e2 to link this device.

Next open the browser and navigate to the above link to connect system with your dropbox account. If you are on a headless server, you can use text browsers like lynx or elinks to sign-in to the dropbox account. Please note that you don't have to enter the URL in the same system itself. You can use any other system on your network that has a GUI web browser to navigate to the URL.

Once you opened the URL in the browser, you will be prompted to enter your Dropbox username and password. Just enter them and click Sign-in.

Dropbox is linked to your computer
Dropbox is linked to your computer

After your computer is connected to your dropbox account, you should see a message like below in your Terminal.

This computer is now linked to Dropbox. Welcome XYZ

Now, a new folder named "Dropbox" will be created in your home directory. Keep the data in this folder to access it from any devices.

$ ls Dropbox/
 Apps Mackup 'Yahoo! Mail'

Congrats! The Ubuntu server has been linked to your dropbox account. The dropbox daemon will keep running until you forcibly stop it by pressing CTRL+C.

You should start it manually every time when you want to use dropbox. Of course, we can make Dropbox service to automatically start on every reboot. We are going to see how to do it in the following sections.

Install Dropbox CLI

Download the dropbox python script and put it in your PATH, for example /usr/local/bin/.

$ sudo wget -O /usr/local/bin/dropbox "https://www.dropbox.com/download?dl=packages/dropbox.py"

Make it executable:

$ sudo chmod +x /usr/local/bin/dropbox

Now you can start using the dropbox cli. To display help, simply run:

$ dropbox
Dropbox CLI
Dropbox CLI

To view the usage of a specific command, for example throttle, run:

$ dropbox help throttle

Now let us see if dropbox service is running or not. To do so, simply run:

$ dropbox status
Dropbox isn't running!

As you see, dropbox service is not running!

To start it, run:

$ dropbox start

Let us again check if it is running using command:

$ dropbox status
Up to date

It will keep running until your reboot the system.

To stop the service, run:

$ dropbox stop

To get the current sync status of a file, run:

$ dropbox filestatus Dropbox/ostechnix.txt 
Dropbox/ostechnix.txt: up to date

You can exclude a directory from syncing. For instance, I am going to exclude a folder named "dir1". To do so, run:

$ dropbox exclude add dir1

You can add multiple directories with space separated values like below.

$ dropbox exclude add dir1 dir2

To view the list of directories currently excluded from syncing, run:

$ dropbox exclude list

To remove a directory from the exclusion list, use this command.

$ dropbox exclude remove dir1

To get get a shared link for a file, for example ostechnix.txt, in your dropbox folder, run:

$ dropbox sharelink Dropbox/ostechnix.txt 
https://www.dropbox.com/s/rqteaol58c1zlkw/ostechnix.txt?dl=0

You can now pass the above URL to anyone.

To enable lansync, run:

$ dropbox lansync y

To disable it:

$ dropbox lansync n

For more commands, see the help section.

$ dropbox help

Autostart Dropbox

Like I already mentioned, you should manually start Dropbox daemon at every reboot. If you're not comfortable with manual start, follow the steps below to make it automatically start.

Create a systemd service unit for Dropbox:

$ sudo vi /etc/systemd/system/dropbox.service

Add the following lines:

[Unit]
Description=Dropbox Service
After=network.target

[Service]
ExecStart=/bin/sh -c '/usr/local/bin/dropbox start'
ExecStop=/bin/sh -c '/usr/local/bin/dropbox stop'
PIDFile=${HOME}/.dropbox/dropbox.pid
User=sk
Group=sk
Type=forking
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

Replace User, Group and dropbox cli path ( /usr/local/bin/ ) with your own values. Save and quit the file.

Reload daemon using command:

$ sudo systemctl daemon-reload

Enable dropbox service:

$ sudo systemctl enable dropbox

Finally, start dropbox service with command:

$ sudo systemctl start dropbox

From now on the dropbox service will automatically start at every reboot.

To view if the service is started or not, run:

$ sudo systemctl status dropbox
Check dropbox service status
Check dropbox service status

Dropbox service is running and it will keep running on every reboots. You don't need to manually start it every time.

You May Also Like

15 comments

Guido van Harten April 17, 2020 - 8:38 pm

It seems the given instructions at this website doesn’t work with the most recent release of Ubuntu (20.04 – today I used the beta release).

Reply
sk April 17, 2020 - 9:06 pm

This guide is not yet tested with Ubuntu 20.04. We will do it after Ubuntu 20.04 released.

Reply
1 2

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More