Redisインストール(Amazon Linux 2023)

インストールするRedisのパッケージを確認

dnf search redis

Redisインストール

dnf install redis6

ソースからインストールする場合

cd /usr/local/src
wget -c https://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
make install

systemdのunitファイルを作成

vi /etc/systemd/system/reids.service
[Unit]
Description=redis
After=syslog.target network-online.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/bin/redis6-server /etc/redis6/redis6.conf
ExecStop=/usr/bin/redis6-cli -p 6379 shutdown
Restart=on-failure
SyslogIdentifier=redis

[Install]
WantedBy=default.target

Redisを起動

systemctl daemon-reload
systemctl start redis
journalctl -u redis