记录 Denian 系统下 redis 的安装

下载最新稳定版 redis

wget http://download.redis.io/redis-stable.tar.gz

解压,并将其移动到 /usr/local/redis

tar -xvf  redis-stable.tar.gz
mv ./redis-stable /usr/local/redis
cd /usr/local/redis

开始编译

make

编译完成后将redis安装在 /usr/local/redis

make PREFIX=/usr/local/redis install

添加链接

ln -s /usr/local/redis/bin/redis-server /usr/local/bin/redis-server
ln -s /usr/local/redis/bin/redis-cli /usr/local/bin/redis-cli

创建 systemctl 管理文件

vim /etc/systemd/system/redis.service

添加以下内容

[Unit]
Description=Redis
After=network.target

[Service]
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf  --daemonize no
ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown

[Install]
WantedBy=multi-user.target

启动

systemctl start redis

查看状态

systemctl status redis

查看redis版本

redis-server -v

输出

Redis server v=7.2.5 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=2deaeadb324285d0

安装完成

参考:

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注