Install Maria DB in Ubuntu EC2 instance

Recently I have posted on installing MySQL in Amazon Linux, Now I am trying to Integrate and test Maria Backup and Recovery integration.

In our product we support the Backup and recovery of MySQL instance in EC2, you can read more about the approach we took for backing up the MySQL here

First I launched a new Instance from the Ubuntu 18.04 AMI and enabled the SSH through my office network

MariaDB is an open-source, multi-threaded relational database management system, a backward-compatible replacement for MySQL. It is maintained and developed by the MariaDB Foundation including some of the original developers of MySQL.

SSH into the launched EC2 instance using ubuntu user.

First thing, check for any updated and update the system

Update the System

ubuntu@ip-172-31-38-177:~$ sudo apt update
Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 18.4 MB in 4s (4619 kB/s)                           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
53 packages can be upgraded. Run 'apt list --upgradable' to see them.

ubuntu@ip-172-31-38-177:~$ sudo apt upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-aws-headers-4.15.0-1060 linux-headers-4.15.0-1060-aws linux-image-4.15.0-1060-aws linux-modules-4.15.0-1060-aws
The following packages will be upgraded:
  apport base-files bsdutils cloud-init dmidecode e2fsprogs fdisk landscape-common libblkid1 libbsd0 libcom-err2 libdrm-common libdrm2 libext2fs2 libfdisk1 libgcrypt20 libgnutls30 libmount1 libnss-systemd libpam-systemd libsasl2-2 libsasl2-modules libsasl2-modules-db
  libsmartcols1 libss2 libsystemd0 libudev1 libuuid1 libxml2 linux-aws linux-headers-aws linux-image-aws mdadm mount python-apt-common python3-apport python3-apt python3-distupgrade python3-problem-report rsync sosreport sudo systemd systemd-sysv tcpdump ubuntu-minimal
  ubuntu-release-upgrader-core ubuntu-server ubuntu-standard udev unattended-upgrades util-linux uuid-runtime
53 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 43.9 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Install MariaDB

ubuntu@ip-172-31-38-177:~$ sudo apt 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 libconfig-inifiles-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 libjemalloc1
  liblwp-mediatypes-perl libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 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 libconfig-inifiles-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 libjemalloc1
  liblwp-mediatypes-perl libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1 mariadb-server-core-10.1 mysql-common socat
0 upgraded, 29 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.1 MB of archives.
After this operation, 184 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Check the status of installed Service

ubuntu@ip-172-31-38-177:~$ sudo systemctl status mariadb
● mariadb.service - MariaDB 10.1.44 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-03-06 06:42:13 UTC; 27s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
 Main PID: 17157 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 1152)
   CGroup: /system.slice/mariadb.service
           └─17157 /usr/sbin/mysqld

Check the version installed

ubuntu@ip-172-31-38-177:~$ mysql -V
mysql  Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Secure the Installation

ubuntu@ip-172-31-38-177:~$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Disclaimer: The scripts/code in this post are given as-is without any warranties. Please consider them as guidelines. Please don’t use them in your production environment until thoroughly testing them and making sure the processes work correctly. 


Also published on Medium.

Default image
Vignesh A Sathiyanantham
AWS Certified developer with 8 years of extensive experience working for Cloud and Datacenter solutions and leading a small team in a lean startup based on Bangalore, India
Leave a Reply

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