In this tutorial, we will show you how to install and configuration of AutoMySQLBackup on your Ubuntu server. For those of you who didn’t know, AutoMySQLBackup is a very useful utility for creating daily, weekly or monthly backups of one or more MySQL databases from one or more MySQL servers. By rotating your backups, you can preserve storage space on your account. You can even send backup files to external e-mail accounts for off-site backup redundancy.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation AutoMySQLBackup in Ubuntu server.
Install AutoMySQLBackup on Ubuntu
Step 1. First, make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.
sudo apt-get update sudo apt-get upgrade
Step 2. Installing AutoMySQLBackup.
If you are running Debian based distro, You can install AutoMySQLBackup from the Ubuntu repositories by running the following command as root:
apt-get install automysqlbackup
If you have an RPM-based distro you will have to download AutoMySQLBackup’s installation scripts, run and configure them on your server. The first thing to do is to go to AutoMySQLBackup’s download page and download the latest stable version of AutoMySQLBackup:
Create a directory for Automysqlbackup’s scripts and unpack the downloaded tar archive:
mkdir /opt/automysqlbackup tar zxvf automysqlbackup-v3.0_rc6.tar.gz -C /opt/automysqlbackup
Next, run the Automysqlbackup installation script:
cd /opt/automysqlbackup ./install.sh ### Checking archive files for existence, readability and integrity. automysqlbackup ... exists and is readable ... md5sum okay :) automysqlbackup.conf ... exists and is readable ... md5sum okay :) README ... exists and is readable ... md5sum okay :) LICENSE ... exists and is readable ... md5sum okay :) Select the global configuration directory [/etc/automysqlbackup]: Select directory for the executable [/usr/local/bin]: ### Creating global configuration directory /etc/automysqlbackup: success
Step 3. Configure AutoMySQLBackup.
Next, we have to configure AutoMySQLBackup. Open its configuration file located in the directory we set when we ran the installation script:
And uncomment and set the following configuration directives:
CONFIG_mysql_dump_username='root' CONFIG_mysql_dump_password='YourPassword' CONFIG_mysql_dump_host='localhost' CONFIG_backup_dir='/var/backup/db' CONFIG_do_monthly="01" CONFIG_do_weekly="5" CONFIG_rotation_daily=6 CONFIG_rotation_weekly=35 CONFIG_rotation_monthly=150 CONFIG_mysql_dump_port=3306 CONFIG_mysql_dump_compression='gzip'
Create a directory for the MySQL backups. This is the directory we set as ‘backup_dir’ in the configuration file:
If you want to create a backup of your MySQL databases, run AutoMySQLBackup by executing the following:
Congratulations! You have successfully installed AutoMySQLBackup. Thanks for using this tutorial for installing AutoMySQLBackup on your Ubuntu 15.04 system. For additional help or useful information, we recommend you to check the official AutoMySQLBackup website.