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 on Kali Linux rolling Linux distribution.
Some of the new features and improvements in MariaDB 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
Installing MariaDB 11 or MariaDB 10 on Kali Linux
Follow the steps in the next sections to install and run MariaDB on Kali Linux.
For installation on OS default repositories run:
sudo apt update
sudo apt install mariadb-server mariadb-client
For installation from official MariaDB APT repositories follow the steps below.
Step 1 – Update your Kali 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 repository
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.x'.
--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.
- See releases page for specific version numbers: https://mariadb.org/mariadb/all-releases/
# Latest
sudo bash mariadb_repo_setup --os-type=debian --os-version=bookworm
# Version 11
sudo bash mariadb_repo_setup --os-type=debian --os-version=bookworm --mariadb-server-version=11.x.y
# Version 10
sudo bash mariadb_repo_setup --os-type=debian --os-version=bookworm --mariadb-server-version=10.x.y
Example.
$ sudo bash mariadb_repo_setup --os-type=debian --os-version=bookworm --mariadb-server-version=11.2.2
# [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 11.2.2 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 on Kali Linux.
$ sudo apt update
Hit:1 https://downloads.mariadb.com/Tools/debian bullseye InRelease
Get:3 https://dlm.mariadb.com/repo/mariadb-server/10.11.5/repo/debian bullseye InRelease [4,634 B]
Hit:2 http://ftp.halifax.rwth-aachen.de/kali kali-rolling InRelease
Get:4 https://dlm.mariadb.com/repo/maxscale/latest/apt bullseye InRelease [9,347 B]
Fetched 14.0 kB in 1s (14.3 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Step 3 – Install MariaDB to Kali Linux
Check available versions of MariaDB listed on configured repositories. You should spot 10.11 release.
$ apt-cache policy mariadb-server
mariadb-server:
Installed: 1:10.11.4-1
Candidate: 1:10.11.5+maria~deb12
Version table:
1:10.11.5+maria~deb12 1000
1000 https://dlm.mariadb.com/repo/mariadb-server/10.11.5/repo/debian bookworm/main amd64 Packages
*** 1:10.11.4-1 500
500 http://http.kali.org/kali kali-rolling/main amd64 Packages
100 /var/lib/dpkg/status
Let’s now install MariaDB 10 Server and Client packages on Kali Linux
sudo apt install mariadb-server mariadb-client
This time round it should be successful. Installed version can be validated using --version
command option.
$ mariadb --version
mariadb Ver 15.1 Distrib 10.11.5-MariaDB, for debian-linux-gnu (x86_64) using 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
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
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 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;
- Install Snapd and Use snap on Kali Linux
- How To Install AnyDesk on Kali Linux
- How To Install Visual Studio Code on Kali Linux
- Install Nessus vulnerability Scanner on Kali Linux
thankyou so much
Welcome!
hey im getting an error that i need to install libssl1.1 and i have checked everywhere for a download nothing works .im trying to run erpnext and im using kali linux 2023 which has the lates mariadb but erpnext need 10.8 what do i do ..i have literally tried everything
Hi. Did you try replacing 10.7 with 10.8 in repository configuration?