How to install MariaDB 10.4 on CentOS 8

It's annoying to google every time, so I'll write an article as a memorandum.

System update

If there are no critical services running on the server, update your system first.

sudo dnf -y upgrade

Added MariaDB repository to CentOS8

The command to add a repository for an x86_64 CPU machine is:

sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF 
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

By the way, in the case of RHEL8, the following command.

sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF 
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/rhel8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

install

The command is as follows.

sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream 
sudo systemctl enable --now mariadb

By the way, in the case of RHEL8, it is as follows.

sudo dnf install boost-program-options
sudo dnf install MariaDB-server MariaDB-client --disablerepo=rhel-8-for-x86_64-appstream-rpms 
sudo systemctl enable --now mariadb

Secure

It seems to be initialized with the following command.

sudo mysql_secure_installation

By the way, the message was different between the site I referred to and the environment at hand, so I will post a log.

[root@localhost vagrant]# 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] n
 ... skipping.

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!

end

The installation is now complete.

[root@localhost vagrant]# mysql --version
mysql  Ver 15.1 Distrib 10.4.17-MariaDB, for Linux (x86_64) using readline 5.1

Postscript

I tried it in a Vagrant + VirtualBox environment, but I can't mount it because of dnf upgrade. When I searched for it, it said that I should use the following command, but none of them worked. The environment is as follows. VirtualBox version 6.1.16 r140961 (Qt5.6.2) Vagrant 2.2.13 CentOS Linux release 8.2.2004 (Core)

Insert the Vagrant plugin


vagrant plugin install vagrant-vbguest
#It wasn't normal
vagrant up {vagrant global-ID found by status}
#I also saw this so I tried it
vagrant vbguest {vagrant global-ID found by status}
#It didn't work even if I restarted
vagrant reload {vagrant global-ID found by status}

Reinstall plugin


vagrant plugin expunge --reinstall
#It didn't work even if I started it with this
vagrant up {vagrant global-ID found by status}
#Try updating again on CentOS
dnf update
#I tried rebooting after this but it didn't work
vagrant reload {vagrant global-ID found by status}

Further notes

As a result of various trials, it was finally fixed when the following was implemented. It was good.

#Plugin installation
vagrant plugin install vagrant-vbguest
#Reboot for the time being (not fixed at this stage)
vagrant reload {vagrant global-ID found by status}
#ssh connection
vagrant ssh {vagrant global-ID found by status}
#Install the one around the kernel
dnf install epel-release
dnf install kernel-devel kernel-headers gcc perl make dkms
#Exit ssh and restart again
vagrant reload {vagrant global-ID found by status}

Recommended Posts

How to install MariaDB 10.4 on CentOS 8
How to install beta php8.0 on CentOS8
Install MariaDB (CentOS 8)
How to deploy Laravel on CentOS 7
How to install ImageMagick on Windows 10
Steps to install MySQL 8 on CentOS 8
How to install WildFly on Ubuntu 18.04
Install MySQL 5.6 on CentOS6 [How to specify the version]
Steps to install devtoolset-6 on CentOS 7
How to install GNOME as a desktop environment on CentOS 7
How to install production Metabase on Ubuntu
How to install kafkacat on Amazon Linux2
Install Golang on CentOS 8
Install Neo4j 4.1.3 on centOS
Install Vertica 10.0 on CentOS 6.10
Install PostgreSQL 12 on Centos8
How to install Docker
Install Python 3 on CentOS 7
How to install docker-machine
Install kuromoji on CentOS7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
How to install MySQL
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
How to install ngrok
Command to install nginx / PHP7 / php-fpm on CentOS7
How to install network drivers on standalone Ubuntu
How to install NVIDIA driver on Ubuntu 18.04 (Note)
How to install multiple JDKs on Ubuntu 18.04 LTS
[Ruby on Rails] How to install Bootstrap in Rails
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
How to install Boots Faces
Install Ruby 2.7 on CentOS 7 (SCL)
[Rails] How to install simple_calendar
[Rails] How to install reCAPTCHA
How to install JDK8-10 (Mac)
How to install Ruby on an EC2 instance on AWS
How to install the root certificate of Centos7 (Cybertrust)
How to install NVIDIA driver on Ubuntu ssh destination
Try DPDK20 SDK on CentOS7 â‘ Install
Install MariaDB on Raspberry Pi OS
How to deploy jQuery on Rails
[Rails] How to install Font Awesome
How to install JMeter for Mac
How to "hollow" View on Android
How to install ruby through rbenv
[How to install Spring Data Jpa]
Install Ruby 2.5 on CentOS 7 using SCL
How to use Ruby on Rails
How to deploy Bootstrap on Rails
Install Java Open JDK 8 on CentOS 7
How to run JavaFX on Docker
How to Install Elixir and Phoenix Framework on Ubuntu 20.04 LTS
Super rough! How to install Dagger2
How to install Bootstrap in Ruby
How to run npm install on all projects in Lerna
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7