Ubuntu 22.04.3 LTS 设置 Redis 开机自启动

  1. 编译安装
  2. 创建自启动服务
bash 复制代码
sudo vim /etc/systemd/system/redis.service

内容如下:

bash 复制代码
[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /home/xwx/redis/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
  1. 使启动生效
bash 复制代码
sudo systemctl enable redis

会在 /etc/systemd/system/multi-user.target.wants/ 下面生成一个 redis.service 的符号链接,这样开机自启动才会生效

相关推荐
kebidaixu1 天前
BCU 平台 RS485 驱动适配:从 THVD1406 到 ISO3082
linux
无敌的牛1 天前
redis学习过程
数据库·redis·学习
谢平康1 天前
解决用 rm 报bash: /usr/bin/rm: Argument list too long错
linux·运维·运维开发
swordbob1 天前
Redis 3 大问题 + 5 大扩展问题
redis
hj2862511 天前
Linux 网络服务综合笔记(概念 + 命令 + 实操案例)2
linux·运维·网络
what_20181 天前
Linux 磁盘 (查看、划分、inode)
linux·运维·服务器
2739920291 天前
GDB调试(Linux)
linux
凡人叶枫1 天前
Effective C++ 条款23:宁以 non-member、non-friend 替换 member 函数
linux·开发语言·c++·嵌入式开发
不会C语言的男孩1 天前
Linux 系统编程 · 第 4 章:文件属性与元数据
linux·c语言·开发语言
小生不才yz1 天前
Shell脚本精读 · S02-03 | 词拆分、通配符与未加引号的变量
linux