Dropbox for Ubuntu server 16.04

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

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

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

1
2
3
sudo mkdir /opt/dropbox/

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

Now you can run the Dropbox daemon.

1
/opt/dropbox/dropboxd

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

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.

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

1
sudo vim /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.

1
2
3
4
5
6
7
8
9
10
11
12
13
[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:

1
sudo systemctl start dropbox

And enable auto-start at system boot time.

1
sudo systemctl enable dropbox

Check its status.

1
systemctl status dropbox

You can stop it with:

1
sudo systemctl stop dropbox

Restart it with:

1
sudo systemctl restart dropbox

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

1
sudo shutdown -r now

Get the dropbox.py script and put it to the PATH

1
https://www.dropbox.com/download?dl=packages/dropbox.py

Run

1
dropbox.py exclude add the_folder_name_you_want_exclude