Install MariaDB on Ubuntu 16.04 on Amazon Web Services

First Launch the EC2 Instance from the AMI Ubuntu Server 16.04 LTS (HVM), SSD Volume Type

After Launching the EC2 instance, connect to the instance using the key pair, to know the default username for each operating system in the AWS read here

ssh -i asvignesh.pem ubuntu@mysql

Update your system repo

sudo apt-get update

Install the dependencies

Before we start with the MariaDB Server installation, you will need to add the official MariaDB repository.

First, install the software-properties-common package to your server with the following command

~$ sudo apt-get install software-properties-common

If the software-properties-common package is already installed and up-to-date you will get the below message

Reading package lists… Done
Building dependency tree
Reading state information… Done
software-properties-common is already the newest version (0.96.20.10).

Import the MariaDB GnuPG signing key to your system

~$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Executing: /tmp/tmp.xJOUYjpfR5/gpg.1.sh --recv-keys
--keyserver
hkp://keyserver.ubuntu.com:80
0xF1656F24C74CD1D8
gpg: requesting key C74CD1D8 from hkp server keyserver.ubuntu.com
gpg: key C74CD1D8: public key "MariaDB Signing Key <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Add the MariaDB repository

~$ sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.3/ubuntu xenial main'
~$ sudo apt-get update

Install MariaDB Server

~$ sudo apt-get install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  galera-3 libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmariadb3 libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server-10.3 mariadb-server-core-10.3
  mysql-common socat
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl
  libwww-perl mailx mariadb-test tinyca
The following NEW packages will be installed:
  galera-3 libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libmariadb3 libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl
  mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3
  mariadb-server-core-10.3 mysql-common socat
0 upgraded, 28 newly installed, 0 to remove and 18 not upgraded.
Need to get 21.9 MB of archives.
After this operation, 185 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Enter the root password when it prompts for it.

Check the Service is running

~$ sudo service mariadb status
● mariadb.service - MariaDB 10.3.28 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Tue 2021-05-04 13:34:44 UTC; 34s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 5799 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─5799 /usr/sbin/mysqld

Verify the version Installed

~$ sudo mysql -V
mysql  Ver 15.1 Distrib 10.3.28-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Also published on Medium.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading