Linux VPS backup tutorial automatic and scheduled backup of database/website files

Source: Internet
Author: User
Tags vps

I wrote two blog posts on VPS security settings in a few days. In fact, no matter how secure we are, backing up VPS data in a timely manner is the most important thing. Because the VPS is different from the host, the host may often be backed up by the service provider on our behalf. Most of the operations and security of VPS require us to be responsible for this. Even if many VPS provide daily backup services, but there are too many uncertain factors. For example, the merchant runs the road, the hard disk of the master machine is damaged, and uncontrollable factors.

There are also many methods available for VPS backup tutorial methods. For example, we can download conventional backup files directly through FTP, and export MYSQL Databases can also be operated, but these operations are troublesome, in addition, manual execution is required. In this article, I would like to share with you the commonly used automatic and scheduled backup solution. The database is sent to our mailbox and the file is sent and synchronized to another FTP space. Before writing this article, I also refer to other people's methods on the Internet. I have to test it myself before I can be sure of the Feasibility. So I will sort out this article, A friend in need can test with the old left.

First, my backup environment is centos. First install the sentmail component:

Copy codeThe Code is as follows: yum install sendmail mutt

After executing this file, you should have gone through a series of tutorials. You don't need me anymore.

Next, download the automatic backup file to the local device:

Copy codeCode: http://myvps-scripts.googlecode.com/files/autobackuptoftp.sh

Open it with editplus or notepad and modify it to your own content. There are remarks in the future, which should be relatively simple. After modification, we need to create a backup folder under the wwwroot VPS space that we need to back up, and all the folders that you do not have in the remote FTP space need to be created manually, it is difficult to back up the directory that cannot be found during the backup operation.

Upload autobackuptoftp. sh to the ROOT directory of our VPS:

Copy codeThe Code is as follows: chmod + x/root/autobackuptoftp. sh # grant permissions to the execution File
Crontab-e # Prepare to add timing settings
00 00 ***/root/autobackuptoftp. sh # Run the I command and press enter to insert the preceding script, which means to back up data at midnight every day.

Finally, we can test the file sh autobackuptoftp. sh to perform backup.

Note: The above automatic backup tutorial will also send a database backup to our mailbox for security reasons, because the database is more important than the file; and files and databases will be synchronously sent to the BACKUP folder of the backup ftp and website space. The third-party BACKUP ensures data security.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.