Page 1 of 1

How to install memcached on Debian

Posted: Thu Mar 23, 2023 4:23 pm
by myVesta
In order to install memcached service, in SSH, as root, run:

Code: Select all

memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
apt-get update
apt-get -y install memcached 
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcache ")
apt-get install $(systemctl --full --type service --all | grep "php...-fpm" | sed 's#●##g' | awk '{print $1}' | cut -c1-6 | xargs -n 1 printf "%s-memcached ")
if [ $memory -lt 15000000 ]; then
    sed -i "s/-m 64/-m 256/" /etc/memcached.conf
else
    sed -i "s/-m 64/-m 1024/" /etc/memcached.conf
fi
systemctl restart memcached
OR

New and quick way (for myVesta only) :

Code: Select all

v-update-myvesta
v-commander 'inst memcached'