* Create the "backups" directory and set permissions/ownership.
<blockquote>{{Code| cd /var/hda mkdir backups chmod 755 backups chown root:root backups}}</blockquote>
* Move to the "/etc" directory.
<blockquote>{{Code| cd /etc}}</blockquote>
* Make a backup copy of the rsnapshot configuration file. Why? So that there is a reference just in case.
<blockquote>{{Code| cp rsnapshot.conf rsnapshot.conf.bkup}}</blockquote>
* Now using a favourite editor, open the "rnapshot.conf" file.
* Find the "SNAPSHOT ROOT DIRECTORY" section and change "snapshot_root" to path where the backups will be stored.
<blockquote>{{Text|Text= snapshot_root /var/hda/backups/}}</blockquote>
* Find the "BACKUP INTERVALS" section and change the line items. What does this all mean? The "#" character at the beginning of each line means the configuration line item will not be enabled. The "#" is know to set a line to be a "comment" line. The "interval daily" line will be active and 7 days of backups will be kept.
<blockquote>{{Text|Text= #interval hourly 6 interval daily 7
#interval weekly 4
#interval monthly 1
}}
</blockquote>
* Find the "logfile" line and change the line item. The rsnapshot log file will be kept under the "backups" directory.
<blockquote>{{Text|Text= logfile /var/hda/backups/logs/rsnapshot}}</blockquote>
* Find the "BACKUP POINTS / SCRIPTS" section. Add changes as seen below. This is the section that defines the "key directories" source that will be backed up. See the "owncloud/" at the end of each line? Remember the previous "green" server folder? This is where the ownCloud binaries and physical files will be stored.
<blockquote>{{Text|Text= backup /var/hda/files/ owncloud owncloud/ backup /var/hda/web-apps/owncloud/ owncloud/}}</blockquote>
* Next find the line "Backup OwnCloud MySQL database" change as shown below. This set the location where the ownCloud "database dump" backup will be kept. Also the line shows the execution path for the database backup program script file that performs the database backup.
<blockquote>{{Text|Text= backup_script /usr/local/bin/backup_mysql.sh owncloud/database_dump}}</blockquote>
* Save the "rsnapshot.conf" file and return to the command-line prompt.
* Copy database backup script to the "/usr/local/bin/".
<blockquote>{{Code| cp /usr/share/doc/rsnapshot*/utils/backup_mysql.sh }}</blockquote>
:'''*''' - indicates rsnapshot version number
* Go to the "/usr/local/bin/" directory and set the script file permissions and ownership.
<blockquote>{{Code| cd /usr/local/bin/ chown root:root /usr/local/bin/backup_mysql.sh chmod 754 /usr/local/bin/backup_mysql.sh}}</blockquote>
* Edit the "backup_mysql.sh" file.
* Find the line "backup the database" and add the line has shown below. This will be the command that will be issued to do the database backup. The database dump file will be called "owncloud_db.sql".
<blockquote>{{Text|Text= /usr/bin/mysqldump -uowncloud -powncloud owncloud > owncloud_db.sql}}</blockquote>
* Find the line "# make the backup readable only by root" and add the line shown below.
<blockquote>{{Text|Text= /bin/chmod 600 owncloud_db.sql}}</blockquote>
* Save the "backup_mysql.sh" file and return to the command-line prompt.