在centos上安装redis 可以使用添加epel的方式安装 也可以使用一般的make方式编译安装 这里采用编译安装
1.下载redis
wget http://download.redis.io/releases/redis-2.8.17.tar.gz
tar -xvzf redis-2.8.17.tar.gz
mv redis-2.8.17 redis
cd redis
2.在编译过程中碰到提示错误:
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
采用的解决方式是编译的时候加上参数
make MALLOC=libc
最后再
make install
好了,redis默认使用6379的端口 启动redis只需要用redis-server命令即可:
[2296] 25 Oct 22:59:45.259 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.17 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2296
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[2296] 25 Oct 22:59:45.261 # Server started, Redis version 2.8.17
[2296] 25 Oct 22:59:45.261 # 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.
[2296] 25 Oct 22:59:45.262 * DB loaded from disk: 0.001 seconds
[2296] 25 Oct 22:59:45.263 * The server is now ready to accept connections on port 6379
就这么简单!