linux通过安装包安装redis

时间:2023-01-27 17:12:07

1.安装包的准备
官网地址:https://redis.io/download

以下是我下载的安装包:
linux通过安装包安装redis
也可以直接用命令执行下载:

语法:wget [需要下载的安装包的URL]
例子:(会下载到当前路径)
# wget http://download.redis.io/releases/redis-4.0.1.tar.gz
[root@iz2ze6u0apce8jpapxeubpz tar.gz]# wget http://download.redis.io/releases/redis-4.0.1.tar.gz
--2017-08-03 12:48:00-- http://download.redis.io/releases/redis-4.0.1.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1711660 (1.6M) [application/x-gzip]
Saving to: 鈥榬edis-4.0.1.tar.gz.1

100%[===================================================================================================>] 1,711,660 737KB/s in 2.3s

2017-08-03 12:48:03 (737 KB/s) - 鈥榬edis-4.0.1.tar.gz.1鈥saved [1711660/1711660]

[root@iz2ze6u0apce8jpapxeubpz tar.gz]#

2、解压并安装

# tar -zxvf redis-4.0.1.tar.gz 

然后把解压的目录放到指定的目录下

# mv redis-4.0.1 ../

语法说明:

# mv [源目录] [目标目录]

然后切换到该目录下:

# cd ../redis-4.0.1

进行编译:

# make

linux通过安装包安装redis

Hint: It's a good idea to run 'make test' ;)

make[1]: Leaving directory `/usr/local/redis-4.0.1/src'
[root@iz2ze6u0apce8jpapxeubpz redis-4.0.1]# make test
cd src && make test
make[1]: Entering directory `/usr/local/redis-4.0.1/src'
You need tcl 8.5 or newer in order to run the Redis test
make[1]: *** [test] Error 1
make[1]: Leaving directory `/usr/local/redis-4.0.1/src'
make: *** [test] Error 2
[root@iz2ze6u0apce8jpapxeubpz redis-4.0.1]#

进入src下执行:

bash-4.2$ cd src
bash-4.2$ make

Hint: It's a good idea to run 'make test' ;)

bash-4.2$ make test
You need tcl 8.5 or newer in order to run the Redis test
make: *** [test] Error 1
bash-4.2$

解决方式
安装tcl

wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz  
sudo tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
cd /usr/local/tcl8.6.1/unix/
sudo ./configure
sudo make
sudo make install

以下截图是另外一种方式:截图来源忘了
linux通过安装包安装redis