Your cart is currently empty!
How to install Memcached on Debian or Ubuntu
This brief tutorial will guide you through the steps to quickly install a free Memcached server on a Debian or Ubuntu host.
After you have gone through the steps, you will have a Memcached server running as a service and you can use it to power your WordPress site with plugins that support it.
You can use this to power the cache and get lightning fast search and filter results with the latest release of the WooCommerce Product Search extension, the Search Engine which is essential for every WooCommerce store.
First, we are going to update the package repository:
$ sudo apt update
Next, we will install the Memcached server package:
$ sudo apt install memcached
We are also going to install the PHP extension, so that WordPress plugins can use it:
$ sudo apt install php-memcached
If all went well, we can immediately use this command to see what version we are running:
$ memcached –-version
We also want to make sure that the server is running as a service, because this will confirm that Memcached is available also after the host is restarted:
$ sudo service memcached status
We’re good to go now, but let’s also install some helpful tools:
$ sudo apt install libmemcached-tools
This package includes several command line tools, including memcstat
which comes in handy to get some stats on the running memcached server:
$ memcstat –-servers=localhost
You can use that command to check the corresponding stats of the server while it is running.
Congrats! Your Memcached server is up and running! It is available to cache data listening on port 11211
on localhost
.
Go to the Memcached section of the documentation for the WooCommerce Product Search search engine to see how to enable it for the system.
You will find the Memcached configuration file at /etc/memcached/memcached.conf
– where you can customize its settings. Make sure to restart memcached
after making changes to the configuration file so that they apply. The memcached
service script at /etc/init.d/memcached
did not implement the reload option at the time of writing (using Memcached 1.6.9), so a restart is needed instead (which will wipe out currently cached data).
Some useful resources:
- The Memcached site.
- The memcached Debian package.
- The php-memcached Debian package.
- The libmemcached-tools Debian package.
- The Memcached and the Cache section of the documentation for the WooCommerce Product Search search engine.
Got questions? Comment below!
Leave a Reply