A few days wrote two use VPS security Settings blog, in fact, regardless of how we set up security, timely backup of the VPS data is the most important. Because the VPS and host different, host may be a lot of time the service provider for our backup, VPS operations and security most need our own responsibility, even if many VPS provide daily backup services, but the uncertainty is too much. For example, businesses run, machine tools hard disk damage, uncontrollable factors.
About the VPS Backup tutorial methods available, such as our regular backup directly through the FTP download, MySQL database export can also operate, but these are more troublesome, but also need to carry out the human. This article old left to share the current more commonly used automatic timing backup scheme, the database sent to our mailbox, file send synchronization to our other space ftp. Before writing this article, I also refer to other people on the Internet method, I have to test their own to be sure of the feasibility, so finishing this article, there is a need for friends with the old left to test together.
First, my backup environment is CentOS, first to install the Sentmail components:
Copy Code code as follows:
Yum Install SendMail Mutt
The implementation of this file after a series of tutorials should be all, do not need my screenshot.
Second, download the automatic backup file to the Local:
Copy Code code as follows:
http://myvps-scripts.googlecode.com/files/autobackuptoftp.sh
With EditPlus or Notepad open, modify into their own content, behind all have notes, should be relatively simple. After the modification, we need to back up the VPS space we need to set up a backup folder, and your remote FTP space does not have folders need to be wwwroot, when the backup run can not find the directory is not a good backup.
Again, upload autobackuptoftp.sh to our VPS root directory:
Copy Code code as follows:
chmod +x/root/autobackuptoftp.sh #执行文件赋予权限
Crontab-e #准备添加定时设置
* * * * */root/autobackuptoftp.sh # I command to enter the previous script, meaning to back up the data at 12 o ' Hour every night
Finally, we test ourselves to perform a backup by performing the SH autobackuptoftp.sh file.
Note: The above automatic backup tutorial for security purposes, the database will be sent back to our mailboxes at the same time because the database is more important than the file, and the files and databases are sent back to backup to backup FTP and the folder where the site resides, and the three-party backup guarantees the security of the data.