5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Centos7.2にRedis3.2.4をインストールしてサービス化

Posted at

redisのインストール

sudo yum install redisするも、バージョンが「2.8.19-2.el7」と古そうなので、公式から取得する。

公式サイト

$ wget http://download.redis.io/releases/redis-3.2.4.tar.gz
$ tar xzf redis-3.2.4.tar.gz
$ cd redis-3.2.4
$ make

make[3]: gcc: コマンドが見つかりませんでしたと出たので、gccをインストールして全部削除してやり直し。

$ sudo yum install -y  gcc
$ cd ..
$ rm -Rf redis-3.2.4
$ make
$ sudo make install
$ redis-cli -v
redis-cli 3.2.4
$ redis-server -v
Redis server v=3.2.4 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=3f3e7c3156555dd9

インストール完了

redisのサービス化

$ sudo vim /etc/systemd/system/redis.service

redis.service
[Unit]
Description = redis daemon

[Service]
ExecStart = /usr/local/bin/redis-server
Restart = always
Type = simple

[Install]
WantedBy = multi-user.target

サーバー稼働

$ sudo systemctl enable redis
$ sudo systemctl start redis
$ sudo systemctl status redis
[sudo] password for xxx: 
● redis.service - redis daemon
   Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)
   Active: active (running) since 月 2016-10-17 10:54:17 JST; 12min ago
 Main PID: 8762 (redis-server)
   CGroup: /system.slice/redis.service
           └─8762 /usr/local/bin/redis-server *:6379

動作確認確認

$ redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379> 

うごいた

参考

5
4
0

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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?