Redis Linux Installation

Source: Internet
Author: User
Tags benchmark zts iptables install redis

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

  1. Vi/etc/redis.conf
  2. #查找daemonize no change to
  3. #以守护进程方式运行
  4. Daemonize Yes
  5. #修改dir./is an absolute path,
  6. #默认的话redis-server is generated or read Dump.rdb in the current directory when it starts
  7. #所以如果在根目录下执行redis-server/etc/redis.conf's words,
  8. #读取的是根目录下的dump. RDB, in order for the Redis-server to be executed in any directory
  9. #所以此处将dir改为绝对路径
  10. Dir/usr/local/redis
  11. #修改appendonly为yes
  12. #指定是否在每次更新操作后进行日志记录,
  13. #Redis在默认情况下是异步的把数据写入磁盘,
  14. #如果不开启, it may result in loss of data over a period of time when power is lost.
  15. #因为 the Redis itself synchronizes data files by the save conditions above,
  16. #所以有的数据会在一段时间内只存在于内存中. Default is No
  17. AppendOnly Yes
  18. #将redis添加到自启动中
  19. echo "/usr/local/bin/redis-server/etc/redis.conf" >> /etc/rc.d/rc.local
  20. #启动redis
  21. Redis-server/etc/redis.conf
  22. #查看redis是否己启动
  23. Ps-ef | grep Redis

2> "Open Redis port"

[HTML] view Plaincopy

    1. #关闭防火墙
    2. Service Iptables Stop
    3. Vi/etc/sysconfig/iptables
    4. #添加
    5. -A input-m state--state new-m tcp-p TCP--dport 6379-j ACCEPT
    6. #重启防火墙
    7. Service Iptables Restart

3> "Installing Phpredis extensions"

[HTML]  view plaincopy

    1. tar -zxvf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz  
    2. cd  owlient-phpredis-90ecd17  
    3. /usr/local/php/bin/phpize  
    4. ./configure -- with-php-config=/usr/local/php/bin/php-config  
    5. make  
    6. Make install  &NBSP
    7. generates  &NBSP after the  install #执行完make,
    8. #Installing  shared extensions:      /usr/local/php//lib/php/extensions/no-debug-non-zts-20060613/  
    9. #修改php. ini  
    10. vi /usr/local/php/etc/php.ini  
    11. #查找extension_dir, modified to   
    12. extension_dir =  "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"   
    13. #添加redis   
    14. extension = redis.so  
    15. #重启apache   
    16. service httpd restart  

      Redis Linux installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.