Installing Holland Backup for mysqldump on CentOS (and now Ubuntu), ‘Cause the Other Guides Suck

All the guides on how to do this SUCK, so here’s my own.

First install the package:

# yum install holland-mysqldump

For Ubuntu, use this script:

#!/bin/bash
OS_VERSION=`lsb_release -i | awk -F ':' '{print $2}' | cut -f2`"_"`lsb_release -r | awk -F ':' '{print $2}' | cut -f2`
sudo wget -q https://download.opensuse.org/repositories/home:/holland-backup/x$OS_VERSION/Release.key -O - | sudo apt-key add - >/dev/null
sudo echo "deb https://download.opensuse.org/repositories/home:/holland-backup/x$OS_VERSION/ ./" > /etc/apt/sources.list.d/holland.list
sudo apt-get update > /dev/null
sudo apt-get install -y holland holland-common holland-mysqldump > /dev/null

Then make the config file:

# holland mk-config  mysqldump > /etc/holland/providers/mysqldump.conf

Then copy the config to the default config:

# cp /etc/holland/providers/mysqldump.conf /etc/holland/backupsets/default.conf

Then edit the default.conf:

# vim /etc/holland/backupsets/default.conf

Alter the backups to keep:

backups-to-keep = 5

Add the user name and password:

[mysql:client]
defaults-extra-file = ~/.my.cnf,
 user = "root" # no default
 password = "hollahollatagteammatch" # no default
# socket = "" # no default
# host = "" # no default
# port = "" # no default

Test it with a dry run:

# holland bk --dry-run

If successful, run this command to set up the cron (that runs the backup on a schedule).

# vim /etc/cron.d/holland

Add this to run it everyday at midnight:

#
# Cron job to backup MySQL
#
0 0 * * * root /usr/sbin/holland bk
# runs at midnight everyday

Finally reload cron:

# service crond reload

Done, that wasn’t so bad, was it?

65660381

 

Leave a Reply

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