离线安装xtrabackup

找一台可以访问外网的CentOS7,然后执行命令下载离线rmp依赖包

mkdir /home/localrepo
cd /home/localrepo

yum install yum-utils createrepo
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm

# 下载所有依赖包到目录/home/xtrabackup-rpm
# 如果本机上已经安装过部分依赖,则无法下载下来,只能手动去一个个下载了,所以最好找一个干净的环境做这些事情
yumdownloader --resolve percona-xtrabackup-24 rsync --destdir=/home/xtrabackup-rpm
wget https://repo.percona.com/yum/release/7/RPMS/x86_64/qpress-11-1.el7.x86_64.rpm

createrepo /home/localrepo
tar -zcf /home/localrepo.tar.gz /home/local/repo

/home/localrepo.tar.gz拷贝到目标主机的/home目录,并解压为/home/localrepo/

# 暂时移除原有repo
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup

# 创建repo文件
echo """
[local]
name=local repo
baseurl=file:///home/localrepo
enabled=1
gpgcheck=0
""" > /etc/yum.repos.d/local.repo

yum clean all
yum update
yum repolist

# 根据本地rpm文件安装
yum -y installrsync qpress percona-xtrabackup-24

# 验证安装
xtrabackup --version
# 输出类似信息
# xtrabackup version 2.4.27 based on MySQL server 5.7.40 Linux (x86_64) (revision id: aae8e82)