如何在Fedora 31/30/29上安装MariaDB 10.4

本指南描述了在Fedora 31/30/29上安装MariaDB 10.4所需的步骤。 MariaDB是社区开发的,广泛使用的关系数据库服务器,与MySQL关系数据库管理系统不同。

MariaDB是根据通用公共许可证版本2发布的开源免费软件。在撰写本文时,最新的稳定版本是版本 10.4。 MariaDB软件包以二进制文件的形式发布在mariadb.org上。但是,如果您选择,还可以选择从源代码构建。

让我们开始在Fedora 31/30/29上安装MariaDB 10.4。

步骤1:更新您的Fedora机器

确保您的系统正在运行最新版本的Fedora软件包。

sudo dnf -y update

升级后重新启动服务器。

sudo systemctl reboot

步骤2:添加MariaDB RPM存储库

接下来,将MariaDB RPM存储库添加到您的系统。

Fedora 31/30:

sudo tee /etc/yum.repos.d/mariad.repo<

Fedora 29:

sudo tee /etc/yum.repos.d/mariad.repo<

步骤3:在Fedora 31/30/29上安装MariaDB 10.4

接下来,在Fedora 31/30/29 Linux系统上安装MariaDB 10.4。

sudo dnf -y install MariaDB-server

以下是依赖关系树和已安装软件包的列表。

Dependencies resolved.
===================================================================================================================================================
 Package                                    Architecture               Version                                   Repository                   Size
===================================================================================================================================================
Installing:
 MariaDB-server                             x86_64                     10.4.8-1.fc30                             mariadb                      25 M
Installing dependencies:
 boost-program-options                      x86_64                     1.69.0-9.fc31                             fedora                      161 k
 libaio                                     x86_64                     0.3.111-6.fc31                            fedora                       24 k
 lsof                                       x86_64                     4.93.2-2.fc31                             fedora                      240 k
 perl-Carp                                  noarch                     1.50-439.fc31                             fedora                       29 k
 perl-DBI                                   x86_64                     1.642-5.fc31                              fedora                      701 k
 perl-Data-Dumper                           x86_64                     2.174-440.fc31                            fedora                       57 k
 perl-Digest                                noarch                     1.17-439.fc31                             fedora                       24 k
 perl-Digest-MD5                            x86_64                     2.55-439.fc31                             fedora                       36 k
 perl-Encode                                x86_64                     4:3.01-439.fc31                           fedora                      1.8 M
 perl-Errno                                 x86_64                     1.30-446.fc31                             fedora                       25 k
 perl-Exporter                              noarch                     5.73-440.fc31                             fedora                       32 k
 perl-File-Path                             noarch                     2.16-439.fc31                             fedora                       36 k
 perl-File-Temp                             noarch                     1:0.230.900-439.fc31                      fedora                       60 k
 perl-Getopt-Long                           noarch                     1:2.51-1.fc31                             fedora                       60 k
 perl-HTTP-Tiny                             noarch                     0.076-439.fc31                            fedora                       55 k
 perl-IO                                    x86_64                     1.40-446.fc31                             fedora                       92 k
 perl-MIME-Base64                           x86_64                     3.15-439.fc31                             fedora                       30 k
 perl-Math-BigInt                           noarch                     1:1.9998.16-439.fc31                      fedora                      185 k
 perl-Math-Complex                          noarch                     1.59-446.fc31                             fedora                       57 k
 perl-Net-SSLeay                            x86_64                     1.88-3.fc31                               fedora                      355 k
 perl-PathTools                             x86_64                     3.78-439.fc31                             fedora                       86 k
 perl-Pod-Escapes                           noarch                     1:1.07-439.fc31                           fedora                       20 k
 perl-Pod-Perldoc                           noarch                     3.28.01-442.fc31                          fedora                       85 k
 perl-Pod-Simple                            noarch                     1:3.39-2.fc31                             fedora                      214 k
 perl-Pod-Usage                             noarch                     4:1.69-439.fc31                           fedora                       32 k
 perl-Scalar-List-Utils                     x86_64                     3:1.52-439.fc31                           fedora                       66 k
 perl-Socket                                x86_64                     4:2.029-4.fc31                            fedora                       56 k
 perl-Storable                              x86_64                     1:3.15-441.fc31                           fedora                       97 k
 perl-Term-ANSIColor                        noarch                     4.06-440.fc31                             fedora                       44 k
 perl-Term-Cap                              noarch                     1.17-439.fc31                             fedora                       22 k
 perl-Text-ParseWords                       noarch                     3.30-439.fc31                             fedora                       16 k
 perl-Text-Tabs+Wrap                        noarch                     2013.0523-439.fc31                        fedora                       23 k
 perl-Time-Local                            noarch                     2:1.280-439.fc31                          fedora                       32 k
 perl-URI                                   noarch                     1.76-5.fc31                               fedora                      108 k
 perl-Unicode-Normalize                     x86_64                     1.26-439.fc31                             fedora                       97 k
 perl-constant                              noarch                     1.33-440.fc31                             fedora                       23 k
 perl-interpreter                           x86_64                     4:5.30.0-446.fc31                         fedora                      6.1 M
 perl-libnet                                noarch                     3.11-440.fc31                             fedora                      117 k
 perl-libs                                  x86_64                     4:5.30.0-446.fc31                         fedora                      1.7 M
 perl-macros                                x86_64                     4:5.30.0-446.fc31                         fedora                       21 k
 perl-parent                                noarch                     1:0.237-439.fc31                          fedora                       14 k
 perl-podlators                             noarch                     1:4.12-2.fc31                             fedora                      113 k
 perl-threads                               x86_64                     1:2.22-439.fc31                           fedora                       58 k
 perl-threads-shared                        x86_64                     1.60-440.fc31                             fedora                       44 k
 MariaDB-client                             x86_64                     10.4.8-1.fc30                             mariadb                      11 M
 MariaDB-common                             x86_64                     10.4.8-1.fc30                             mariadb                      81 k
 galera-4                                   x86_64                     26.4.2-1.fc30.fc30                        mariadb                      14 M
Installing weak dependencies:
 perl-IO-Socket-IP                          noarch                     0.39-440.fc31                             fedora                       42 k
 perl-IO-Socket-SSL                         noarch                     2.066-6.fc31                              fedora                      239 k
 perl-Mozilla-CA                            noarch                     20180117-6.fc31                           fedora                       12 k

Transaction Summary
===================================================================================================================================================
Install  51 Packages

Total download size: 64 M
Installed size: 237 M
Downloading Packages:

步骤4:在Fedora 31/30/29上配置MariaDB服务

在Fedora 31/30/29上安装MariaDB 10.4之后,启动服务并将其配置为在系统引导时启动。

sudo systemctl enable --now mariadb

检查服务状态。

$ systemctl status mariadb
● mariadb.service - MariaDB 10.4.8 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Sun 2019-11-03 07:13:45 UTC; 8s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 3671 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 3672 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl>
  Process: 3712 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 3681 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 2345)
   Memory: 63.2M
      CPU: 189ms
   CGroup: /system.slice/mariadb.service
           └─3681 /usr/sbin/mysqld

Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] InnoDB: 10.4.8 started; log sequence number 139827; transac>
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] Plugin 'FEEDBACK' is disabled.
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffe>
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] Server socket created on IP: '::'.
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] InnoDB: Buffer pool(s) load completed at 191103  7:13:45
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] Reading of all Master_info entries succeeded
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] Added new Master_info '' to hash table
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: 2019-11-03  7:13:45 0 [Note] /usr/sbin/mysqld: ready for connections.
Nov 03 07:13:45 fed31.computingforgeeks.com mysqld[3681]: Version: '10.4.8-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Serv>
Nov 03 07:13:45 fed31.computingforgeeks.com systemd[1]: Started MariaDB 10.4.8 database server.

增强MariaDB服务器安装。

$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

使用root用户和密码集访问MariaDB shell。

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 19
Server version: 10.4.8-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)]> SELECT VERSION();
+----------------+
| VERSION()      |
+----------------+
| 10.4.8-MariaDB |
+----------------+
1 row in set (0.000 sec)

这确认MariaDB 10.4已成功安装在Fedora 31/30/29 Linux系统上。请查看Fedora的相关数据库指南。

在Fedora上安装PostgreSQL 12

在Fedora上安装MySQL 8

在Fego上安装MongoDB

Sidebar