linux下安装redis首先需要安装gcc,它是用来编译redis的源文件的
1.安装gcc ,前提是切换root用户,途中会出现两次选择,都按输入y
[root@centos-linux zhongkai]# yum install gcc-c++
2.去redis官网下载redis软件 https://redis.io/
3.解压redis
[root@centos-linux zhongkai]# cd Documents/
[root@centos-linux Documents]# ls
redis-4.0.9.tar.gz
[root@centos-linux Documents]# tar zxvf redis-4.0.9.tar.gz
4.使用make命令编译
redis-4.0.9 redis-4.0.9.tar.gz
[root@centos-linux Documents]# cd redis-4.0.9/
[root@centos-linux redis-4.0.9]# make
5.进入解压的src目录
[root@centos-linux src]# make test
CC Makefile.dep
You need tcl 8.5 or newer in order to run the Redis test
make: *** [test] 错误 1
解决报错:
到这里会出现错误是很正常的,去下载tcl工具脚本语言,是Linux内的一种语言包
网址:http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
[root@centos-linux tcl8.6.1]#cd unix/
[root@centos-linux unix]#./cinfigure
[root@centos-linux unix]#cd make
[root@centos-linux unix]#cd make unstall
再执行 [root@centos-linux src]# make test
以下结果表示成功
安装:
[root@centos-linux src]# make PREFIX=/usr/local/redis install
以上显示表示安装成功
启动:
[root@centos-linux bin]# ./redis-server10783:C 15 May 15:00:58.821 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
10783:C 15 May 15:00:58.822 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=10783, just started
10783:C 15 May 15:00:58.822 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
10783:M 15 May 15:00:58.823 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 10783
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'