To install and configure memcached on Ubuntu Linux 18.04 or 20.04, follow these steps:
sudo apt-get update sudo apt-get install memcached
sudo systemctl start memcached
/etc/memcached.conf
file. This file contains a number of configuration options that you can use to fine-tune the behavior of memcached. Some of the options that you might want to consider adjusting include:-m
: This option specifies the amount of memory, in megabytes, that memcached is allowed to use.-l
: This option specifies the IP address and port that memcached will listen on.-u
: This option specifies the user that memcached should run as.For example, to allow memcached to use 256MB of memory and listen on IP address 127.0.0.1
and port 11211
, you can set the following options in the configuration file:
-m 256 -l 127.0.0.1 -p 11211
sudo systemctl restart memcached
memcached-tool
utility to check the status of the server:memcached-tool 127.0.0.1:11211 stats
This command should display a list of statistics for the memcached server.