https://www.thefanclub.co.za/how-to/how-install-memcached-on-ubuntu-for-...
sudo vim /etc/php5/conf.d/memcache.ini
Add the following line to the file and save :
extension=memcache.so
If you intend to use memcached with Drupal also add the following line to your php.ini or memcache.ini file and save :
memcache.hash_strategy="consistent"
sudo vim /etc/memcached.conf
For changing the firewall I went to:
sudo vim /etc/iptables.firewall.rules
I added the following lines:
# Allow Memcached port 11211
-A INPUT -p tcp --dport 11211 -j ACCEPT
Below the http and https values
REBOOT
Add conf variables to drupal settings.php