• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

By Abhishek Ghosh May 11, 2018 9:37 am Updated on May 11, 2018

How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

Advertisement

rsnapshot Once Set, Can Automatically Incrementally Backup. rsnapshot is a Free Software intended to use on CLI for server backups. It is essentially a filesystem snapshot utility based on more older tool rsync. rsync takes snapshots of local and remote filesystems, and rotates the snapshots according to your settings. Here is How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS. We discussed about cheap cloud servers/VPS like VPSdime and Aruba cloud. Their cheaper cost make them excellent to use as backup servers. However, SSH needs to be secured with proper configaration of iptables and fail2ban. As they are accessible over public internet, the setup of second cheap server as backup server does have minimum matters of security. Our recommended way of keeping monthly backup is using some cloud storage which can be locked down as private. We can use free Dropbox for that purpose of backup or OpenStack Swift based object storage. However, that way is usually slower. In other words, we need multiple ways of backup and rsnapshot way not going to harm! You can also look at official Github repo of rsnapshot for documentations :

Vim
1
https://github.com/rsnapshot

 

How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

 

Thankfully, rsnapshot is available on repositories of commonly used server OS, so we can easily install rsnapshot on the server that you would like to use as your backup server with these kind of command :

Vim
1
2
apt install rsnapshot
yum install rsnapshot

Now, cd to /etc and look if /etc/rsnapshot.conf.default file exists. In that case simply :

Advertisement

---

Vim
1
cp /etc/rsnapshot.conf.default /etc/rsnapshot.conf

If /etc/rsnapshot.conf.default file does not exist, then create a backup of /etc/rsnapshot.conf file :

Vim
1
cp /etc/rsnapshot.conf /etc/rsnapshot.conf.default

That is for future reference. You can always run configtest :

Vim
1
rsnapshot configtest

To backup another server, backup server will need to be able to connect through SSH. We need to generate SSH keys to authenticate, run this on backup server :

Vim
1
sudo ssh-keygen -t rsa

We will not use a passphrase for this key because we want these servers to auto-connect. Press ENTER through all of the prompts to accept the defaults. We now have a public and private key pair. We need to transfer our public key to the machine we will be backing :

Vim
1
sudo ssh-copy-id -i /root/.ssh/id_rsa.pub root@IP-of-server-to-backup

Now, test from backup server :

Vim
1
sudo ssh root@IP-of-server-to-backup

You should not face password prompt. Return back to backup server.

Now, open that configuration file :

Vim
1
nano /etc/rsnapshot.conf

Arch Linux has good documentation :

Vim
1
https://wiki.archlinux.org/index.php/Rsnapshot

Decide where you would like to store backups. Peoples usually use directory like /backup as backup location. On settings, that will be the path :

Vim
1
snapshot_root /backup/

Uncomment the cmd_ssh line to allow for remote backup and cmd_du lines :

Vim
1
2
cmd_ssh/usr/bin/ssh
cmd_du/usr/bin/du

That cmd_du enables accurate disk usage reports. Uncomment the ssh_args section :

Vim
1
ssh_args-p 25000

What directories to backup is written in this style :

Vim
1
backup      root@IP-of-server-to-backup:/etc/     example.com/

Backup interval part will be like this :

Vim
1
2
3
4
retainhourly  6
retaindaily   7
retainweekly  4
retainmonthly 3

You can test :

Vim
1
2
sudo rsnapshot configtest
sudo rsnapshot -t hourly

How To Set Up rsnapshot For Backup Of WordPress on Cloud Server--VPS

rsnapshot has all scripts, including cron :

Vim
1
sudo nano /etc/cron.d/rsnapshot

That will look after editing like this :

Vim
1
2
3
4
0 */4         * * *           root    /usr/bin/rsnapshot hourly
30 3          * * *           root    /usr/bin/rsnapshot daily
0  3          * * 1           root    /usr/bin/rsnapshot weekly
30 2          1 * *           root    /usr/bin/rsnapshot monthly

You can check disk space :

Vim
1
rsnapshot du

So, you understood that WordPress PHP files, images will be pulled to backup server. But what about MySQL? rsnapshot has lot of scripts, and for MySQL, below is brief list of works to setup :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
apt-get install mysql-client
cp /usr/share/doc/rsnapshot/examples/utils/backup_mysql.sh /usr/local/bin/
chown root.root /usr/local/bin/backup_mysql.sh
chmod o-w /usr/local/bin/backup_mysql.sh
nano /usr/local/bin/backup_mysql.sh
# replace
## /usr/bin/mysqldump --all-databases > mysqldump_all_databases.sql
# with
## /usr/bin/mysqldump --defaults-file=/etc/mysql/debian.cnf --all-databases > mysqldump_all_databases.sql
# use below command to dump a single database :
## /usr/bin/mysqldump --defaults-file=/etc/mysql/debian.cnf DATABASE > DATABASE.SQL
nano /etc/rsnapshot.conf
# Under BACKUP POINTS / SCRIPTS add
## backup_script/usr/local/bin/backup_mysql.shlocalhost/mysqldump/
# test
rsnapshot configtest

rsnapshot is great tool. There are lot of scripts with huge documentation :

Vim
1
https://github.com/rsnapshot/rsnapshot/tree/master/utils

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Install Apache Hadoop on Ubuntu on Single Cloud Server Instance

    Here is How Install Apache Hadoop on Ubuntu on Single Cloud Server Instance in Stand-Alone Mode With Minimum System Requirement and Commands.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy