国产服务器操作系统一般基于 RHEL 修改而来,不通版本的国产发行版对应的 RHEL 版本可能不同,使用对应的方法即可 * RHEL8 类似物:银河麒麟 V10 SP3、华为欧拉、阿里龙蜥 8.x 等 * RHEL7 类似物:银河麒麟 V10 SP1/SP2、阿里龙蜥 7.x 等 # 1. Docker [scode type="yellow" size=""]如发行版自带源有 `docker-engine` 则优先使用自带版本[/scode] ## 1.1 RHEL8 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/docker-ce.repo << EOF [docker-ce-stable] name=Docker CE Stable - \$basearch baseurl=https://mirrors.ustc.edu.cn/docker-ce/linux/centos/8/\$basearch/stable enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo dnf erase podman buildah -y sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install docker-ce -y ``` [font color="red"]**如果出现缺少依赖的报错**[/font],可以尝试添加 CentOS 8 软件源后再次安装(没有报错不用执行) [collapse status="false" title="添加 CentOS 8 源"] ```bash wget http://mirrors.aliyun.com/repo/Centos-8.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/8/g' /etc/yum.repos.d/CentOS-Base.repo sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install -y docker-ce --nogpgcheck ``` [/collapse] ## 1.2 RHEL7 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/docker-ce.repo << EOF [docker-ce-stable] name=Docker CE Stable - \$basearch baseurl=https://mirrors.ustc.edu.cn/docker-ce/linux/centos/7/\$basearch/stable enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo yum erase podman buildah -y sudo yum makecache sudo yum list docker-ce --showduplicates | sort -r sudo yum install -y docker-ce --nogpgcheck ``` [font color="red"]**如果出现缺少依赖的报错**[/font],可以尝试添加 CentOS 7 软件源后再次安装(没有报错不用执行) [collapse status="false" title="添加 CentOS 7 源(x86 架构)"] ```bash wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install -y docker-ce --nogpgcheck ``` [/collapse] [collapse status="false" title="添加 CentOS 7 源(ARM架构)"] ```bash wget http://mirrors.aliyun.com/repo/Centos-altarch-7.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo sudo yum makecache sudo yum list docker-ce --showduplicates | sort -r sudo yum install -y docker-ce --nogpgcheck ``` [/collapse] # 2. MySQL ## 2.1 RHEL8 类似物 RHEL8 类似物需要执行以下命令关闭自带mysql模块 ```bash dnf module disable mysql -y ``` 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/mysql-community.repo << EOF [mysql-connectors-community] name=MySQL Connectors Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-connectors-community/el/8/\$basearch/ enabled=1 gpgcheck=0 [mysql-tools-community] name=MySQL Tools Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-tools-community/el/8/\$basearch/ enabled=1 gpgcheck=0 [mysql-8.0-community] name=MySQL 8.0 Community Server baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-8.0-community/el/8/\$basearch/ enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo dnf list mysql-community-server --showduplicates | sort -r sudo dnf install mysql-community-server -y ``` ## 2.2 RHEL7 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/mysql-community.repo << EOF [mysql-connectors-community] name=MySQL Connectors Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-connectors-community/el/7/\$basearch/ enabled=1 gpgcheck=0 [mysql-tools-community] name=MySQL Tools Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-tools-community/el/7/\$basearch/ enabled=1 gpgcheck=0 [mysql-8.0-community] name=MySQL 8.0 Community Server baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-8.0-community/el/7/\$basearch/ enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo yum list mysql-community-server --showduplicates | sort -r sudo yum install mysql-community-server -y ``` Loading... 国产服务器操作系统一般基于 RHEL 修改而来,不通版本的国产发行版对应的 RHEL 版本可能不同,使用对应的方法即可 * RHEL8 类似物:银河麒麟 V10 SP3、华为欧拉、阿里龙蜥 8.x 等 * RHEL7 类似物:银河麒麟 V10 SP1/SP2、阿里龙蜥 7.x 等 # 1. Docker <div class="tip inlineBlock warning"> 如发行版自带源有 `docker-engine` 则优先使用自带版本 </div> ## 1.1 RHEL8 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/docker-ce.repo << EOF [docker-ce-stable] name=Docker CE Stable - \$basearch baseurl=https://mirrors.ustc.edu.cn/docker-ce/linux/centos/8/\$basearch/stable enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo dnf erase podman buildah -y sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install docker-ce -y ``` <span style='color:red'>**如果出现缺少依赖的报错**</span>,可以尝试添加 CentOS 8 软件源后再次安装(没有报错不用执行) <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-0638fae54fcc5fcd9ca8cdd52f6ae0a578" aria-expanded="true"><div class="accordion-toggle"><span style="">添加 CentOS 8 源</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-0638fae54fcc5fcd9ca8cdd52f6ae0a578" class="collapse collapse-content"><p></p> ```bash wget http://mirrors.aliyun.com/repo/Centos-8.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/8/g' /etc/yum.repos.d/CentOS-Base.repo sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install -y docker-ce --nogpgcheck ``` <p></p></div></div></div> ## 1.2 RHEL7 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/docker-ce.repo << EOF [docker-ce-stable] name=Docker CE Stable - \$basearch baseurl=https://mirrors.ustc.edu.cn/docker-ce/linux/centos/7/\$basearch/stable enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo yum erase podman buildah -y sudo yum makecache sudo yum list docker-ce --showduplicates | sort -r sudo yum install -y docker-ce --nogpgcheck ``` <span style='color:red'>**如果出现缺少依赖的报错**</span>,可以尝试添加 CentOS 7 软件源后再次安装(没有报错不用执行) <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-25d53238d7dac159912abc82707e776322" aria-expanded="true"><div class="accordion-toggle"><span style="">添加 CentOS 7 源(x86 架构)</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-25d53238d7dac159912abc82707e776322" class="collapse collapse-content"><p></p> ```bash wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo sudo dnf makecache sudo dnf list docker-ce --showduplicates | sort -r sudo dnf install -y docker-ce --nogpgcheck ``` <p></p></div></div></div> <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-cbc276c6a7c3c4b34f1c05635d8bc4a123" aria-expanded="true"><div class="accordion-toggle"><span style="">添加 CentOS 7 源(ARM架构)</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-cbc276c6a7c3c4b34f1c05635d8bc4a123" class="collapse collapse-content"><p></p> ```bash wget http://mirrors.aliyun.com/repo/Centos-altarch-7.repo -O /etc/yum.repos.d/CentOS-Base.repo sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo sudo yum makecache sudo yum list docker-ce --showduplicates | sort -r sudo yum install -y docker-ce --nogpgcheck ``` <p></p></div></div></div> # 2. MySQL ## 2.1 RHEL8 类似物 RHEL8 类似物需要执行以下命令关闭自带mysql模块 ```bash dnf module disable mysql -y ``` 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/mysql-community.repo << EOF [mysql-connectors-community] name=MySQL Connectors Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-connectors-community/el/8/\$basearch/ enabled=1 gpgcheck=0 [mysql-tools-community] name=MySQL Tools Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-tools-community/el/8/\$basearch/ enabled=1 gpgcheck=0 [mysql-8.0-community] name=MySQL 8.0 Community Server baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-8.0-community/el/8/\$basearch/ enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo dnf list mysql-community-server --showduplicates | sort -r sudo dnf install mysql-community-server -y ``` ## 2.2 RHEL7 类似物 执行以下命令添加源: ```bash sudo tee /etc/yum.repos.d/mysql-community.repo << EOF [mysql-connectors-community] name=MySQL Connectors Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-connectors-community/el/7/\$basearch/ enabled=1 gpgcheck=0 [mysql-tools-community] name=MySQL Tools Community baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-tools-community/el/7/\$basearch/ enabled=1 gpgcheck=0 [mysql-8.0-community] name=MySQL 8.0 Community Server baseurl=https://mirror.nju.edu.cn/mysql/yum/mysql-8.0-community/el/7/\$basearch/ enabled=1 gpgcheck=0 EOF ``` 执行以下命令安装: ```bash sudo yum list mysql-community-server --showduplicates | sort -r sudo yum install mysql-community-server -y ``` Last modification:March 10, 2025 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏