Skip to content

Instantly share code, notes, and snippets.

@matriphe
Last active September 22, 2020 11:01
Show Gist options
  • Save matriphe/87d6f4b4460152e3609e55348f2f8fcc to your computer and use it in GitHub Desktop.
Save matriphe/87d6f4b4460152e3609e55348f2f8fcc to your computer and use it in GitHub Desktop.
Redis Systemd Service (Debian Based)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
[Install]
WantedBy=multi-user.target
@matriphe
Copy link
Author

matriphe commented Mar 11, 2017

Prepare dependencies.

sudo apt-get update
sudo apt-get install build-essential tcl

Compile and install from source.

wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
cd utils
sudo ./install_server.sh

Create systemd file. Make changes to fit the execution and config file.

sudo nano /lib/systemd/system/redis.service
sudo systemctl enable redis.service

Add some settings.

sudo adduser --system --group --no-create-home redis
sudo chown -R redis:redis /var/lib/redis
sudo chmod -R 770 /var/lib/redis
sudo chown redis:redis /var/log/redis

Now run the service.

sudo systemctl start redis.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment