centos下redis4.0.8单机快速安装

1 下载

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

2 解压

tar -zxvf redis-4.0.8.tar.gz

3 安装

cd redis-4.0.8
make && make install PREFIX=/usr/local/redis
  • 如果 make 编译失败,可执行以下命令安装 编译所需的环境
yum -y install gcc
yum -y install gcc-c++
  • 再次执行 make 编译命令,如果报 error: jemalloc/jemalloc.h: No such file or directory等这种错误
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 `/data0/src/redis-2.6.2/src'
make: *** [all] Error 2

执行 : make MALLOC=libc 编译完成后执行make install PREFIX=/usr/local/redis

4 移动配置文件到安装目录下

cd redis-4.0.8
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc

5 修改redis.conf

vim /usr/local/redis/etc/redis.conf
# 配置redis为后台启动
将daemonize no 改成daemonize yes

# 给redis设置登录密码
requirepass xxx   #指定密码xxx

# 远程连接失败问题
修改为 bind 0.0.0.0

6 启动redis

# 启动
cd /usr/local/redis
./bin/redis-server /usr/local/redis/etc/redis.conf

# 停止
ps -ef|grep redis
kill -9 $PID

# 命令窗口
./bin/redis-cli -h 172.31.96.61 -p 6379 -n 0 -a iflytek

你可能感兴趣的:(redis)