Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Wednesday, 30 January 2019

Installing MariaDB 10.3 Server on CentOS 7

installing-mariadb-10.3-server-on-centos-7MariaDB is a famous fork of MySQL relational database management system. Just like it predecessor MariaDB is also free and open source under the GNU GPL license. MariaDB is community-developed and commericially supported. MariaDB is developed by some of the original developers of MySQL.

Since, it’s initial fork from MySQL, MariaDB has been enhanced with many new features. Currently, it’s stable version 10.3.12 is available to use.

In this article, we will install MariaDB 10.3 on CentOS 7 server.

 

System Specification:

We have a virtual machine with following specifications:

Hostname: mariadb-01.example.com
IP Address: 192.168.116.130/24
Operating System: CentOS 7.6
MariaDB Server: 10.3.12

 

Installing MariaDB 10.3 on CentOS 7:

Connect to mariadb-01.example.com using ssh.

MariaDB packages are available through standard yum repositories. However, we are installing MariaDB 10.3.12 (latest stable version while writing this article) therefore, we have to either download its tarball from MariaDB Downloads or we can add the MariaDB yum repository.

download-mariadb-10.3.12-stable

We are installing MariaDB yum repository as follows.

[root@mariadb-01 ~]# vi /etc/yum.repos.d/mariadb.repo

Add following directives therein.

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

Before using MariaDB yum repository, we must import the GPG public key to verify the digital signatures of the packages in this repository.

Although, it is not necessary to import the GPG public key manually. The GPG public key will be automatically installed by yum, when we install a package from MariaDB yum repository for the first time.

Here, we are importing the GPG public key manually for the sake of demonstration.

[root@mariadb-01 ~]# rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Build yum cache using following command.

[root@mariadb-01 ~]# yum makecache fast Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.ges.net.pk * extras: mirrors.ges.net.pk * updates: mirrors.ges.net.pk base | 3.6 kB 00:00 extras | 3.4 kB 00:00 mariadb | 2.9 kB 00:00 updates | 3.4 kB 00:00 mariadb/primary_db | 50 kB 00:01 Metadata Cache Created

Install MariaDB server using yum command.

[root@mariadb-01 ~]# yum install -y mariadb-server ... Installed: MariaDB-compat.x86_64 0:10.3.12-1.el7.centos MariaDB-server.x86_64 0:10.3.12-1.el7.centos Dependency Installed: MariaDB-client.x86_64 0:10.3.12-1.el7.centos MariaDB-common.x86_64 0:10.3.12-1.el7.centos boost-program-options.x86_64 0:1.53.0-27.el7 galera.x86_64 0:25.3.25-1.rhel7.el7.centos lsof.x86_64 0:4.87-6.el7 perl.x86_64 4:5.16.3-294.el7_6 perl-Carp.noarch 0:1.26-244.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 perl-Pod-Escapes.noarch 1:1.04-294.el7_6 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-4.el7 perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-294.el7_6 perl-macros.x86_64 4:5.16.3-294.el7_6 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 rsync.x86_64 0:3.1.2-4.el7 Replaced: mariadb-libs.x86_64 1:5.5.60-1.el7_5 Complete!

Start and enable MariaDB service.

[root@mariadb-01 ~]# systemctl start mariadb [root@mariadb-01 ~]# systemctl enable mariadb

Configure MariaDB database instance.

[root@mariadb-01 ~]# 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 you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set 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!

Login to MariaDB database server.

[root@mariadb-01 ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 16 Server version: 10.3.12-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)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.001 sec)

MariaDB 10.3 server has been installed on CentOS 7.

Installing MariaDB 10.3 Server on CentOS 7


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment