Download the source code

IO/Download the latest stable version

$wget https://download.redis.io/releases/redis-6.0.9.tar.gz $tar XZF redis - 6.0.9. Tar. Gz $cdRedis - 6.0.9Copy the code

Compile the installation

$ make
$ make install
Copy the code

Modifying a Configuration Fileredis.conf

Change the remote access, background startup, and password

  • hiddenThe bind 127.0.0.1Or modified toThe bind 0.0.0.0
  • Modify thedaemonize noforyes
  • Modify theRequirepass > Your password

Start the

$ ./src/redis-server ./redis.conf
Copy the code

Use Systemd to manage services

Create the redis.service file in the /etc/systemd/system directory and write the following contents

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=${Installation directory}/src/redis-server ${Installation directory}/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Copy the code

Refresh systemctl to view the Redis status

$ sudo systemctl daemon-reload
$ sudo systemctl status redis
Copy the code

Setting boot

$ sudo systemctl enable redis.service
Copy the code