Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active December 29, 2015 12:49
Show Gist options
  • Save tkuchiki/7673040 to your computer and use it in GitHub Desktop.
Save tkuchiki/7673040 to your computer and use it in GitHub Desktop.
redis rpm
VERSION=2.8.1
TMP_DIR=/tmp
REDIS_DIR=redis-$VERSION
REDIS_SRC=$REDIS_DIR.tar.gz
RPM_BUILD_DIR=$HOME/rpmbuild
RPM_BUILD_SOURCES=$RPM_BUILD_DIR/SOURCES
REDIS_SPEC=$RPM_BUILD_DIR/SPECS/redis.spec
REDIS_LOGROTATE=$RPM_BUILD_SOURCES/redis.logrotate
REDIS_INIT=$RPM_BUILD_SOURCES/redis.init
yum install -y tcl tcl-devel
curl https://gist.github.com/tkuchiki/7674158/raw/4617f615cea910ea4d449da7fa78ec99528d5294/template_redis.spec -o $REDIS_SPEC
curl https://gist.github.com/tkuchiki/7674158/raw/faa2323725fff2bd522ed625cd6efab2282d88e9/redis.logrotate -o $REDIS_LOGROTATE
curl https://gist.github.com/tkuchiki/7674158/raw/5d3380a14136588fd9f2e3131679d681eb732783/redis.init -o $REDIS_INIT
cd $TMP_DIR
curl http://download.redis.io/releases/$REDIS_SRC -O
tar zxvf $REDIS_SRC
cd $REDIS_DIR
sed -i -e "s/^\(daemonize\) \(.\+\)/\1 yes/" redis.conf
sed -i -e "s|\(pidfile\) \(.\+\)|\1 /var/run/redis/redis.pid|" redis.conf
sed -i "/bind 127.0.0.1/a\bind 127.0.0.1" redis.conf
sed -i -e "s|\(logfile\) \(.\+\)|\1 /var/log/redis/redis.log|" redis.conf
sed -i -e "s|\(dir\) ./|\1 /var/lib/redis|" redis.conf
cd ../
tar czvf $REDIS_SRC $REDIS_DIR
mv $REDIS_SRC $HOME/rpmbuild/SOURCES/
sed -i -e "s/__VERSION__/$VERSION/" $REDIS_SPEC
rpmbuild -ba $REDIS_SPEC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment