下载解压

1
2
3
wget https://download.redis.io/releases/redis-6.0.9.tar.gz
tar xf redis-6.0.9.tar.gz
cd redis-6.2.13

编译

编译需要 gcc

1
make

安装

1
2
3
sudo mkdir -p /usr/local/redis/{bin,conf}
sudo cp src/{redis-benchmark,redis-check-aof,redis-check-rdb,redis-cli,redis-server} /usr/local/redis/bin/
sudo cp redis.conf /usr/local/redis/conf/redis.conf

启动

1
/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf

通过 systemd 管理

vim /usr/lib/systemd/system/redis.service

1
2
3
4
5
6
7
8
9
10
11
[unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target