Redis website Address: http://www.redis.io/
Latest Version: 2.8.3
It is very easy to install Redis under Linux, as described in the following steps (official website):
1, download the source code, unzip and compile the source code.
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz$ tar xzf redis-2.8.3. tar.gz$ CD Redis-2.8.3$ Make
(a) If an error occurs:/BIN/SH:CC: Command not found
Description does not have GCC installed
Workaround: $ yum-y Install gcc automake autoconf libtool make
Reference: http://1984chenkailing.blog.163.com/blog/static/20637543201362192512595/
(b) If an error: zmalloc.h:50:31: Fatal error: jemalloc/jemalloc.h: no file or directory
FIX: [[email protected] redis-2.8.3]# make MALLOC=LIBC
Reference: http://www.zhixing123.cn/ubuntu/50669.html
2, after the completion of the compilation, in the SRC directory, there are four executable files Redis-server, Redis-benchmark, Redis-cli and redis.conf. And then copy it to a directory.
Mkdir/usr/redis
CP Redis-server/usr/redis
CP Redis-benchmark/usr/redis
CP Redis-cli/usr/redis
CP Redis.conf/usr/redis (this redis.conf under redis-2.8.3)
Cd/usr/redis
3. Start Redis service.
$ redis-server redis.conf
4, then use the client to test whether to start successfully.
$ redis-cli
Redis> set Foo Bar
Ok
Redis> get foo
"Bar"
If the installation process occurs (refer to: http://blog.csdn.net/luyee2010/article/details/18766911)
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
sudo tar xzvf tcl8.6.1-src.tar.gz-c/usr/local/
cd/usr/local/tcl8.6.1/unix/
sudo./configure
sudo make
sudo make install
[HTML] view Plaincopy
- 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  &NBSP
- generates  &NBSP after the install #执行完make,
- #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 Linux installation