CentOS7上YUM安装MariaDB 10

首先先要去mariadb网站获取下载信息,以便下一步编辑安装的配置文件:

找到你要装的版本 - 比如当前选择的是CentOS/64位/10.2
https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna&distro=CentOS&distro_release=centos7-amd64--centos7&version=10.2

配置YUM安装源

下面是 CentOS的自定义安装YUM源,粘贴复制这些到/etc/yum.repos.d/,建议命名
MariaDB.repo

1
2
3
4
5
6
7
# MariaDB 10.2 CentOS repository list - created 2017-12-26 14:20 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

因为官网的源下载安装非常慢,可以用以下源:

1
2
3
4
5
6
7
# MariaDB 10.2 CentOS repository list - created 2017-07-03 06:59 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

安装MariaDB

更新完上述文件以后,使用以下命令安装 MariaDB:

sudo yum install MariaDB-server MariaDB-client

安装完成其它步骤参考 CentOS7上YUM安装MySQL5.7