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.

Tuesday, 4 December 2018

Install MariaDB Database Server on RHEL 7

Install MariaDB Database Server on RHEL 7MariaDB is famous fork of MySQL Relational Database Management System (RDBMS). MariaDB is developed and maintained by original developers of MySQL database. In Red Hat Enterprise Linux (RHEL) 7, the MySQL has been replaced by MariaDB. However, this replacement is extremely transparent to users and administrators due to the similarities between MySQL and MariaDB.

In this article, we will install and configure the available version of MariaDB from local yum repository.

Read Also: Configure Local Yum Repository using ISO in RHEL 7

 

Install MariaDB Database Server:

Use following command to install mariadb-server and relevant packages.

[root@server1 ~]# yum groupinstall -y mariadb Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Resolving Dependencies --> Running transaction check ---> Package mariadb-server.x86_64 1:5.5.35-3.el7 will be installed --> Processing Dependency: mariadb(x86-64) = 1:5.5.35-3.el7 for package: 1:mariadb-server-5.5.35-3.el7.x86_64 --> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.35-3.el7.x86_64 --> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.35-3.el7.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.35-3.el7.x86_64 --> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.35-3.el7.x86_64 --> Running transaction check ---> Package mariadb.x86_64 1:5.5.35-3.el7 will be installed ---> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed ---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64 --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64 ---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed --> Running transaction check ---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed --> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch --> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch --> Running transaction check ---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed --> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch --> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch ---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed --> Running transaction check ---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed ---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================== Package Arch Version Repository Size ========================================================================== Installing for group install "MariaDB Database Server": mariadb-server x86_64 1:5.5.35-3.el7 localyum 11 M Installing for dependencies: mariadb x86_64 1:5.5.35-3.el7 localyum 8.9 M perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 localyum 32 k perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 localyum 57 k perl-DBD-MySQL x86_64 4.023-5.el7 localyum 140 k perl-DBI x86_64 1.627-4.el7 localyum 802 k perl-Data-Dumper x86_64 2.145-3.el7 localyum 47 k perl-IO-Compress noarch 2.061-2.el7 localyum 260 k perl-Net-Daemon noarch 0.48-5.el7 localyum 51 k perl-PlRPC noarch 0.2020-14.el7 localyum 36 k Transaction Summary ========================================================================== Install 1 Package (+9 Dependent packages) Total download size: 21 M Installed size: 107 M Downloading packages: -------------------------------------------------------------------------- Total 29 MB/s | 21 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : perl-Data-Dumper-2.145-3.el7.x86_64 1/10 Installing : 1:mariadb-5.5.35-3.el7.x86_64 2/10 Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 3/10 Installing : perl-Net-Daemon-0.48-5.el7.noarch 4/10 Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 5/10 Installing : perl-IO-Compress-2.061-2.el7.noarch 6/10 Installing : perl-PlRPC-0.2020-14.el7.noarch 7/10 Installing : perl-DBI-1.627-4.el7.x86_64 8/10 Installing : perl-DBD-MySQL-4.023-5.el7.x86_64 9/10 Installing : 1:mariadb-server-5.5.35-3.el7.x86_64 10/10 Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 1/10 Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/10 Verifying : perl-Data-Dumper-2.145-3.el7.x86_64 3/10 Verifying : perl-PlRPC-0.2020-14.el7.noarch 4/10 Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 5/10 Verifying : 1:mariadb-server-5.5.35-3.el7.x86_64 6/10 Verifying : perl-DBI-1.627-4.el7.x86_64 7/10 Verifying : 1:mariadb-5.5.35-3.el7.x86_64 8/10 Verifying : perl-DBD-MySQL-4.023-5.el7.x86_64 9/10 Verifying : perl-IO-Compress-2.061-2.el7.noarch 10/10 Installed: mariadb-server.x86_64 1:5.5.35-3.el7 Dependency Installed: mariadb.x86_64 1:5.5.35-3.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-5.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7 Complete! [root@server1 ~]#

Install mariadb-client and relevant packages.

[root@server1 ~]# yum groupinstall -y mariadb-client Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Resolving Dependencies --> Running transaction check ---> Package MySQL-python.x86_64 0:1.2.3-11.el7 will be installed ---> Package mysql-connector-odbc.x86_64 0:5.2.5-6.el7 will be installed --> Processing Dependency: libodbc.so.2()(64bit) for package: mysql-connector-odbc-5.2.5-6.el7.x86_64 --> Processing Dependency: libodbcinst.so.2()(64bit) for package: mysql-connector-odbc-5.2.5-6.el7.x86_64 --> Running transaction check ---> Package unixODBC.x86_64 0:2.3.1-10.el7 will be installed --> Processing Dependency: libltdl.so.7()(64bit) for package: unixODBC-2.3.1-10.el7.x86_64 --> Running transaction check ---> Package libtool-ltdl.x86_64 0:2.4.2-20.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================== Package Arch Version Repository Size ========================================================================== Installing for group install "MariaDB Database Client": MySQL-python x86_64 1.2.3-11.el7 localyum 82 k mysql-connector-odbc x86_64 5.2.5-6.el7 localyum 146 k Installing for dependencies: libtool-ltdl x86_64 2.4.2-20.el7 localyum 49 k unixODBC x86_64 2.3.1-10.el7 localyum 413 k Transaction Summary ========================================================================== Install 2 Packages (+2 Dependent packages) Total download size: 689 k Installed size: 1.9 M Downloading packages: -------------------------------------------------------------------------- Total 4.5 MB/s | 689 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libtool-ltdl-2.4.2-20.el7.x86_64 1/4 Installing : unixODBC-2.3.1-10.el7.x86_64 2/4 Installing : mysql-connector-odbc-5.2.5-6.el7.x86_64 3/4 Installing : MySQL-python-1.2.3-11.el7.x86_64 4/4 Verifying : libtool-ltdl-2.4.2-20.el7.x86_64 1/4 Verifying : mysql-connector-odbc-5.2.5-6.el7.x86_64 2/4 Verifying : MySQL-python-1.2.3-11.el7.x86_64 3/4 Verifying : unixODBC-2.3.1-10.el7.x86_64 4/4 Installed: MySQL-python.x86_64 0:1.2.3-11.el7 mysql-connector-odbc.x86_64 0:5.2.5-6.el7 Dependency Installed: libtool-ltdl.x86_64 0:2.4.2-20.el7 unixODBC.x86_64 0:2.3.1-10.el7 Complete! [root@server1 ~]#

Start and enable mariadb service.

[root@server1 ~]# systemctl enable mariadb ; systemctl start mariadb ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'

Now configure mariadb server.

[root@server1 ~]# mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found 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! [root@server1 ~]#

Connect to the MariaDB server using new password.

[root@server1 ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server version: 5.5.35-MariaDB MariaDB Server Copyright (c) 2000, 2013, Oracle, Monty Program 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.00 sec) MariaDB [(none)]>

MariaDB Server has been installed and configured successfully.

MariaDB configurations are defined in /etc/my.cnf. We can further customize MariaDB from there.

Install MariaDB Database Server on RHEL 7


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment