Can someone provide steps to install mariadb on amazon linux 2? I am pretty new in linux, so a little detail will be greatly appreciated. I have seen few links to install maria db on centOs but not sure if the same works for Amazon linux 2
Asked
Active
Viewed 1.4k times
2 Answers
7
Here you go:
- Install and Start MariaDB
sudo yum update -y
sudo yum install -y mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
- Secure DB server. Select the relevant option's during command run.
sudo mysql_secure_installation
But I recommend you to install MariaDB from official repo for latest version by following instructions in this link.

initanmol
- 340
- 1
- 4
-
This link has mentioned as below. It doesn't support Amazon linux 2. We currently have YUM repositories for the following Linux distributions. Red Hat Enterprise Linux (RHEL) 6 Red Hat Enterprise Linux (RHEL) 7 CentOS 6 CentOS 7 Fedora 27 Fedora 28 Fedora 29 – dbNovice Jul 24 '20 at 16:52
-
Does above commands not working on AL2? (ignore link) – initanmol Jul 24 '20 at 19:59
-
Sorry for the confusion. I don't have access to yum install, rather I have my own code repo which I am trying to install. So i couldn't try. Thanks for the help. – dbNovice Jul 25 '20 at 21:55
6
If you use sudo yum install mariadb
You'll get MariaDB version 5.5 which is an older version of MariaDB to get the latest version you will need to do the following.
sudo amazon-linux-extras enable lamp-mariadb10.2-php7.2=latest
sudo yum install mariadb mariadb-server
Note This will not work if you have php >= 7.3. If this is the case you must uninstall php before doing the steps above, using sudo yum erase php-common
sudo amazon-linux-extras disable lamp-mariadb10.2-php7.2=latest
Now mariadb is installed. I first tried to add centos 7 repo, but wasn't successful in getting it to install correctly.

its4net
- 61
- 3
-
I dont have access to amazon linux extras. i tried to use centos 7 repo but failing Error: MariaDB-compat conflicts with 1:mariadb-libs-5.5.64-1.amzn2.x86_64 Error: Package: galera-25.3.29-1.rhel6.el6.x86_64 (mariadb) Requires: libboost_program_options.so.5()(64bit) – dbNovice Jul 24 '20 at 18:02
-
Looks like you you may have the AL2 MariaDB 5.5 installed try `sudo yum erase mariadb. I believe all amazon linux 2 should have amazon-linux-extras. What AMI are you using? – its4net Jul 26 '20 at 02:05