You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用./install_server.sh安装Redis时遇systemd相关错误求助

Fixing Redis Installation Error with systemd

Hey there, I've run into this exact issue before—let's get your Redis set up properly with systemd since your system doesn't use the old sysvinit/upstart that the install_server.sh script was built for. Here's a step-by-step breakdown:

1. Locate the systemd service example file

You're already in the utils directory of your Redis source code, which has a pre-made systemd service template. Look for redis-server.service (it should be right there alongside the install_server.sh script).

2. Copy and customize the service file

First, copy the template to systemd's service directory (where systemd looks for service definitions):

sudo cp redis-server.service /etc/systemd/system/

Next, open the copied file to adjust paths to match your setup—this is crucial:

sudo vim /etc/systemd/system/redis-server.service

You'll need to tweak these key fields:

  • ExecStart: Point this to your compiled redis-server binary. If you built Redis from source, it's likely in the src folder of your Redis source (e.g., /path/to/redis-source/src/redis-server /etc/redis/redis.conf). Don't forget to include the path to your redis.conf file too.
  • PIDFile: This should match the pidfile setting in your redis.conf (default is /var/run/redis_6379.pid).
  • WorkingDirectory: Set this to your Redis data directory (common choices are /var/lib/redis or the data folder in your source).
  • User/Group: Make sure these match the user/group you want Redis to run as (many setups use a dedicated redis user—create it first if you haven't with sudo useradd -r redis).

3. Prepare necessary directories (if missing)

If you're using standard paths like /var/lib/redis for data and /var/log/redis for logs, create them and set proper permissions:

sudo mkdir -p /var/lib/redis /var/log/redis
sudo chown redis:redis /var/lib/redis /var/log/redis
sudo chmod 770 /var/lib/redis /var/log/redis

4. Enable and start the Redis service

Reload systemd to recognize the new service file, then enable it to start on boot, and launch it:

sudo systemctl daemon-reload
sudo systemctl enable redis-server
sudo systemctl start redis-server

5. Verify everything works

Check the service status to confirm it's running:

sudo systemctl status redis-server

You can also test connectivity with Redis CLI:

redis-cli ping

If you get PONG back, you're good to go!

内容的提问来源于stack exchange,提问作者raywong

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 16:17:56