LoginSignup
1

More than 5 years have passed since last update.

簡単!redis(3.2.4)のインストール方法

Posted at

最新版のredis(3.2.4)をインストールする手順を記載します。

やりたいこと

  • redisのインストール(ver 3.2.4)

インストール先環境

cat /etc/centos-release

CentOS Linux release 7.2.1511 (Core) 

redis-3.2.4のインストール

yum install gcc tcl readline-devel
cd /usr/local/src
curl -O http://download.redis.io/releases/redis-3.2.4.tar.gz
tar xvzf redis-3.2.4.tar.gz
cd redis-3.2.4
make
make test
make install

インストールが無事完了しました。

redisの起動設定

  • confファイルの設定

tarでインストールさせると、redis.confが指定場所にいないので、手動でファイルを設定

mkdir /etc/redis/
cp redis.conf /etc/redis/
  • confに最低限の設定だけ反映
vim /etc/redis/redis.conf
> デーモンモードの変更
daemonize no → daemonize yes

> ログ出力先の変更
logfile "" → logfile "/var/log/redis.log" 

redis起動

/usr/local/bin/redis-server /etc/redis/redis.conf

疎通確認

起動していることを確認

redis-cli ping
PONG

.serviceファイルを作成

起動するときに、上記コマンドを打つのは面倒なので、.serviceファイルを作成する

vim /etc/systemd/system/redis.service
[Service]
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

起動チェック

systemctl start redis.service

まとめ

最新版のredis(3.2.4)のインストールに成功

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1