wget -O redis-5.0-rc3.tar.gz https://github.com/antirez/redis/archive/5.0-rc3.tar.gz
tar -zxvf redis-5.0-rc3.tar.gz -C /usr/local
cd /usr/local/redis-5.0-rc3
make
There will be an error:
compilation terminated.
make[1]:***[adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-5.0-rc3/src'
make:***[all] Error 2
Install Development Tools
yum groupinstall 'Development Tools'
If executed again, an error will be reported
make
cd src && make all
make[1]: Entering directory `/usr/local/redis-5.0-rc3/src'
CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
# include <jemalloc/jemalloc.h>
^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-5.0-rc3/src'
make:***[all] Error 2
The final solution is as follows:
cd /usr/local/redis-5.0-rc3/deps; make hiredis lua jemalloc linenoise
After the compilation is complete, execute the make command again in /usr/local/redis-5.0-rc3
cd /usr/local/redis-5.0-rc3
make
The compilation is successful when the following appears
Hint: It's a good idea to run 'make test' ?
make[1]: Leaving directory `/usr/local/redis-5.0-rc3/src'
Then execute the installation command in /usr/local/redis-5.0-rc3/src
:
cd /usr/local/redis-5.0-rc3/src
make install
The following log information will appear
Hint: It's a good idea to run 'make test' ?
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
vim /usr/local/redis-5.0-rc3/redis.conf
Just need to adjust the following
protected-mode no #Turn off protection mode
daemonize yes #Daemon mode is on
/usr/local/redis-5.0-rc3/src/redis-server /usr/local/redis-5.0-rc3/redis.conf
In fact, when we execute make install
, we will copy several commands under src to /usr/local/bin/
, or execute the following command to start redis5.0
/usr/local/bin/redis-server /usr/local/redis-5.0-rc3/redis.conf
Check port
netstat -ltnp |grep 6379
If there is port monitoring, redis has been started successfully.
Try to connect
redis-cli
127.0.0.1:6379> info
# Server
redis_version:4.9.103
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:207f31cf830c081e
redis_mode:standalone
os:Linux 3.10.0-693.17.1.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:4.8.5
process_id:20361
run_id:4835668974ad86f1db9b3c8b98e02be1a87a7b9b
tcp_port:6379
uptime_in_seconds:689
uptime_in_days:0
hz:10
lru_clock:3944003
Why can the redis-cli
command be executed in any directory, because the redis-cli
command is in the /usr/local/bin
directory, and the directory is configured in the PATH, so you can execute ls, mkdir Wait for commands to execute commands such as redis-cli
or redis-server
.
Generally, we will delete the installation package after installing redis. Then we only need to move the redis.conf configuration file to other directories, such as: /etc/redis/redis.conf
, where is the specific location? Just place it according to your own habits or specifications.
Recommended Posts