下载 Redis
访问 Redis 官网下载最新的 Linux 包,Redis 官方没有 Windows 版的下载。
下载后把包上传到 Linux 服务器。
安装 Redis
- 解压 Redis 包
tar -zxf redis-4.0.2.tar.gz
- 切换到 Redis 解压目录
cd redis-4.0.2
- 编译 Redis
make
如报错按以下错误解决。
make: cc:命令未找到
make: *** [adlist.o] 错误 127
yum install gcc
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/usr/local/redis/src'
make: *** [all] Error 2
vi src/.make-settings,修改 OPT=-O2 -march=x86-64
- 编译测试
make test
报错解决。
make[1]: Entering directory
/home/test/redis-4.0.2/src' CC Makefile.dep make[1]: Leaving directory/home/test/redis-4.0.2/src' make[1]: Entering directory/home/test/redis-4.0.2/src' You need tcl 8.5 or newer in order to run the Redis test make[1]: *** [test] Error 1 make[1]: Leaving directory/home/test/redis-4.0.2/src'
wget http://downloads.sourceforge.net/tcl/tcl8.6.7-src.tar.gz
tar -zxf tcl8.6.7-src.tar.gz
cd tcl8.6.7/unix/
./configure
make
make install
- 安装
切换到 redis 目录执行安装。
make install
启动 Redis
启动 redis src 目录下的 redis-server 命令来启动 Redis 服务。
./redis-server ../redis.conf
