Backup Important Files on Ubuntu 16.04 LTS Server to DropBox Automatically

Looking for an easy way to backup your Ubuntu 16.04 LTS servers files to Dropbox? These can be your website content, important configuration files and others important files you can’t afford to lose…. this process backs them all automatically to Dropbox.

This brief post is going to show students and new users how install and configure Dropbox on Ubuntu 16.04 LTS Servers (headless) to automatically back up important configuration files and website content… this process can be an affordable way to get your content secured..

To get started with backing up your files via Dropbox, continue with the steps below:

Step 1: Install Dropbox on Ubuntu 16.04 LTS

Before getting the back up process to work, you must download and install Dropbox… run the commands below to download Dropbox 64-bit package for 64-bit systems..

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

The 32-bit version of the package can be found below

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

After downloading the package, run the commands below to extract.

tar xvf dropbox-linux.tar.gz

After extracting the downloaded package, run the commands below to move the content to a location in the /opt/dropbox directory…

sudo mv .dropbox-dist /opt/dropbox

Next, run the commands below to allow dropbox to authenticate the server

/opt/dropbox/dropboxd

This should launch dropbox script to allow you to authentication the servers… you should begin to see links on the screen to select and paste into your web browser… then click Connect button to logon to dropbox and authenticate… after that, the server will be allowed to upload and download content from your Dropbox account.

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

Click Connect

ubuntu dropbox

Step 2: Create Dropbox Service

Dropbox is installed and ready to use… however, it would be easier to manage if it was a service account… to create a Dropbox service account, run the commands below

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

Then copy the content below and paste into the file.

[Unit]
Description=Dropbox
After=network.target

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

[Install]
WantedBy=multi-user.target

Save the file and exit.

Now you should be able to run the commands below to stop, start and enable Dropbox to automatically start up when the server starts…

sudo systemctl stop dropbox.service
sudo systemctl start dropbox.service
sudo systemctl enable dropbox.service

Step 3: Backing Up to DropBox

At this stage, Dropbox is installed and a folder called Dropbox created in your home directory… When you back to automatically backup content, place the content in ~/Dropbox folder in your home directory and it should be backed-up to Dropbox.

You can also create symbolic links to backup directories and files… for example, to backup the entire document root for Apache2 and Nginx,  (/var/www/html/) you can run the commands below

ln -s /var/www/html ~/Dropbox

You can do this for any file and directory… Everything that are created in the /var/www/html will automatically be backed-up to Dropbox…

Enjoy!~

You may also like the post below:

Configure LAMP / LEMP Server Timezones on Ubuntu 16.04 LTS

2 Replies to “Backup Important Files on Ubuntu 16.04 LTS Server to DropBox Automatically

    1. mkdir -p ~/bin
      wget -O ~/bin/dropbox.py “http://www.dropbox.com/download?dl=packages/dropbox.py”
      chmod 755 ~/bin/dropbox.py
      ~/bin/dropbox.py help

      ~/bin/dropbox.py exclude add FOLDER

Leave a Reply

Your email address will not be published. Required fields are marked *

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

%d bloggers like this: