環境
Hardware: amazon ec2 (t1.micro)
Memory: 613MB
DomU: NetBSD 6.0 BETA2
redis: 2.4.15
NetBSD pkgにはないようなのでソースをダウンロードしてコンパイルします。
redisの2.4ブランチの最新コードを取得します。
NetBSDでコンパイルを通るようにするための差分は
https://github.com/yellowback/redis/commit/27daf44d687b01ec7041beaec8d4f962af61363a.patch です。
$ cd /tmp
$ git clone -b 2.4 https://github.com/antirez/redis.git
$ wget https://github.com/yellowback/redis/commit/27daf44d687b01ec7041beaec8d4f962af61363a.patch
$ cd redis
$ patch -s -p1 < /tmp/27daf44d687b01ec7041beaec8d4f962af61363a.patch
$ gmake
コンパイルエラーがないことを確認してredisを起動します。
$ cd /tmp/redis
$ ./src/redis-server redis.conf
起動できれば いったんCtrl-Cで終了します。
適当な場所にバイナリ等をコピーします。
$ su
# cp redis.conf /usr/pkg/etc/redis.conf
(/usr/pkg/etc/redis.confを編集しdaemonize yes とします)
# cp src/redis-server /usr/pkg/sbin/
/etc/rc.d/redis を以下のように作成します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh
#
# $NetBSD: $
#
# PROVIDE: redis
# REQUIRE: DAEMON
. /etc/rc.subr
name="redis"
rcvar=${name}
command="/usr/pkg/sbin/redis-server"
required_files="/usr/pkg/etc/${name}.conf"
command_args=" ${required_files}"
pidfile="/var/run/${name}.pid"
extra_commands="reload"
load_rc_config $name
run_rc_command "$1"
/etc/rc.confにredis=YESを追加します。
# /etc/rc.d/redis start
redis-serverが動作していることを確認して終了です。