# 17.1 安装

当前redis最新稳定版本是4.0，常用版本3.2版本。 step1:下载

```
wget <http://download.redis.io/releases/redis-3.2.8.tar.gz>
```

step2:解压

```
tar -zxvf redis-3.2.8.tar.gz
```

step3:复制，放到usr/local/redis⽬录下

```
sudo mv ./redis-3.2.8 /usr/local/redis/
```

step4:进⼊redis⽬录

```
cd /usr/local/redis/
```

step5:生成 a) 安装c语言编译器gcc

```
sudo apt-get install gcc
```

b) 安装编译命令make

```
sudo apt-get install make(这一步可能会出问题，根据提示执行命令)
```

c) 生成

```
sudo make(比较慢)
```

step6:测试,这段运⾏时间会较⻓

```
sudo make test
```

![Image](https://github.com/clay-wangzhi/wiki/tree/46b947765d64b8562206df9ac2bae98e26b90b86/17%20Redis/images/4b9a2195123aef8955b322ab717f01450ba01875.png)

解决方法

```
cd
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
```

step7:安装,将redis的命令安装到/usr/local/bin/⽬录

```
sudo make install （时间比较长）
```

**常用命令** a) redis-server redis服务器 b) redis-cli redis命令行客户端 c) redis-benchmark redis性能测试工具 d) redis-check-aof AOF文件修复工具 e) redis-check-rdb RDB文件检索工具

step9:配置⽂件，移动到/etc/⽬录下 配置⽂件⽬录为/usr/local/redis/redis.conf

```
sudo cp /usr/local/redis/redis.conf /etc/redis/
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.clay-wangzhi.com/17-redis/17.1-an-zhuang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
