标签:
1、下载
wget https://github.com/antirez/redis/archive/2.8.23.tar.gz
2、解压缩
tar -zxvf 2.8.23.tar.gz cd redis-2.8.23/
3、因为redis官方已经给我们配置好了,生成了makefile文件,所以我们只要make编译和安装就行了
make PREFIX=/usr/local/redis make PREFIX=/usr/local/redis install
4、将redis配置文件拷贝到redis安装目录下
cp /usr/local/src/redis-2.8.23/redis.conf ./
5、启动redis
./bin/redis-server ./redis.conf
6、查看进程
ps -aux |grep redis
7、使用redis自带客户端工具连接redis
./bin/redis-cli
8、到这里我们的redis就安装好了,接下来就是自己去学怎么使用redis
9、可以将redis作为一个init服务,但是没有必要,可以在启动文件中直接写就行了,而且在一个服务器上可能启动多个redis进程
# chkconfig: 2345 90 10 # description: Redis is a persistent key-value database PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 EXEC=/usr/local/bin/redis-server REDIS_CLI=/usr/local/bin/redis-cli PIDFILE=/var/run/redis.pid CONF="/etc/redis.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi if [ "$?"="0" ] then echo "Redis is running..." fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $REDIS_CLI -p $REDISPORT SHUTDOWN while [ -x ${PIDFILE} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1 esac
chmod +x /etc/init.d/redis chkconfig redis on chkconfig redis on chkconfig redis stop
1、安装php扩展模块都可以在php官网下载http://pecl.php.net/
wget http://pecl.php.net/get/redis-2.2.7.tgz /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make && make install #修改php配置文件 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/redis.so #重新启动php服务
标签:
原文地址:http://www.cnblogs.com/shiwenhu/p/4910515.html