1:下载redis源码
wget http://download.redis.io/redis-stable.tar.gz
2:解压
tar xvzf redis-stable.tar.gz
3:进入redis-stable目录
cd redis-stable
4:build源码
make
5:测试一下build是否成功了
make test
如果看到如下输出
\o/ All tests passed without errors!
Cleanup: may take some time... OK
make[1]: Leaving directory '/home/ghc/Documents/nano/redis-stable/src'
证明成功了
6:去到src目录就可以看到
- redis-server is the Redis Server itself.
- redis-sentinel is the Redis Sentinel executable (monitoring and failover).
- redis-cli is the command line interface utility to talk with Redis.
- redis-benchmark is used to check Redis performances.
- redis-check-aof and redis-check-dump are useful in the rare event of corrupted data files.
7:启动Redis server
redis-server
默认端口是6379
8:查看server是否正在运行
redis-cli ping
返回pong就证明可以ping通 是正在运行
遇到的错:
1:执行make test之后报错
cd src && make test
make[1]: Entering directory '/home/ghc/Documents/nano/redis-stable/src'
CC Makefile.dep
You need tcl 8.5 or newer in order to run the Redis test
Makefile:242: recipe for target 'test' failed
make[1]: *** [test] Error 1
make[1]: Leaving directory '/home/ghc/Documents/nano/redis-stable/src'
Makefile:6: recipe for target 'test' failed
make: *** [test] Error 2
这表明没有安装tcl,执行 sudo apt install tcl来安装