网址:1-https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/
查看是否有redis
ubantu:apt-cache policy redis-server
centos:yum list redis 或 yum list installed | grep redis
apt查看已安装:apt --list installed
debian已安装:dpkg -l | grep package-name
yum查看已安装
yum list installed
查找软件包:yum search name
可安装:yum list
yum已安装信息包 yum info name
一、Install on Ubuntu/Debian:
$sudo apt-get install lsb-release curl gpg
$curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
$sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
$echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
$sudo apt-get update
$sudo apt-get install redis
$sudo systemctl enable redis-server
$sudo systemctl start redis-server
测试:
$redis-cli
127.0.0.1:6379> ping
PONG
redis.conf
requirepass yourpassword
redis-cli -h 192.168.1.100 -p 6379 -a yourpassword
mysql -h remote_host_ip -u username -p
Install on Red Hat/Rocky:
$sudo yum install redis
$sudo systemctl enable redis
$sudo systemctl start redis
Install on Ubuntu using Snap:
$sudo apt update
$sudo apt install redis-tools # for redis-cli
$sudo snap install redis
#自启动
$sudo snap set redis service.start=true
$sudo snap start redis
$sudo snap stop redis
$sudo snap restart redis
$sudo snap services redis