**1.install_server.sh腳本**
安裝完Redis后,在utils目錄下會生成一個install_server.sh的腳本
編輯該文件,將下面內容注釋:

搜索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性能優化