具体安装过程如下
1. 添加percona的软件仓库
sudo add-apt-repository 'deb http://repo.percona.com/apt focal main'
2. 添加percona的公钥
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get update
3. 安装xtrabackup
sudo apt-get install percona-xtrabackup-24
若安装过程中出现如下错误信息
The following packages have unmet dependencies:
percona-xtrabackup-24 : Depends: libdbd-mysql-perl but it is not going to be installed
Depends: libcurl4-openssl-dev but it is not going to be installed
Depends: libev4 (>= 1:4.04) but it is not going to be installed
percona-xtrabackup-80 : Depends: libdbd-mysql-perl but it is not going to be installed
Depends: libcurl4-openssl-dev but it is not going to be installed
Depends: libev4 (>= 1:4.04) but it is not going to be installed
Depends: libssl1.1 (>= 1.1.1) but it is not installable
Conflicts: percona-xtrabackup-24 but 2.4.28-1.jammy is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
则根据提示执行相应的命令修复
sudo apt --fix-broken install
4.验证安装好的版本信息
ubuntu@mysql:~$ sudo xtrabackup --version
xtrabackup: recognized server arguments: --datadir=/var/lib/mysql --tmpdir=/tmp
xtrabackup version 2.4.28 based on MySQL server 5.7.40 Linux (x86_64) (revision id: 44a8f7b)
ubuntu@mysql:~$
5. 创建备份目录
sudo mkdir -p /backup/mysql
6. 备份数据库
sudo innobackupex --user=root --password=Aa123456# /backup/mysql