LinuxTutorialsUbuntu

How To Install AutoMySQLBackup on Ubuntu

Install AutoMySQLBackup on Ubuntu

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 the Ubuntu server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu Linux.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install AutoMySQLBackup on Ubuntu

Step 1. First, make sure that all your system packages are up-to-date by running the 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:

wget http://downloads.sourceforge.net/project/automysqlbackup/AutoMySQLBackup/AutoMySQLBackup%20VER%203.0/automysqlbackup-v3.0_rc6.tar.gz

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:

nano /etc/automysqlbackup/automysqlbackup.conf

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:

mkdir /var/backup

If you want to create a backup of your MySQL databases, run AutoMySQLBackup by executing the following:

automysqlbackup

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 check the official AutoMySQLBackup website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
Back to top button