Linux安装redis
1.redis.io官网下redis tar.gz包
2.把安装包上传到linux系统中
3.解压安装包命令:tar -zxvf redis-2.8.17.tar.gz
4.进入刚才解压后的文件:cd redis-2.8.17
5.接下来编译源码:make
- 可能会出现如下问题:
(一)
[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2
说明未安装gcc,使用命令安装gcc:yum install gcc
(二)
[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2
如果出现上述错误则执行:make改为make MALLOC=libc
5/安装到指定目录,如 /usr/local/redis
make install PREFIX=/usr/local/redis install
6.进入解压后的目录: cd /root/redis-2.8.19
拷贝配置文件:cp redis.conf /usr/local/redis/
7.启动redis:进入安装目录:cd /usr/local/redis
后执行: ./bin/redis-server redis.conf
- 设置Redis密码,编辑刚刚复制的配置文件:vi redis.conf,解除requirepass参数的注释,并设置值,例如:requirepass ljx520
- 使用配置文件启动Redis数据库:./redis-server redis.conf