0% found this document useful (0 votes)
88 views15 pages

Installing MariaDB On RHEL 8

MariaDB Enterprise Server is a commercial version of MariaDB Community Server that provides enhanced features and support. It is compatible with RHEL 8 and supports installation via repositories. The document also provides steps to install and configure MariaDB on RHEL 8.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views15 pages

Installing MariaDB On RHEL 8

MariaDB Enterprise Server is a commercial version of MariaDB Community Server that provides enhanced features and support. It is compatible with RHEL 8 and supports installation via repositories. The document also provides steps to install and configure MariaDB on RHEL 8.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

MariaDB Enterprise Server

MariaDB Corporation provides commercial support for MariaDB Platform , which


includes MariaDB Enterprise Server. MariaDB Enterprise Server is supported on
a range of operating systems, including RHEL 8 and CentOS 8.

MariaDB Enterprise Server is based on MariaDB Community Server, but ships


with enhanced features including:

 Predictable releases through an Enterprise Lifecycle


 Enhanced configuration defaults
 MariaDB Enterprise Audit, with expanded functionality over the MariaDB
Audit Plugin
 MariaDB Enterprise Backup, with non-blocking backups
 MariaDB Enterprise Cluster, with expanded encryption over MariaDB
Cluster (Galera)

Installing MariaDB on RHEL 8


MariaDB is the latest open source and popular relational database management
system, compatible and replacement of MySQL.
MariaDB developed with MySQL original developers and many people from the
community.

The Red Hat Enterprise Linux (RHEL) 8 Operating System release was replaced
MySQL with MariaDB as the default database system.

If your required application does not have any specific database requirements, you

should go with MariaDB, default database of RHEL 8 Operating System.

Prerequisites
Before starting the process of installing MariaDB, make sure you have a RHEL 8

running system and a user to login into the system with sudo privileges.
Install MariaDB on RHEL 8
The default RHEL 8 repository providing MariaDB version 5.5, it is not the latest

version of MariaDB, but it is a stable release.

To install MariaDB into RHEL 8, you need to follow the below process:

Step 1 – Install MariaDB

To install MariaDB 5.5 version into RHEL 8 by using the following Command:

You can install MariaDB Server from the command-line:

$ sudo yum install mariadb-server


Installing MariaDB in RHEL 8

Once the installation is complete, you can start the MariaDB service with:

Step 2 – Start MariaDB Service

After installation of MariaDB, the service automatically


started, but you can use below command for manually start
the MariaDB service:

sudo systemctl start mariadb


Step 3 – Enable MariaDB Service

You should enable the MariaDB service to make MariaDB


service auto start on system startup, by using the following
command:

sudo systemctl enable mariadb

Step 4 – Verify MariaDB

To verify the MariaDB service, you can check the status of


the service by using the following command:

sudo systemctl status mariadb

Start MariaDB Service in RHEL 8

Step 5 – MariaDB Secure Installation

Now that we have our service started, it is time to improve its security. We will
setup root password, disable remote root login, remove test database and
anonymous user. Finally we will reload all privileges.
For that purpose, simply run the following command and answer the questions
accordingly:

sudo mysql_secure_installation

Note that the root user’s password is empty, so if you want to change it,
simply press “enter”, when prompted for the current password. The rest you
can follow the steps and answers on the image below:

Secure MariaDB Server in RHEL 8


Access the MariaDB Server
Let’s go a little deeper and create a database, user and give privileges to that
user over the database. To access the server with console, you can use the
following command:

# mysql -u root -p

When prompted, enter the root password that you set earlier.

Now let’s create our database. For that purpose at the MariaDB prompt, run
the following command:
MariaDB [(none)]> CREATE DATABASE tecmint;

This will create new database named tecmint. Instead of accessing that
database with our root user, we will create separate database user, that will
have privileges to that database only.

We will create our new user called tecmint_user and grant it privileges on
the tecmint database, with the following command:

MariaDB [(none)]> GRANT ALL ON tecmint.* TO


tecmint_user@localhost IDENTIFIED BY 'securePassowrd';

When creating your own user, make sure to replace “securePassword” with
the password you wish to give to that user.

When you have finished with the above commands, type “quit” at the prompt
to exit MariaDB:

MariaDB [(none)]> quit;

Create Database in MariaDB

Now you can use the new user to access the tecmint database.

# mysql -u tecmint_user -p
When prompted enter the password for that user. To change the used
database, you can use the following at the MariaDB prompt:

MariaDB [(none)]> use tecmint;

This will change the current database to tecmint.

Access MariaDB Database

Alternatively, you can issue the mysql command by specifying the database
name as well as shown.

# mysql -u tecmint_user -p tecmint

That way when you enter the user’s password, you will directly be using
the tecmint database.

Install Latest MariaDB on RHEL 8


The latest MariaDB server version 10.3 is not coming with
default repository of RHEL 8. If you want to install the latest
version of MariaDB into RHEL 8 system, create MariaDB
repository file to install the latest MariaDB directly from
official repository of MariaDB packages.
Let’s start the installation process of MariaDB 10.3 into
RHEL 8 by the following procedure:

Step 1 – Enable MariaDB Repository

To enable MariaDB repository into a CentOS system, you


need to create a repository file into /etc/yum.repos.d/
directory, as you can see below, we have created MariaDB
repository file with the name of MariaDB.repo, you should
also create the same file into your system.

Step 2 – Install MariaDB Server and Client

After creating the repository file, you should update your


system’s repository package list by using the following
command:

sudo yum update


Once the CentOS package is updated, you can use the
following command to install mariaDB Server and Client:
sudo yum install MariaDB-server MariaDB-client

You may get below the screen to import MariaDB GPG key
into the system:

You should type Y (yes) to allow to download the key file.


Step 3 – Enable and start the MariaDB Service

Once the installation of MariaDB completed, you should


enable and start the service, as shown below:

sudo systemctl enable mariadb


sudo systemctl start mariadb
Step 4 – Verify MariaDB installation

You can verify the MariaDB installation by checking the


status of service using the following command:

sudo systemctl status mariadb

Step 5 – MariaDB Secure Installation

After installation and running service need to make your


MariaDB secure, and to perform the security operation need
to execute mysql_secure_instalaltion script, as shown
below:

sudo mysql_secure_installation

This script will use to set the password for root, restrict root
user to localhost, remove anonymous users, and remove test
database, etc.

All step will appear on the screen with detailed, and you
need to press Y as your answer to accept the security
changes.
MariaDB connection from CLI
To connect MariaDB server using terminal or CLI with root
user credential type the below command:

mysql –u root –p

Now it will ask you to enter a password for the root user and
press enter.

Once you logged in into MariaDB shell and you will get a
screen like below:
Installing MariaDB Server
The RHEL 8 and CentOS 8 distributions include MariaDB
Community Server 10.3.

You can install MariaDB Server from the command-line:

$ sudo yum install mariadb-server

Benefits of MariaDB Server 10.4

While CentOS 7 and RHEL 7 include MariaDB Server 5.5,


substantial improvements have been made as MariaDB
Community Server changed through the 10.0, 10.1, 10.2, 10.3,
and 10.4 release series. The MariaDB Server 10.4 release series
includes:

 Instant ALTER for InnoDB tables


 Optimizer trace to aid in performance diagnosis
 Window functions and Common Table Expressions (CTE)
 Temporal tables, including system-versioned, application time-
period, and bitemporal (both)
 Ability to reload SSL certificates without server restart
 Galera 4 technology, a major enhancement over Galera 3
 Additional storage engines, including MyRocks
 SQL_MODE=ORACLE for compatibility with a subset of Oracle
PL/SQL
 Expanded data-at-rest encryption
 Authentication enhancements, including multiple authentication
methods per user
Installing MariaDB Server 10.4

To deploy MariaDB Community Server 10.4 on RHEL 8 or CentOS


8, first download and use the mariadb_repo_setup script to
configure the MariaDB repositories for YUM:

$ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
$ chmod +x mariadb_repo_setup
$ sudo ./mariadb_repo_setup
To avoid conflict with the OS-vendor packages, install
dependencies separately and use the --repo flag to specify the
repository:

$ sudo yum install perl-DBI libaio libsepol lsof boost-program-options


$ sudo yum install --repo="mariadb-main" MariaDB-server

Configuring and Securing MariaDB Server

MariaDB Server 10.3 and 10.4 write all data files and
tablespaces to a directory on the file system called the data
directory. After installing the packages, run
the mysql_install_db utility to provision this directory.

$ sudo mysql_install_db
Start the systemd service for MariaDB Server using systemctl:

$ sudo systemctl start mariadb.service


Specific security practices should always follow any business-
specific requirements and governance. Some basic steps should
be taken to help harden the MariaDB Community Server
deployment:

$ sudo mysql_secure_installation

You might also like