How to install and configure memcached on Ubuntu Linux 18.04

Originally published at: https://www.cyberciti.biz/faq/how-to-install-and-configure-memcached-on-ubuntu-linux-18-04/

I would like to reduce the load on my MariaDB/MySQL/PostgreSQL server using memcached. How do I install and configure memcached server on Ubuntu Linux 18.04 LTS?