第一步:下载安装包
访问https://redis.io/download 到官网进行下载。
第二步:安装
1.通过远程管理工具,将压缩包拷贝到Linux服务器中,执行解压操作
2.进入解压文件目录使用make对解压的Redis文件进行编译
图示:这里因为我redis的安装目录在 /usr/src
安装报错!!!gcc命令报错!!
需要安装GCC编译工具!!!
编译源码:make
(1)若出现如下提示,则说明未安装gcc,使用命令安装gcc:yum install gcc
[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/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,推测是因为编译库的问题。
[root@localhost redis-2.8.17]# 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
3.编译成功后,进入src文件夹,执行make install进行Redis安装。
如下图示安装完成,界面如下:
直接启动
直接运行redis-server即可以启动redis
redis服务器默认会使用6379端口,通过–port参数可以自定义端口号:
redis-server --port 6380
[root@linux1 redis-5.0.7]# ./redis-server
-bash: ./redis-server: No such file or directory
[root@linux1 redis-5.0.7]# cd /
[root@linux1 /]# redis-server
2356:C 13 Feb 2020 20:15:41.762 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2356:C 13 Feb 2020 20:15:41.762 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=2356, just started
2356:C 13 Feb 2020 20:15:41.762 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2356:M 13 Feb 2020 20:15:41.763 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2356
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
2356:M 13 Feb 2020 20:15:41.802 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2356:M 13 Feb 2020 20:15:41.802 # Server initialized
2356:M 13 Feb 2020 20:15:41.806 # 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.
2356:M 13 Feb 2020 20:15:41.811 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2356:M 13 Feb 2020 20:15:41.814 * Ready to accept connections
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)