1.下载
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
2.剪切到要安装redis的目录
cp redis-3.2.3.tar.gz /usr/cg/redis-3.2.3.tar.gz
错误提示
[cg@localhost soft]cpredis−3.2.3.tar.gz/usr/cg/redis−3.2.3.tar.gzcp:无法创建普通文件”/usr/cg/redis−3.2.3.tar.gz”:权限不够[cg@localhostsoft] sudo cp redis-3.2.3.tar.gz /usr/cg/redis-3.2.3.tar.gz
[sudo] password for cg:
cg 不在 sudoers 文件中。此事将被报告。
[cg@localhost soft]$ su root
2.切换到redis安装目录,解压
tar xzvf redis-3.2.3.tar.gz
错误提示
redis-3.2.3/utils/whatisdoing.sh
tar: redis-3.2.3:无法 mkdir: 权限不够
tar: redis-3.2.3/utils/whatisdoing.sh:无法 open: 没有那个文件或目录
tar: 由于前次错误,将以上次的错误状态退出
切换到root后,再解压
4.安装
cd redis-3.2.3
make
5.启动
./src/redis-server redis.conf
通过启动参数告诉redis使用指定配置文件
出现启动信息:
3322:M 18 Sep 10:01:17.596 * Increased maximum number of open files to 10032 (it was originally set to 1024).
.
_.-__ ''-._
_.-.
. ”-. Redis 3.2.3 (00000000/0) 64 bit
.-.-```. ```\/ _.,_ ''-._
-._|’
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-._.-'| Port: 6379
-._
|._ / _.-' | PID: 3322
-._
-._
-./ .-’ .-’
|-._
-._ -.__.-' _.-'_.-'|
-._
|-._ _.-'_.-' | http://redis.io
-._
-._
-._.-‘.-’ _.-’
|-._
-._ -.__.-' _.-'_.-'|
-._
|-._ _.-'_.-' |
-._
-._
-._.-‘.-’ _.-’
-._
-._.-’ .-’
-._ _.-'
-.__.-’
3322:M 18 Sep 10:01:17.597 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
3322:M 18 Sep 10:01:17.597 # Server started, Redis version 3.2.3
3322:M 18 Sep 10:01:17.597 # 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.
3322:M 18 Sep 10:01:17.613 # 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.
3322:M 18 Sep 10:01:17.613 * The server is now ready to accept connections on port 6379
6.检测redis是否成功启动
A.重新打开一个shell终端窗口,启动客户端
./src/redis-cli
输入命令
ping
打印信息
127.0.0.1:6379> ping
PONG
证明redis已经安装并且启动成功了
有时间再补充sudo root出错的解决办法。