We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install MariaDB 10.7 on Kali Linux 2022.x

Learn how to – How To Install MariaDB 10.7 on Kali Linux 2022.x.

MariaDB is an open source, enterprise-grade relational database management system initially forked from Oracle’s MySQL project. Similar to MySQL, MariaDB has gained popularity since its release as a result of its robustness, stability and community commitment to its development. MariaDB maintains high compatibility with MySQL with library binary parity and exact API and commands matching with MySQL. In this blog post we shall cover all steps required to install and use MariaDB 10.7 on Kali Linux rolling Linux distribution.

Some of the new features and improvements in MariaDB 10.7 release are:

  • New UUID Data Type – There is a new UUID data type aimed at the storage of 128-bit UUID (Universally Unique Identifier) data.
  • Natural Sort – To be used in ordering of strings in alphabetical order
  • New SFORMAT function that uses Python-like (or Rust-like, C++20 like) format
  • Updates in InnoDB – Improvements and features in the MariaDB InnoDB storage engine
  • Addition of Provider Plugins – New provider plugins (bzip2, lzma, lz4, lzo, snappy) for compression functionalities.
  • InnoDB Bulk Insert – In bulk insert, pre-sort and build indexes one page at a time
  • Password Reuse – The password_reuse_check plugin is a new password validation plugin
  • Diagnostics Property – Used to identify the affected row
  • And many more

Follow the steps in the next sections to install and run MariaDB 10.7 on Kali Linux.

Step 1 – Update your Kali Linux system

Update package lists in configured sources by running the following commands:

$ sudo apt update
[sudo] password for jkmutai:
Hit:1 http://ftp.halifax.rwth-aachen.de/kali kali-rolling InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

If updates are available apply them by performing upgrades on all of them. A reboot is required if /var/run/reboot-required file exists after update.

sudo apt dist-upgrade -y
[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2 – Add MariaDB 10.7 repository to Kali Linux

Install dependency packages to support repository management on Kali Linux and any other Debian based system.

sudo apt update
sudo apt install wget curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates

Download MariaDB script used to configure repositories on supported Linux OS.

wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup

The script usage help page can be checked with the commands below;

$ bash mariadb_repo_setup --help
...
Options:
    --help                  Display this help and exit.

    --version               Output the script version and exit.

    --mariadb-server-version=<version>
                            Override the default MariaDB Server version.
                            By default, the script will use 'mariadb-10.7'.

    --mariadb-maxscale-version=<version>
                            Override the default MariaDB MaxScale version.
                            By default, the script will use 'latest'.

    --os-type=<type>        Override detection of OS type. Acceptable values
                            include 'debian', 'ubuntu', 'rhel', & sles'.

    --os-version=<version>  Override detection of OS version. Acceptable values
                            depend on the OS type you specify.

    --arch=<architecture>   Override detection of CPU architecture. Acceptable
                            values are 'x86_64', 'aarch64', 'amd64', & 'arm64'.

    --skip-key-import       Skip importing GPG signing keys.

    --skip-maxscale         Skip the 'MaxScale' repository.

    --skip-server           Skip the 'MariaDB Server' repository.

    --skip-tools            Skip the 'Tools' repository.

    --skip-check-installed  Skip tests for required prerequisites for this script.

    --write-to-stdout       Write output to stdout instead of to the OS's
                            repository configuration. This will also skip
                            importing GPG keys and updating the package
                            cache on platforms where that behavior exists.

Kali Linux is not in the list of Linux distributions supported by the script. We have to provide OS type and Version in command options. Debian 11 (Bullseye) repository will be configured in our Kali Linux system.

$ sudo bash mariadb_repo_setup --os-type=debian --os-version=bullseye --mariadb-server-version=10.7
# [info] Skipping OS detection and using OS type 'debian' and version 'bullseye' as given on the command line
# [info] Checking for script prerequisites.
# [info] MariaDB Server version 10.7 is valid
# [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
# [info] Adding trusted package signing keys...
# [info] Running apt-get update...
# [info] Done adding trusted package signing keys

A new file is written by the script. This is the repo for MariaDB configured on Kali Linux.

cat /etc/apt/sources.list.d/mariadb.list

Confirm the repository is functional before you proceed to install MariaDB 10.7 on Kali Linux.

$ sudo apt update
Hit:1 https://downloads.mariadb.com/Tools/debian bullseye InRelease
Hit:2 http://ftp.halifax.rwth-aachen.de/kali kali-rolling InRelease
Get:3 https://dlm.mariadb.com/repo/mariadb-server/10.7/repo/debian bullseye InRelease [4634 B]
Get:4 https://dlm.mariadb.com/repo/maxscale/latest/apt bullseye InRelease [6387 B]
Fetched 11.0 kB in 1s (12.2 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3 – Install MariaDB 10.7 to Kali Linux

Check available versions of MariaDB listed on configured repositories. You should spot 10.7 release.

$ apt-cache policy mariadb-server
mariadb-server:
  Installed: (none)
  Candidate: 1:10.7.3+maria~bullseye
  Version table:
     1:10.7.3+maria~bullseye 1000
       1000 https://dlm.mariadb.com/repo/mariadb-server/10.7/repo/debian bullseye/main amd64 Packages
       1000 https://dlm.mariadb.com/repo/mariadb-server/10.7/repo/debian bullseye/main arm64 Packages
     1:10.7.1+maria~bullseye 1000
       1000 https://dlm.mariadb.com/repo/mariadb-server/10.7/repo/debian bullseye/main amd64 Packages
       1000 https://dlm.mariadb.com/repo/mariadb-server/10.7/repo/debian bullseye/main arm64 Packages
     1:10.6.5-2 500
        500 http://http.kali.org/kali kali-rolling/main amd64 Packages

Let’s now install MariaDB 10.7 Server and Client packages on Kali Linux

sudo apt install mariadb-server mariadb-client

Fixing error “mariadb-server-core-10.7 : Depends: liburing1 (>= 0.7)

If you encounter an error similar to below;

The following packages have unmet dependencies:
 mariadb-server-core-10.7 : Depends: liburing1 (>= 0.7) but it is not installable
E: Unable to correct problems, you have held broken packages.

Manually download and install liburing1 package with version >=0.7

wget http://ftp.us.debian.org/debian/pool/main/libu/liburing/liburing1_0.7-3~bpo10+1_amd64.deb

Install the package after being downloaded locally on Kali Linux system.

$ sudo dpkg -i liburing1_0.7-3~bpo10+1_amd64.deb
Selecting previously unselected package liburing1:amd64.
(Reading database ... 290741 files and directories currently installed.)
Preparing to unpack liburing1_0.7-3~bpo10+1_amd64.deb ...
Unpacking liburing1:amd64 (0.7-3~bpo10+1) ...
Setting up liburing1:amd64 (0.7-3~bpo10+1) ...
Processing triggers for libc-bin (2.33-1) ...

Retry MariaDB installation on Kali Linux.

$ sudo apt install mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-roboto-slab libmms0 libofa0
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mariadb-client-10.7 mariadb-client-core-10.7 mariadb-common mariadb-server-10.7 mariadb-server-core-10.7
Suggested packages:
  mailx mariadb-test netcat-openbsd
The following packages will be REMOVED:
  default-mysql-server mariadb-client-10.6 mariadb-client-core-10.6 mariadb-server-10.6 mariadb-server-core-10.6
The following NEW packages will be installed:
  mariadb-client mariadb-client-10.7 mariadb-client-core-10.7 mariadb-server mariadb-server-10.7 mariadb-server-core-10.7
The following packages will be upgraded:
  mariadb-common
1 upgraded, 6 newly installed, 5 to remove and 3 not upgraded.
Need to get 13.8 MB of archives.
After this operation, 4836 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

This time round it should be successful. Installed version can be validated using --version command option.

$ mariadb --version
mariadb  Ver 15.1 Distrib 10.7.3-MariaDB, for debian-linux-gnu (x86_64) using readline EditLine wrapper

Step 4 – Start MariaDB Service on Kali Linux

Start and enable mariadb service once the package has been installed.

sudo systemctl enable mariadb
sudo systemctl start mariadb

Status should show as running

$ systemctl status mariadb
 mariadb.service - MariaDB 10.7.3 database server
     Loaded: loaded (/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 Wed 2022-02-16 09:05:04 EST; 12s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 6838 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 6839 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 6841 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_P>
    Process: 6883 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 6885 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 6870 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 14 (limit: 4613)
     Memory: 86.6M
        CPU: 559ms
     CGroup: /system.slice/mariadb.service
             └─6870 /usr/sbin/mariadbd

Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: Phase 6/7: Checking and upgrading tables
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: Processing databases
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: information_schema
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: performance_schema
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: sys
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: sys.sys_config                                     OK
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: Phase 7/7: Running 'FLUSH PRIVILEGES'
Feb 16 09:05:05 kali /etc/mysql/debian-start[6891]: OK
Feb 16 09:05:05 kali /etc/mysql/debian-start[6923]: Checking for insecure root accounts.
Feb 16 09:05:05 kali /etc/mysql/debian-start[6927]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

Secure database installation by running mariadb-secure-installation script as sudo user.

$ sudo mariadb-secure-installation
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] y
New password: Enter Password
Re-enter new password: Re-Enter Password

Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Test authentication if it works. Without providing the password you should get access denied error message.

$ mysql -u root
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Try with -p option and provide the password set for root user during hardening process.

$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 52
Server version: 10.7.3-MariaDB-1:10.7.3+maria~bullseye mariadb.org binary distribution

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)]> exit
Bye

How to purge MariaDB server on Kali Linux

If at any point you want to clean database server installation, start by removing server package of MariaDB.

$ sudo apt purge mariadb-server

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-roboto-slab libmms0 libofa0
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  mariadb-server*
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 10.2 kB disk space will be freed.
Do you want to continue? [Y/n] y

To remove all database data, delete /var/lib/mysql/ directory.

sudo rm -rf /var/lib/mysql/

Finally remove mariadb-client package and all other dependencies installed earlier but nolonger needed.

$ sudo apt autoremove mariadb-server mariadb-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'mariadb-server' is not installed, so not removed
The following packages will be REMOVED:
  fonts-roboto-slab libmms0 libofa0 mariadb-client
0 upgraded, 0 newly installed, 4 to remove and 3 not upgraded.
After this operation, 650 kB disk space will be freed.
Do you want to continue? [Y/n] y

Conclusion

In this article we’ve shared with you the process of installing MariaDB 10.7 on Kali Linux. After the installation, we covered service management, securing database server and how cleanup is performed. MariaDB is intended to remain free and open-source software under the GNU General Public License. Feel free to support the project through code contribution, bug reports, adopting MariaDB as your database of choice, or by spreading the word on MariaDB.

More guides on Kali Linux;

Cart

Your Cart is Empty

Back To Shop