暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

CentOS 7 如何yum安装 MariaDB 10.3.X

原创 DBA周技 2023-08-27
1483

##

CentOS 7 如何yum安装 MariaDB 10.3.X

#官网没有直接的10.3安装的repo了,所以使用如下方法

1、指定具体的X版本

如指定安装10.3.34,则需要编辑

[root@centos ~]# vi /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB-10.3.34 baseurl= http://archive.mariadb.org/mariadb-10.3.34/yum/centos/$releasever/$basearch gpgkey= https://archive.mariadb.org/PublicKey gpgcheck=1

清除yum缓存

[root@centos ~]# yum clean all
2、不指定具体的X版本

这样会安装mariadb下10.6的最新版本

[root@centos ~]# cat /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB baseurl = https://rpm.mariadb.org/10.6/rhel/$releasever/$basearch gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

清除yum缓存

[root@centos ~]# yum clean all
3、安装
[root@centos ~]# yum install MariaDB-server MariaDB-client

启动并登录

[root@centos ~]# systemctl start mariadb [root@centos ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.6.15-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
4、参考文档

https://mariadb.com/kb/en/yum/

yum包下载地址:https://mirror.mariadb.org/yum/

Installing MariaDB with yum/dnf

On RHEL, CentOS, Fedora, and other similar Linux RPM based distributions, these provide MariaDB packages. These are supported by those distributions. If you have a particular need for a later version than what is in the distribution, then MariaDB provides repositories for them.

Using repositories rather than installing RPM allows for an ease of update when a new release is made. It is highly recommended to install the relevant RPM packages from MariaDB’s repository using yum or dnf. Centos 7 still uses yum, most others use dnf, and SUSE/openSUSE use zypper.

This page walks you through the simple installation steps using dnf and yum.

Adding the MariaDB YUM repository

We currently have YUM/DNF repositories for the following Linux distributions, and for the versions that are in standard (not extended) support:

  • Red Hat Enterprise Linux (RHEL)
  • CentOS
  • Fedora
  • openSUSE
  • SUSE

Using the MariaDB Package Repository Setup Script

If you want to install MariaDB with yum, then you can configure yum to install from MariaDB Corporation’s MariaDB Package Repository by using the MariaDB Package Repository setup script.

MariaDB Corporation provides a MariaDB Package Repository for several Linux distributions that use yum to manage packages. This repository contains software packages related to MariaDB Server, including the server itself, clients and utilities, client libraries, plugins, and Mariabackup. The MariaDB Package Repository setup script automatically configures your system to install packages from the MariaDB Package Repository.

To use the script, execute the following command:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Note that this script also configures a repository for MariaDB MaxScale and a repository for MariaDB Tools, which currently only contains Percona XtraBackup and its dependencies.

See MariaDB Package Repository Setup and Usage for more information.

Using the MariaDB Repository Configuration Tool

If you want to install MariaDB with yum, then you can configure yum to install from MariaDB Foundation’s MariaDB Repository by using the MariaDB Repository Configuration Tool.

The MariaDB Foundation provides a MariaDB repository for several Linux distributions that use yum to manage packages. This repository contains software packages related to MariaDB Server, including the server itself, clients and utilities, client libraries, plugins, and Mariabackup. The MariaDB Repository Configuration Tool can easily generate the appropriate configuration file to add the repository for your distribution.

Once you have the appropriate repository configuration section for your distribution, add it to a file named MariaDB.repo under /etc/yum.repos.d/.

For example, if you wanted to use the repository to install MariaDB 10.6 on RHEL (any version), then you could use the following yum repository configuration in /etc/yum.repos.d/MariaDB.repo:

[mariadb]
name = MariaDB
baseurl = https://rpm.mariadb.org/10.6/rhel/$releasever/$basearch
gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

The example file above includes a gpgkey line to automatically fetch the GPG public key that is used to verify the digital signatures of the packages in our repositories. This allows the the yum, dnf, and rpm utilities to verify the integrity of the packages that they install.

Pinning the MariaDB Repository to a Specific Minor Release

If you wish to pin the yum repository to a specific minor release, or if you would like to do a yum downgrade to a specific minor release, then you can create a yum repository configuration with a baseurl option set to that specific minor release.

The MariaDB Foundation archives repositories all releases is at the following URL:

  • http://archive.mariadb.org/

Note this isn’t configured as a highly available server. For that purpose please use the main mirrors.

For example, if you wanted to pin your repository to MariaDB 10.3.34 on CentOS 7, then you could use the following yum repository configuration in /etc/yum.repos.d/MariaDB.repo:

[mariadb]
name = MariaDB-10.3.34
baseurl= http://archive.mariadb.org/mariadb-10.3.34/yum/centos/$releasever/$basearch
gpgkey= https://archive.mariadb.org/PublicKey
gpgcheck=1

Note that if you change an existing repository configuration, then you may need to execute the following:

sudo yum clean all

Updating the MariaDB YUM repository to a New Major Release

MariaDB’s yum repository can be updated to a new major release. How this is done depends on how you originally configured the repository.

Updating the Major Release with the MariaDB Package Repository Setup Script

If you configured yum to install from MariaDB Corporation’s MariaDB Package Repository by using the MariaDB Package Repository setup script, then you can update the major release that the repository uses by running the script again.

Updating the Major Release with the MariaDB Repository Configuration Tool

If you configured yum to install from MariaDB Foundation’s MariaDB Repository by using the MariaDB Repository Configuration Tool, then you can update the major release that the repository uses by updating the yum repository configuration file in-place. For example, if you wanted to change the repository from MariaDB 10.6 to MariaDB 10.11, and if the repository configuration file was at /etc/yum.repos.d/MariaDB.repo, then you could execute the following:

sudo sed -i 's/10.6/10.11/' /etc/yum.repos.d/MariaDB.repo

After that, the repository should refer to MariaDB 10.11.

If the yum repository is pinned to a specific minor release, then the above sed command can result in an invalid repository configuration. In that case, the recommended options are:

  • Edit the MariaDB.repo repository file manually.
  • Or delete the MariaDB.repo repository file, and then install the repository of the new version with the more robust MariaDB Package Repository setup script.

Importing the MariaDB GPG Public Key

Before MariaDB can be installed, you also have to import the GPG public key that is used to verify the digital signatures of the packages in our repositories. This allows the yum, dnf and rpm utilities to verify the integrity of the packages that they install.

The id of our GPG public key is:

  • short form: 0xC74CD1D8
  • long form: 0xF1656F24C74CD1D8
  • full fingerprint: 177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8

yum should prompt you to import the GPG public key the first time that you install a package from MariaDB’s repository. However, if you like, the rpm utility can be used to manually import this key instead. For example:

sudo rpm --import https://supplychain.mariadb.com/MariaDB-Server-GPG-KEY

Once the GPG public key is imported, you are ready to install packages from the repository.

Old Key

For releases before 2023 an older SHA1 based GPG key was used.

The id of this older GPG public key was 0xcbcb082a1bb943db. The short form was 0x1BB943DB. The full key fingerprint was:

1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB

Installing MariaDB Packages with YUM/DNF

After the dnf/yum repository is configured, you can install MariaDB by executing the dnf or yum command. The specific command that you would use would depend on which specific packages that you want to install.

Installing the Most Common Packages

MariaDB starting with 10.4

In MariaDB 10.4 and later, to Install the most common packages, execute the following command:

sudo dnf install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
MariaDB until 10.3

In MariaDB 10.3 and before, to Install the most common packages, execute the following command:

sudo yum install MariaDB-server galera MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

Installing MariaDB Server

To Install MariaDB Server, execute the following command:

sudo dnf install MariaDB-server

Installing MariaDB Galera Cluster with YUM

The process to install MariaDB Galera Cluster with the MariaDB yum repository is practically the same as installing standard MariaDB Server.

In MariaDB 10.4 and later, you also need to install the galera-4 package to obtain the Galera 4 wsrep provider library.

In MariaDB 10.3 and before, you also need to install the galera package to obtain the Galera 3 wsrep provider library.

MariaDB starting with 10.4

In MariaDB 10.4 and later, to install MariaDB Galera Cluster, you could execute the following command:

sudo yum install MariaDB-server MariaDB-client galera-4
MariaDB until 10.3

In MariaDB 10.3 and before, to install MariaDB Galera Cluster, you could execute the following command:

sudo yum install MariaDB-server MariaDB-client galera

If you haven’t yet imported the MariaDB GPG public key, then yum will prompt you to import it after it downloads the packages, but before it prompts you to install them.

See MariaDB Galera Cluster for more information on MariaDB Galera Cluster.

Installing MariaDB Clients and Client Libraries with YUM

In MariaDB 10.2 and later, MariaDB Connector/C has been included as the client library (staticly linked). However, the package name for the client library has not been changed.

To Install the clients and client libraries, execute the following command:

sudo yum install MariaDB-client MariaDB-shared

If you want compile your own programs against MariaDB Connector/C, execute the following command:

sudo yum install MariaDB-devel

Installing Mariabackup with YUM

To install Mariabackup, execute the following command:

sudo yum install MariaDB-backup

Installing Plugins with YUM

Some plugins may also need to be installed.

For example, to install the cracklib_password_check password validation plugin, execute the following command:

sudo yum install MariaDB-cracklib-password-check

Installing Debug Info Packages with YUM

MariaDB starting with 5.5.64

The MariaDB yum repository first added debuginfo packages in MariaDB 5.5.64, MariaDB 10.1.39, MariaDB 10.2.23, MariaDB 10.3.14, and MariaDB 10.4.4.

The MariaDB yum repository also contains debuginfo packages. These package may be needed when debugging a problem.

Installing Debug Info for the Most Common Packages with YUM

To install debuginfo for the most common packages, execute the following command:

sudo yum install MariaDB-server-debuginfo MariaDB-client-debuginfo MariaDB-shared-debuginfo MariaDB-backup-debuginfo MariaDB-common-debuginfo

All packages have their debuginfo by appending -debuginfo to the package name.

Installing Debug Info for MariaDB Server with YUM

To install debuginfo for MariaDB Server, execute the following command:

sudo yum install MariaDB-server-debuginfo

Installing Older Versions from the Repository

The MariaDB yum repository contains the last few versions of MariaDB. To show what versions are available, use the following command:

yum list --showduplicates MariaDB-server

In the output you will see the available versions. For example:

$ yum list --showduplicates MariaDB-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirrors.ovh.net
 * extras: centos.mirrors.ovh.net
 * updates: centos.mirrors.ovh.net
Available Packages
MariaDB-server.x86_64   10.3.10-1.el7.centos    mariadb
MariaDB-server.x86_64   10.3.11-1.el7.centos    mariadb
MariaDB-server.x86_64   10.3.12-1.el7.centos    mariadb
mariadb-server.x86_64   1:5.5.60-1.el7_5         base   

The MariaDB yum repository in this example contains MariaDB 10.3.10, MariaDB 10.3.11, and MariaDB 10.3.12. The CentOS base yum repository also contains MariaDB 5.5.60.

To install an older version of a package instead of the latest version we just need to specify the package name, a dash, and then the version number. And we only need to specify enough of the version number for it to be unique from the other available versions.

However, when installing an older version of a package, if yum has to install dependencies, then it will automatically choose to install the latest versions of those packages. To ensure that all MariaDB packages are on the same version in this scenario, it is necessary to specify them all.

The packages that the MariaDB-server package depend on are: MariaDB-client, MariaDB-shared, and MariaDB-common. Therefore, to install MariaDB 10.3.11 from this yum repository, we would do the following:

sudo yum install MariaDB-server-10.3.11 MariaDB-client-10.3.11 MariaDB-shared-10.3.11 MariaDB-backup-10.3.11 MariaDB-common-10.3.11

The rest of the install and setup process is as normal.

After Installation

After the installation is complete, you can start MariaDB.

If you are using MariaDB Galera Cluster, then keep in mind that the first node will have to be bootstrapped.

Comments

Include Archived

3 years, 1 month ago Nadav Kavalerchik

Re: Installing MariaDB with yum/dnf

While upgrading from 10.1 to 10.2 I was asked for a missing package dependency: --> Processing Dependency: libboost_program_options.so.1.53.0()(64bit) for package: galera-25.3.29-1.rhel7.el7.centos.x86_64 --> Finished Dependency Resolution Error: Package: galera-25.3.29-1.rhel7.el7.centos.x86_64 (mariadb) Requires: libboost_program_options.so.1.53.0()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

So I installed it directly using RPM from: https://centos.pkgs.org/7/centos-x86_64/boost-program-options-1.53.0-28.el7.x86_64.rpm.html

3 years, 11 months ago Alex Gilev

Re: Installing MariaDB with yum/dnf

Aditionally if you get No package MariaDB-Galera-server available. Check file /etc/yum.conf, if my case there was a string: exclude=ansible1.9,mysql,mariadb,mariadb-*,Percona-XtraDB-*,Percona-*-55,Percona-*-56,Percona-*-51,Percona-*-50 Just comment this string and install goes well.

5 years, 4 months ago arnisjuraga

Re: Installing MariaDB with yum

If You get

No package MariaDB-server available.
  1. check the correct Repository. I incorrectly added Centos 7 ppc64) repos instead of x86_64 2. When I fixed correct repo addresses, I needed to run
yum clean all

only then MariaDB installed correctly.

5 years, 7 months ago 张晓斌

[Errno 256] No more mirrors to try.

Downloading packages: MariaDB-10.1.30-centos7-x86_64 FAILED http://yum.mariadb.org/10.2/centos7-amd64/rpms/MariaDB-10.1.30-centos7-x86_64-server.rpm: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. To address this issue please refer to the below knowledge base article

https://access.redhat.com/articles/1320623

If above article doesn’t help to resolve this issue please create a bug on https://bugs.centos.org/

MariaDB-10.1.30-centos7-x86_64 FAILED http://yum.mariadb.org/10.2/centos7-amd64/rpms/MariaDB-10.1.30-centos7-x86_64-shared.rpm: [Errno 14] HTTP Error 404 - Not Found Trying other mirror. MariaDB-10.1.30-centos7-x86_64 FAILED http://yum.mariadb.org/10.2/centos7-amd64/rpms/MariaDB-10.1.30-centos7-x86_64-client.rpm: [Errno 14] HTTP Error 404 - Not Found Trying other mirror.

Error downloading packages: MariaDB-server-10.1.30-1.el7.centos.x86_64: [Errno 256] No more mirrors to try. MariaDB-shared-10.1.30-1.el7.centos.x86_64: [Errno 256] No more mirrors to try. MariaDB-client-10.1.30-1.el7.centos.x86_64: [Errno 256] No more mirrors to try.

5 years, 7 months ago Ian Gilfillan

[Re: Errno 256] No more mirrors to try.

You trying to download 10.1 from a 10.2 repo - try http://yum.mariadb.org/10.1/centos7-amd64/rpms/MariaDB-10.1.30-centos7-x86_64-shared.rpm

6 years, 7 months ago Harris Marfel

Re: Installing MariaDB with yum

http://yum.mariadb.org/10.1/centos7-amd64/rpms/MariaDB-10.1.21-centos7-x86_64-client.rpm: [Errno 12] Timeout on http://yum.mariadb.org/10.1/centos7-amd64/rpms/MariaDB-10.1.21-centos7-x86_64-client.rpm: (28, ‘Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds’) Trying other mirror. http://yum.mariadb.org/10.1/centos7-amd64/rpms/MariaDB-10.1.21-centos7-x86_64-server.rpm: [Errno 14] curl#56 - “Recv failure: Connection reset by peer” Trying other mirror.

Error downloading packages: MariaDB-server-10.1.21-1.el7.centos.x86_64: [Errno 256] No more mirrors to try.

Is there a fastest mirror for Asia? or Indonesia?

i have try many times, and always got those result

6 years, 7 months ago Daniel Bartholomew

Re: Installing MariaDB with yum

yum.mariadb.org is hosted in Canada at OVH, so there must be some sort of routing issue between your ISP and OVH.

That said, we do have some mirrors in Indonesia that have the yum repository mirrored. Change the baseurl line in your MariaDB yum repo configuration file from:

baseurl = http://yum.mariadb.org/10.1/centos7-amd64

…to one of the following:

baseurl = http://suro.ubaya.ac.id/mariadb/yum/10.1/centos7-amd64/
baseurl = http://kodeterbuka.beritagar.id/mariadb/yum/10.1/centos7-amd64/
baseurl = http://mariadb.biz.net.id/yum/10.1/centos7-amd64/

8 years, 3 months ago bigg thed

Re: Installing MariaDB with yum

I receive an error when instaling on RHEL6

yum install MariaDB-Galera-server MariaDB-client galera

Error: Package: galera-25.3.9-1.rhel6.el6.x86_64 (mariadb) Requires: nc

I have /usr/bin/nc installed. Is there a reason this is happening?

8 years, 4 months ago Marty Bens

Re: Installing MariaDB with yum

running

yum install MariaDB-Galera-server MariaDB-client galera
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

It’s not finding the server package:

No package MariaDB-Galera-server available.

8 years, 4 months ago Daniel Bartholomew

Re: Installing MariaDB with yum

I just tried running the yum command and using the MariaDB.repo file you have on a new CentOS 7 VM and it worked. You might try issuing a yum clean all to force yum to redownload the repository metadata.

8 years, 10 months ago Roberto Cazzato

Re: Installing MariaDB with yum priority

With yum priority plug-in activated (is also a good practice), we get:

–> MariaDB-Galera-server-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-client-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-compat-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-devel-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-server-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-shared-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-test-5.5.39-1.el6.x86_64 from mariadb excluded (priority) --> MariaDB-Galera-test-5.5.39-1.el6.x86_64 from mariadb excluded (priority) 8 packages excluded due to repository priority protections

A conflict was found for mysql-libs.x86_64 (5.1.73-3.el6_5), probably resolved forcing removal of this libs, replaced with mariadb version, but can you tell us how correct priority and mysql-libs issue ?

Thank you

9 years, 6 months ago Ping Pong

Re: Installing MariaDB with yum

I installed MariaDB 10 on CentOS 6.5 64 bit.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

It successfully installed. But the installation process didn’t let me configure user name, password, database instance name, and port.

What should I do that after installation? How to check that on CentOS?

Thanks in advance.

8 years, 4 months ago Daniel Bartholomew

Re: Installing MariaDB with yum

On yum-based distributions, the only MariaDB user set up is root, and there is no password. You can use the mysql_secure_installation script to set the root password.

For compatibility, the service name and port are by default the same as MySQL: mysql and 3306. Binaries are also named the same: mysqld for the server and mysql for the client.

After installation you can start MariaDB with sudo /etc/init.d/mysql start or sudo service mysql start

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论