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

Redisインストール

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

設定ファイルをコピー

cp /usr/local/src/redis-stable/redis.conf /usr/local/etc/redis.conf
vi /usr/local/etc/redis.conf

systemdのunitファイルを作成

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

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

[Install]
WantedBy=default.target

Redisを起動

systemctl daemon-reload
systemctl start redis
journalctl -u redis