linux 安装redis方法,及出现异常解决方法
程序员文章站
2022-07-14 15:40:40
...
官网地址:http://redis.io/
官网下载地址:http://redis.io/download
1. 下载Redis源码(tar.gz),并上传到Linux
2. 解压缩包:tar zxvf redis-2.8.17.tar.gz
3. 进入解压缩后的文件夹:cd redis-2.8.17
4. 编译源码:make
(1)若出现如下提示,则说明未安装gcc,使用命令安装gcc:yum install gcc
[[email protected] 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,推测是因为编译库的问题。
[[email protected] 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
-
安装编译后的文件:make install,redis可执行文件将被复制到/usr/local/bin/,但没有配置,手动复制配置:cp redis.conf /usr/local/bin
-
设置Redis密码,编辑刚刚复制的配置文件:vi redis.conf,解除requirepass参数的注释,并设置值,例如:requirepass ljx520
-
使用配置文件启动Redis数据库:./redis-server redis.conf
如果看到如下的界面,那么恭喜你,Redis已安装成功
16751:C 11 Jun 2019 10:46:09.333 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
16751:C 11 Jun 2019 10:46:09.333 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=16751, just started
16751:C 11 Jun 2019 10:46:09.333 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
16751:M 11 Jun 2019 10:46:09.334 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 16751
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
16751:M 11 Jun 2019 10:46:09.335 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
16751:M 11 Jun 2019 10:46:09.335 # Server initialized
16751:M 11 Jun 2019 10:46:09.335 # 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.
16751:M 11 Jun 2019 10:46:09.335 # 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.
16751:M 11 Jun 2019 10:46:09.335 * Ready to accept connections
上一篇: win10+ubuntu双系统修改win10位默认启动项
下一篇: Linux下redis的安装
推荐阅读
-
Linux下 php7安装redis的方法
-
Linux系统安装NoSQL(MongoDB和Redis)步骤及问题解决办法(总结篇)
-
flutter的环境安装配置问题及解决方法
-
Mysql非安装版使用步骤及忘记密码解决方法
-
win7系统提示找不到kx支持的设备请尝试重新安装驱动的原因及解决方法
-
虚拟机安装linux系统无法上网的解决方法
-
linux主机AMH管理面板安装教程及建站使用方法(图文)
-
linux下安装nodejs及npm的方法
-
Centos7.4服务器安装apache及安装过程出现的问题解决方法
-
Win7旗舰版系统安装失败提示10100 Invalid switch错误的原因分析及解决方法