How to Backup important files to Dropbox on Ubuntu Linux

|

|

The post explains how to install and configure Dropbox on Ubuntu 16.04 LTS Servers for automatic backup of essential files. It provides step-by-step instructions on downloading the Dropbox package, extracting it, moving the contents, and enabling Dropbox to authenticate the server. The post also covers how to create a Dropbox service account and set files…

This article explains backing up important files to Dropbox in Ubuntu Linux.

Backing up important files to Dropbox in Ubuntu Linux is a great way to secure your important data. This can be your website content, important configuration files, and other files you can’t afford to lose.

By backing up your files to Dropbox, you can ensure your data is safe and accessible from anywhere. Additionally, Dropbox provides an easy and affordable way to secure your content without investing in expensive backup solutions.

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

Install Dropbox on Ubuntu

Before getting the backup process to work, you must download and install Dropbox. Run the commands below to download the 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 a Dropbox script to allow you to authenticate the servers. You should see links on the screen to select and paste into your web browser. Then click the Connect button to log on to Dropbox and authenticate. After that, the server can 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

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 it 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 start when the server starts automatically.

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

Backing Up to Dropbox

At this stage, Dropbox is installed, and a folder called Dropbox is created in your home directory. When you go back to automatically backup content, place the content in the ~/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 back up 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. So, for example, everything created in the /var/www/html will automatically be backed up to Dropbox.

Enjoy!~

You may also like the post below:

Like this:



4 responses to “How to Backup important files to Dropbox on Ubuntu Linux”

  1. Adriano Avatar
    Adriano

    Nice post!
    How to use selective folder sync?

    1. Adriano Avatar
      Adriano

      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

  2. Danilo Avatar
    Danilo

    Hello,

    I would like to send the backup in a file that includes tar.gz it’s possible?

    Thanks

  3. Shaagul Avatar
    Shaagul

    I have followed until creating symbolic links.. but, how to sync existing files and folders into dropbox? can provide further commands to copy files and folders from /var/www/html to dropbox, please? Thank you

Leave a Reply to Adriano Cancel 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.