**1.install_server.sh脚本**
安装完Redis后,在utils目录下会生成一个install_server.sh的脚本
编辑该文件,将下面内容注释:
![](https://img.kancloud.cn/2b/52/2b528c6b82a7c7dd2af592cd106ff0df_805x171.png)
搜索systemd,找到下面内容,将if判断注释:
```asp
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
# echo "This systems seems to use systemd."
# echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
# exit 1
#fi
```
**2.运行install_server.sh脚本**:
```asp
sudo ./install_server.sh
```
注意运行后的提示,各个路径是否正确,如果路径没问题,每条提示输入回车确认,最终输出类似如下:
```asp
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Success!
Starting Redis server...
Installation successful!
```
**3.测试命令**
启动Redis:
```asp
service redis start
```
查看redis进程:
```asp
ps -ef | grep redis
```
停止Redis:
```asp
service redis stop
```
- Redis介绍
- String类型的应用场景
- Hash类型的应用场景
- List类型应用场景
- Set类型应用场景
- Zset类型应用场景
- Redis官网
- 安装Redis
- Redis配置文件详解
- 配置Redis开机启动
- Redis的命令行工具
- Redis的可视化管理软件
- 各开发语言对应的Redis库
- Server管理命令
- 通用命令
- String类型命令
- HASH类型命令
- LIST类型命令
- Set类型命令
- Sorted_Set类型命令
- ThinkPHP集成Redis
- SpringBoot集成Redis
- 实战篇:优惠券功能概述
- 实战篇:表单页面实现
- 实战篇:后端处理逻辑
- 实战篇:优惠券类逻辑
- 实战篇:优惠券列表
- 原理篇:Redis缓存雪崩
- 原理篇:Redis缓存击穿
- 原理篇:Redis缓存穿透
- 进阶篇:Redis的事务与持久化
- 进阶篇:Redis集群
- 进阶篇:Redis的发布订阅模式
- 进阶篇:Redis分布式锁
- 进阶篇:Redis分布式缓存
- 进阶篇:一致性哈希
- 进阶篇:Redis安全管理
- 进阶篇:Redis性能优化