++++++++++++++++++++++++++++++++++++++++++++++
Redis and Phpredis extended installation under Linux
++++++++++++++++++++++++++++++++++++++++++++++
Operating system: [CentOS6.0]
Redis: [redis-2.4.3]
Phpredis: [phpredis-2.1.0]
++++++++++++++++++++++++++++++++++++++++++++++
Preparing to install the software (download)
1> [Redis]
Http://redis.googlecode.com/files/redis-2.4.3.tar.gz
2> [Phpredis]
Https://github.com/owlient/phpredis/tarball/master
++++++++++++++++++++++++++++++++++++++++++++++
1> "Installing Redis server"
[HTML]View Plaincopy
- TAR-ZXVF redis-2.4.3.tar.gz
- Cp-r Redis-2.4.3/usr/local/redis
- Cd/usr/local/redis
- Make
- Make install
- CP redis.conf/etc/
- #修改redis. conf
- Vi/etc/redis.conf
- #查找daemonize no change to
- #以守护进程方式运行
- Daemonize Yes
- #修改dir./is an absolute path,
- #默认的话redis-server is generated or read Dump.rdb in the current directory when it starts
- #所以如果在根目录下执行redis-server/etc/redis.conf's words,
- #读取的是根目录下的dump. RDB, in order for the Redis-server to be executed in any directory
- #所以此处将dir改为绝对路径
- Dir/usr/local/redis
- #修改appendonly为yes
- #指定是否在每次更新操作后进行日志记录,
- #Redis在默认情况下是异步的把数据写入磁盘,
- #如果不开启, it may result in loss of data over a period of time when power is lost.
- #因为 the Redis itself synchronizes data files by the save conditions above,
- #所以有的数据会在一段时间内只存在于内存中. Default is No
- AppendOnly Yes
- #将redis添加到自启动中
- echo "/usr/local/bin/redis-server/etc/redis.conf" >>/etc/rc.d/rc.local
- #启动redis
- Redis-server/etc/redis.conf
- #查看redis是否己启动
- Ps-ef | grep Redis
2> "Open Redis port"
[HTML]View Plaincopy
- #关闭防火墙
- Service Iptables Stop
- Vi/etc/sysconfig/iptables
- #添加
- -A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT
- #重启防火墙
- Service Iptables Restart
3> "Installing Phpredis extensions"
[HTML]View Plaincopy
- TAR-ZXVF owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
- CD OWLIENT-PHPREDIS-90ECD17
- /usr/local/php/bin/phpize
- ./configure --with-php-config=/usr/local/php/bin/php-config
- Make
- Make install
- #执行完make Install will generate
- #Installing Shared extensions:/usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/
- #修改php. ini
- Vi/usr/local/php/etc/php.ini
- #查找extension_dir, modified to
- Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
- #添加redis
- Extension = redis.so
- #重启apache
- Service httpd Restart
Redis and Phpredis extended installation under Linux