Backup VPS to Dropbox (how to)

First, we find out what Dropbox is okay:

Dropbox is a backup service, online data storage with the ability to synchronize in real time and perform backups automatically.

When registering a free account, we will have 2 GB for data storage. And we can increase this capacity to 20 GB for free by referring friends to use it via your link.

Here I will guide you to make use Dropbox account to backup your data to the VPS. How to perform very simple, we took a few minutes to complete the installation and setup only. Guide VPS automatically backup data to Dropbox

You did not use HZserver? See also: Install Nginx, PHP-FPM, MariaDB and easy VPS management, security with HZserver

1 We need to have a Dropbox account.

You can register at: http://dropbox.com

Guide VPS automatically backup data to Dropbox
2 Install Dropbox on VPS

Depending on the version of the operating system Linux VPS you are 64 bit or 32 bit version which we use the command below to install:

Dropbox command set for 64-bit:
1

wget-O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86_64”

Dropbox command set for 32-bit:
1

wget-O dropbox.tar.gz “http://www.dropbox.com/download/?plat=lnx.x86”

After completing download Dropbox on VPS. I continued to unpack command:
1

tar -xvzf dropbox.tar.gz

and run dropbox
1

./.dropbox-dist/dropboxd

after running dropbox, you will see a paragraph with the following text:
1
2

This computer is not linked to any Dropbox account …
Please visit this link to https://www.dropbox.com/cli_link?host_id=abcxyz device.

Now you copy the same link
1

https://www.dropbox.com/cli_link?host_id=abcxyz

into a browser, log in with your Dropbox account to authenticate connections VPS and Dropbox. logged in you will be informed:
Guide VPS automatically backup data to Dropbox
Log on to the browser, then the SSH command line window will appear:
1

This computer is now linked to Dropbox. Welcome mr ABC

I escaped by Ctrl + C

After you’ve done this, all data between VPS and Dropbox accounts will be a two-way connection. That means you change the contents of files in the Dropbox folder
VPS, the VPS on the change as well and vice versa.
3 Perform VPS backup to Dropbox

The folders and files in / root / Dropbox on VPS will be backed up to Dropbox.

But due to the path of the database file and our website located in other directories. So we need to symlink the folder to the Dropbox folder. In this article I use the folder path under HZserver website and database. On your VPS, if you substitute another path offline equivalent.

First we create the folder containing the backup VPS BackupVPS
1

mkdir / root / Dropbox / BackupVPS

Next symlink home folder contains all the code website:
1

ln / home / / root / Dropbox / BackupVPS / home

Now in your Dropbox account, will have BackupVPS folder, including all of the backup of / home on a VPS.

So finished the backup code. Next go to the backup database.

I. In case your database uses MyISAM as default engine.

(If you use a VPS HZserver on the database engine is set as the default MyISAM)

With this case, you just need to symlink folders mysql on VPS is very BackupVPS. When you want to restore, copy the folder to the same place where all the restoration is finished.
1

ln / var / lib / mysql / root / Dropbox / BackupVPS / mysql

II. In case you used database engine such as InnoDB

Create backup_database.sh file in / home with the following contents:
1
2

#! / bin / bash
mysqldump u [mysqlusername]-p [pass] mysqldatabasename> / root / BackupVPS / mysql / mydatabasename_data '% m-% d% Y'.sql

Next create a cronjob for this bash script auto run daily at 3:30 with the command:
1

l crontab> file; echo ’30 * 3 * /home/backup_database.sh> / dev / null 2> & 1 ‘>> file; crontab file

4 Run Dropbox

I run dropbox by executing the following command in turn 3:
1
2
3

wget-O ~ / dropbox.py “http://www.dropbox.com/download?dl=packages/dropbox.py”
chmod 755 ~ / dropbox.py
~ / dropbox.py start

5 Make sure Dropbox always Cronjob to run in any circumstances

(Such as restart the VPS, VPS off and then on again, any software crash)

You create a cronjob using the following command:
1

l crontab> file; echo ‘reboot ~ / dropbox.py start> / dev / null 2> & 1’ >> file; crontab file

Run the command is finished, you encountered “no crontab for root” problem is not okay.

Note: This step is extremely important, because after you restart the VPS, Dropbox will automatically be turned off and not turned back.
6 The Test command.

To check if cronjob to add Dropbox always has successfully run yet. We use the command
1

l crontab

Check the status of Dropbox
1

~ / dropbox.py status

It is used to stop Dropbox backup command
1

~ / dropbox.py stop

See also:

Godaddy Economy Package only 12 USD / year + Free domain and 50% discount on other hosting packages.
Subscribe and receive charging 5 USD to 10 USD in VPS account at VULTR

Leave a Reply

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