Skip to content

Instantly share code, notes, and snippets.

@violetyk
Last active December 20, 2015 02:59
Show Gist options
  • Save violetyk/6060532 to your computer and use it in GitHub Desktop.
Save violetyk/6060532 to your computer and use it in GitHub Desktop.

RedisをCentOSにインストール

cd /usr/local/src
wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
tar xf redis-2.6.14.tar.gz
cd redis-2.6.14
make MALLOC=jemalloc
strings src/redis-server | grep jemalloc
paco -D make install PREFIX=/usr/local/redis-2.6.14
paco -au

vi /etc/profile.d/redis.sh 
PATH=$PATH:/usr/local/redis-2.6.14/bin
export PATH

source /etc/profile.d/redis.sh

cd /usr/local/src/redis-2.6.14/utils/
./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server


Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/redis-2.6.14/bin/redis-server]
s#^port [0-9]{4}$#port 6379#;s#^logfile .+$#logfile /var/log/redis_6379.log#;s#^dir .+$#dir /var/lib/redis/6379#;s#^pidfile .+$#pidfile /var/run/redis_6379.pid#;s#^daemonize no$#daemonize yes#;
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
./install_server.sh: line 178: update-rc.d: コマンドが見つかりません
 exists, process is already running or crashed
 Installation successful!

起動スクリプトの改行コードがバグってるので修正

sed -i -e 's/\\n/\n /g' /etc/init.d/redis_6379

起動して確認

/etc/init.d/redis_6379 start

redis-cli PING
PONG

PECL redis

pecl install redis

vi php.ini
extension=redis.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment