阿里云主机(aliyun-Linux) x64安装Redis详解

koushr 2016-02-23

转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/97.html?1455870336

如何在Linux​上安装Redis呢,下面以阿里云主机linux64位作为示例进行安装测试:

1、下载源码编译并安装

#wgethttp://download.redis.io/releases/redis-2.8.19.tar.gz

#tarxzfredis-2.8.19.tar.gz

#cdredis-2.8.19

#make

2、编译成功过后,在src目录下,有三个可执行文件redis-server、redis-benchmark、redis-cli。我这里将其统一放到/usr/local/redis目录下

#mkdir/usr/local/redis

#cpredis-server/usr/redis

#cpredis-benchmark/usr/redis

#cpredis-cli/usr/redis

#cd../

#cpredis.conf/usr/redis

#cd/usr/redis

3.将redis添加到系统环境变量中:

#vi/etc/profile

在文件最后加入下面代码:

exportPATH=/usr/local/redis:$PATH

保存并重新编译

#source/etc/profile

4、启动Redis服务。

#redis-serverredis.conf

如果出现类似下面的输出信息则启动成功:

[20466]04Mar16:34:05.702#Serverstarted,Redisversion2.8.19

[20466]04Mar16:34:05.702#WARNINGovercommit_memoryissetto0!Background

savemayfailunderlowmemorycondition.Tofixthisissueadd'vm.overcommit_m

emory=1'to/etc/sysctl.confandthenrebootorrunthecommand'sysctlvm.ove

rcommit_memory=1'forthistotakeeffect.

[20466]04Mar16:34:05.703#WARNING:TheTCPbacklogsettingof511cannotbe

enforcedbecause/proc/sys/net/core/somaxconnissettothelowervalueof128.

[20466]04Mar16:34:05.703*Theserverisnowreadytoacceptconnectionsonp

ort6379

5、测试

#redis-cli

redis>setmydata"HelloRedis"

OK

redis>getmydata

"HelloRedis"

相关推荐

DiamondTao / 0评论 2020-08-30