repo文件如下
/etc/yum.repos.d/mongo.repo
[mngodb-org]
name=MongoDB Repository
baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/4.0/x86_64/
gpgcheck=0
enabled=1
/etc/yum.repos.d/mariadb.repo
# MariaDB 10.9 CentOS repository list - created 2023-10-08 03:36 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/10.9/centos/$releasever/$basearch
baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.7/centos/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
不同版本修改repo文件中的版本号即可