debian设置自启动redis
时间: 2023-10-18 14:27:03 浏览: 165
要在Debian上设置Redis的自启动,可以按照以下步骤进行操作:
1. 首先,下载Redis的稳定版本并解压编译安装。可以使用以下命令完成此操作:
```
cd /usr/local
wget http://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable && make
make install PREFIX=/usr/local/redis
```
2. 创建Redis的配置文件存放目录,并将redis.conf移动到该目录中:
```
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
```
3. 启动Redis服务,可以使用以下命令:
```
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
```
4. 接下来,需要创建并编辑Redis的systemd服务文件。在`/etc/systemd/system`目录下创建一个名为`redis.service`的文件,并将以下内容添加到文件中(记得将路径修改成你自己的Redis安装路径):
```
[Unit]
Description=Redis
After=network.target
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Linux-Debian 编译安装redis,并使用systemctl方式配置自启动](https://blog.csdn.net/zyw_0813/article/details/125302275)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Debian(arm) 安装 redis4.0.9 [开机自启]](https://blog.csdn.net/s261676224/article/details/128221355)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文