欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

redis安装(linux)

程序员文章站 2022-05-02 11:32:48
redis安装 1. 安装tcl cd /usr/local wget http://downloads.sourceforge.net/tcl/tcl8.6.1 src.tar.gz tar xzvf tcl8.6.1 src.tar.gz cd /usr/local/tcl8.6.1/unix/ ......

redis安装

1. 安装tcl

# cd /usr/local
# wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
# tar -xzvf tcl8.6.1-src.tar.gz
# cd  /usr/local/tcl8.6.1/unix/
# ./configure  
# make && make install

2.安装redis

上传redis-3.2.8.tar.gz至/usr/local/目录下

# cd /usr/local/
# tar -zxvf redis-3.2.8.tar.gz
# cd redis-3.2.8
# make && make test 
# make install

配置redis

# cp /usr/local/redis-3.2.8/utils/redis_init_script /etc/init.d
# mv /etc/init.d/redis_init_script /etc/init.d/redis_6379
# vi /etc/init.d/redis_6379
    ## 修改
    redisport=6379
    ## 添加两行注释设置开机启动
    # chkconfig:   2345 90 10
    # description:  redis is a persistent key-value database
# chmod 777 /etc/init.d/redis_6379
# chkconfig redis_6379 on

# mkdir -p /etc/redis          ## 存放redis配置文件
# mkdir -p /var/redis/6379     ## 存放redis持久化文件

# cp /usr/local/redis-3.2.8/redis.conf  /etc/redis
# mv /etc/redis/redis.conf /etc/redis/6379.conf
# vi /etc/redis/6379.conf
    ## 修改
    daemonize   yes
    pidfile     /var/run/redis_6379.pid
    port        6379
    dir         /var/redis/6379

启动redis

# cd /etc/init.d
# ./redis_6379 start

确认redis进程是否启动

# ps -ef | grep redis