[root@localhost opt]# yum install wget [root@localhost opt]# wget http://download.redis.io/releases/redis-4.0.13.tar.gz
[root@localhost opt]# tar xzf redis-4.0.13.tar.gz [root@localhost opt]# ls
[root@localhost opt]# cd redis-4.0.13 [root@localhost redis-4.0.13]# ls
[root@localhost redis-4.0.13]# make
[root@localhost redis-5.0.3]# src/redis-server redis.conf
[root@localhost src]# vi ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export REDIS_HOME=/opt/redis-5.0.3/ export PATH=$PATH:$REDIS_HOME/src #PATH=$PATH:$HOME/bin #export PATH
source ~/.bash_profile
[root@localhost ~]# redis-server [root@localhost ~]# redis-cli 127.0.0.1:6379> ping PONG 127.0.0.1:6379> set name apollo OK 127.0.0.1:6379> get name "apollo"
#1.登陸本機redis [root@localhost redis-5.0.3]# src/redis-cli #2.指定服務器ip(不指定時,默認本機) [root@localhost redis-5.0.3]# src/redis-cli -h 127.0.0.1 #3.指定端口(不指定時,默認6379) redis-cli -h 127.0.0.1 -p 6378
1.若出現以下提示,則說明未安裝gcc,使用命令安裝yum -y install gcc gcc-c++ libstdc++-develhtml
[root@localhost redis-4.0.11]# make cd src && make all make[1]: Entering directory `/root/redis-4.0.11 /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
2.若出現以下提示,則將make改成make MALLOC=libc,推測是由於編譯庫的問題。c++
[root@localhost redis-4.0.11]# 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
轉自:--http://www.javashuo.com/article/p-bzzxbuum-ed.htmlredis