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.

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/.

sudo mkdir /opt/dropbox/

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

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.

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.

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.

[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

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

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

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

Run

dropbox.py exclude add the_folder_name_you_want_exclude