1、安装make
yjq@LAPTOP-NL8TU5I4:/usr/local$ sudo apt-get update
...
yjq@LAPTOP-NL8TU5I4:/usr/local$ sudo apt-get make
...
yjq@LAPTOP-NL8TU5I4:/usr/local$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-7 gcc-7 gcc-7-base gcc-8-base libasan4 libatomic1
libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libgcc-7-dev libgcc1 libgomp1 libisl19 libitm1 liblsan0
libmpc3 libmpx2 libquadmath0 libstdc++6 libtsan0 libubsan0 linux-libc-dev manpages-dev
Suggested packages:
binutils-doc cpp-doc gcc-7-locales gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-7-multilib
gcc-7-doc libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc
The following NEW packages will be installed:
...
2、下载安装包
访问https://redis.io/download 到官网进行下载。这里下载最新的5.0.8版本.
yjq@LAPTOP-NL8TU5I4:/mnt/d/Redis$ tar -xzf redis-5.0.8.tar.gz
yjq@LAPTOP-NL8TU5I4:/mnt/d/Redis$ ls
redis-5.0.8 redis-5.0.8.tar.gz
yjq@LAPTOP-NL8TU5I4:/mnt/d/Redis$ cd /usr/local
yjq@LAPTOP-NL8TU5I4:/usr/local$ ll
total 0
drwxr-xr-x 1 root root 4096 Mar 4 23:52 ./
drwxr-xr-x 1 root root 4096 Mar 4 23:52 ../
drwxr-xr-x 1 root root 4096 Mar 4 23:52 bin/
drwxr-xr-x 1 root root 4096 Mar 4 23:52 etc/
drwxr-xr-x 1 root root 4096 Mar 4 23:52 games/
drwxr-xr-x 1 root root 4096 Mar 4 23:52 include/
drwxr-xr-x 1 root root 4096 Mar 4 23:53 lib/
lrwxrwxrwx 1 root root 9 Mar 4 23:52 man -> share/man/
drwxr-xr-x 1 root root 4096 Mar 4 23:52 sbin/
drwxr-xr-x 1 root root 4096 Mar 5 00:47 share/
drwxr-xr-x 1 root root 4096 Mar 4 23:52 src/
yjq@LAPTOP-NL8TU5I4:/usr/local$ mv /mnt/d/Redis/redis-5.0.8 ./
mv: cannot create directory './redis-5.0.8': Permission denied
yjq@LAPTOP-NL8TU5I4:/usr/local$ sudo mv /mnt/d/Redis/redis-5.0.8 ./
[sudo] password for yjq:
yjq@LAPTOP-NL8TU5I4:/usr/local$ ll
make
yjq@LAPTOP-NL8TU5I4:/usr/local/redis$ make MALLOC=libc
cd src && make all
make[1]: Entering directory '/usr/local/redis/src'
CC Makefile.dep
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: Entering directory '/usr/local/redis/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
运行
yjq@LAPTOP-NL8TU5I4:/usr/local/redis/src$ ./redis-server
5324:C 16 Apr 2020 09:50:22.519 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5324:C 16 Apr 2020 09:50:22.519 # Redis version=5.0.8, bits=64, commit=00000000, modified=0, pid=5324, just started
5324:C 16 Apr 2020 09:50:22.519 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
5324:M 16 Apr 2020 09:50:22.520 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.8 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 5324
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
5324:M 16 Apr 2020 09:50:22.530 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
5324:M 16 Apr 2020 09:50:22.531 # Server initialized
5324:M 16 Apr 2020 09:50:22.531 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
5324:M 16 Apr 2020 09:50:22.532 * Ready to accept connections