redis安裝(linux)

xianrui1993發表於2019-01-05

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

相關文章