安装redis
软件下载地址
https://redis.io/download
解压软件
tar -zxvf redis-*.tar.gz (*代表版本号)
编译并安装
cd redis-*
使用make命令编译
make
编译完以后进入src文件夹下
cd src
运行make test测试是否可以安装
make test
如果出现下边提示,如果没有直接跳过下边操作
[root@localhost src]# make test
You need tcl 8.5 or newer in order to run the Redis test
make: *** [test] Error 1
TCL(Tool Command Language)工具脚本语言,是Linux内的一种语言包。,这里需要先安装tcl
1、先去这里下载:
http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
文件
2、然后将其拷贝至虚拟机
3、然后解压对于.tar.gz的后缀文件可以使用tar zxvf 。。。.tar.gz解压
tar zxvf tcl8.6.1-src.tar.gz
4、安装 Tcl
为编译 Tcl 做准备:
cd 到tcl文件夹里
[root@localhost Desktop]# cd tcl8.6.1/
cd unix
[root@localhost tcl8.6.1]# cd unix/
./configure
[root@localhost unix]# ./configure
编译软件包:
[root@localhost unix]# make
安装软件包:
[root@localhost unix]# make install
这个时候在命令行就可以输入tclsh进入tcl解释器
tcl就可以使用了。
继续我们的redis安装
再次测试make test,会进行检查。如果都是绿色的ok,就可以检查通过
安装
make PREFIX=/usr/local/redis install
把解压的redis路径下的redis.conf的文件拷贝到安装路径下
[root@localhost Desktop]# cd redis-4.0.1/
[root@localhost redis-4.0.1]# ls
00-RELEASENOTES INSTALL runtest tests
BUGS Makefile runtest-cluster utils
CONTRIBUTING MANIFESTO runtest-sentinel
COPYING README.md sentinel.conf
deps redis.conf src
[root@localhost redis-4.0.1]# cp redis.conf /usr/local/redis
[root@localhost redis-4.0.1]# cd /usr/local/redis
[root@localhost redis]# ls
bin redis.conf
到这里redis已经安装成功了。
修改redis.conf配置文件
把daemonize的值改为yes,默认为前端启动现在改为后台启动
启动redis
[root@localhost redis]# ./bin/redis-server ./redis.conf
参考链接:https://blog.csdn.net/qq_20989105/article/details/76390367
redis配置文件参考链接:https://www.cnblogs.com/Fooo/p/6599100.html