centos7 安装 redis
时间: 2023-12-19 15:06:11 浏览: 101
以下是在CentOS 7上安装Redis的步骤:
1. 安装必要的依赖库和工具:
```shell
yum install epel-release yum-utils -y
yum install gcc make wget -y
```
2. 下载Redis源代码并解压:
```shell
cd /usr/local/src
wget http://download.redis.io/releases/redis-6.2.5.tar.gz
tar xzf redis-6.2.5.tar.gz
cd redis-6.2.5
```
3. 编译并安装Redis:
```shell
make
make install
```
4. 配置Redis:
```shell
mkdir /etc/redis
cp /usr/local/src/redis-6.2.5/redis.conf /etc/redis/
```
5. 修改Redis配置文件:
```shell
vi /etc/redis/redis.conf
```
将以下内容修改为:
```shell
daemonize yes
bind 0.0.0.0
requirepass yourpassword
```
其中,`yourpassword`是你设置的密码。
6. 启动Redis:
```shell
redis-server /etc/redis/redis.conf
```
7. 验证Redis是否启动成功:
```shell
redis-cli ping
```
如果返回`PONG`,则表示Redis已经成功安装并启动。
阅读全文
相关推荐












