On CentOS 5, we need libaio for MySQL server installation.
$ sudo yum install libaio
$ sudo rpm -ivh MySQL-server-5.5.31-2.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
$ sudo rpm -ivh MySQL-shared-compact-5.5.31-2.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-shared-compat ########################################### [100%]
$ sudo rpm -ivh MySQL-client-5.5.31-2.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
We have to let MySQL use "Table Per File" mode. For example, the my.cnf mysql section setting is like:
[mysqld]
......
......
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_per_table = 1
datadir = /var/lib/mysql/datadir
innodb_data_home_dir = /var/lib/mysql/ibdatadir
innodb_log_group_home_dir = /var/lib/mysql/log
tmpdir = /var/lib/mysql/tmp
Then we should use the shell script to make the folder ready:
$cd /var/lib/mysql
$sudo mkdir datadir
$sudo mkdir ibdatadir
$sudo mkdir log
$sudo mkdir tmp
$sudo chown -R mysql:mysql /var/lib/mysql
The fresh New MySQL instance could be create by the following command.
$ sudo mysql_install_db
Alternatively you can run:
$/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
The XtraBackup has different build based on Linux Kernel ang glic version.
percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm is suitable to CentOS 6
percona-xtrabackup-2.1.5-680.rhel5.x86_64.rpm is suitable to CentOS 5
Don't try to upgrade the GLIBC's version in Linux Kernel otherwise the Kernel would be instable by change the Glibc.
your can use the Linux command below to check the OS Release edition and MySQL's version:
rpm -qa | grep MySQL
rpm -qa | grep percona
cat /etc/*release
uname -a
MySQL 5.1 is only supported by XtraBackup 2.0.8. Therefore, for older MySQL we need use previous version's XtraBackup.
For MySQL 5.5+, XtraBackup 2.1.5 is OK.
Here is the Installation Process:
$ rpm -ivh percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm
warning: percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
error: Failed dependencies:
perl(DBD::mysql) is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
perl(Time::HiRes) is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
You can see the innobackupex.pm perl script require some package for running. Hence we should install the perl packages first:
sudo yum install perl-DBD-MySQL
sudo yum install perl-Time-HiRes
Then the installation of XtraBackup would be successful.
$ sudo rpm -ivh percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm
warning: percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID cd2efd2a: NOKEY
Preparing... ########################################### [100%]
1:percona-xtrabackup ########################################### [100%]
Just in case that list down the error message for CentOS5.
#CentOS 5 is too old and require more dependency for XtraBackup
$ rpm -ivh percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm
warning: percona-xtrabackup-2.1.5-680.rhel6.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID cd2efd2a
error: Failed dependencies:
libc.so.6(GLIBC_2.7)(64bit) is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
libc.so.6(GLIBC_2.8)(64bit) is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
perl(DBD::mysql) is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
rpmlib(FileDigests) <= 4.6.0-1 is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64
rpmlib(PayloadIsXz) <= 5.2-1 is needed by percona-xtrabackup-2.1.5-680.rhel6.x86_64