How to Install Dropbox on a Headless Ubuntu Server

This tutorial will show you how to install Dropbox on a headless Ubuntu server to backup and sync files and also how to enable Dropbox to auto-start at boot time. The following steps work all current Ubuntu versions, including Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04.

Install Dropbox on Ubuntu Server

First, SSH into your Ubuntu Server. Then download Dropbox using the following command. It will be saved as dropbox-linux.tar.gz.

64 bit

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

32 bit

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

Create a directory in /opt and extract Dropbox to /opt/dropbox/.

sudo mkdir /opt/dropbox/

sudo tar xvf dropbox-linux.tar.gz --strip 1 -C /opt/dropbox

Install dependency packages for Dropbox.

sudo apt install libc6 libglapi-mesa libxdamage1 libxfixes3 libxcb-glx0 libxcb-dri2-0 libxcb-dri3-0 libxcb-present0 libxcb-sync1 libxshmfence1 libxxf86vm1

Now you can run the Dropbox daemon.

/opt/dropbox/dropboxd

It will ask you to visit a web address in order to link your Ubuntu server with your Dropbox account.

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

Copy and paste the link in your web browser, log into your Dropbox account and click the Connect button to link your Ubuntu server with your Dropbox account.

dropbox ubuntu server

Once the link is complete, return to the terminal window and press Ctrl+C to temporarily stop Dropbox daemon because it by default runs in the foreground and you can’t run other commands. The Dropbox sync folder appears in your home directory.

How to Enable Auto-Start

To make Dropbox start at system boot time, we can create a systemd service unit.

sudo nano /etc/systemd/system/dropbox.service

Put the following lines into the file. We want Dropbox to run as a standard user instead of root, so replace username with your real username. If it runs as root user, then files in ~/Dropbox will not sync properly.

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

[Service]
Type=simple
User=username
ExecStart=/opt/dropbox/dropboxd
ExecStop=/bin/kill -HUP $MAINPID
Restart=always

[Install]
WantedBy=multi-user.target

Save and close the file. Then we can start this service by running:

sudo systemctl start dropbox

And enable auto-start at system boot time.

sudo systemctl enable dropbox

Check its status.

systemctl status dropbox
dropbox ubuntu headless

Hint: If the above command doesn’t quit immediately, you can press the Q key to make it quit.

You can stop it with:

sudo systemctl stop dropbox

Restart it with:

sudo systemctl restart dropbox

Now you can restart your Ubuntu server and check if auto-start is working.

sudo shutdown -r now
Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply