在Ubuntu 20.04 LTS Focal Fossa上安装Memcached
步骤1.首先,通过apt
在终端中运行以下以下命令,确保所有系统软件包都是最新的。
sudo apt update
sudo apt upgrade
步骤2.在Ubuntu 20.04上安装Memcached。
Memcached软件包包含在默认的Ubuntu 20.04存储库中。运行以下命令以在您的ubuntu系统上安装Memcached服务:
sudo apt install memcached libmemcached-tools
安装后,Memcached服务将自动启动。要检查服务的状态,请输入以下命令:
sudo systemctl status memcached
步骤3.配置Memcached。
可以在以下位置配置Memcached选项:/etc/memcached.conf
sudo nano /etc/memcached.conf
更改设置,例如512MB缓存的示例设置:
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default # Note that the daemon will grow to this size, but does not start out holding this much # memory -m 512 # Default connection port is 11211 -p 11211 # Run the daemon as root. The start-memcached will default to running as root if no # -u command is present in this config file -u memcache # Specify which IP address to listen on. The default is to listen on all IP addresses # This parameter is one of the only security measures that memcached has, so make sure # it's listening on a firewalled interface. # -l 127.0.0.1
退出并保存配置文件,然后重新启动Memcached:
sudo systemctl restart memcached
sudo systemctl enable memcached
步骤4.为Memcached配置防火墙。
Ubuntu附带了一个名为UFW的防火墙配置工具。默认情况下,UFW已安装但未启用。在启用UFW防火墙之前,首先添加一条规则,该规则将允许传入的SSH连接:
sudo ufw allow 22 sudo ufw allow 11211
恭喜你!您已经成功安装了Memcached。感谢您使用本教程在Ubuntu 20.04 LTS Focal Fossa系统上安装Memcached。有关其他帮助或有用信息,建议您检查Memcached官方网站。
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/Yun43759.html