1 下载安装包
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
2 解压
tar xzf redis-3.2.3.tar.gz
3 移动
cp redis-3.2.3 /usr/local/redis-3.2.3
4 进入主目录
cd /usr/local/redis-3.2.3
5 编译
make
6创建安装目录
mkdir /usr/local/redis
7安装
make PREFIX=/usr/local/redis install
8设置环境变量
vi ~/.bash_profile
确保加上了/usr/local/redis/bin:
PATH=/usr/local/redis/bin:$PATH:$HOME/bin
9立即生效环境变量设置
source ~/.bash_profile
10切换到安装包目录utils文件夹
cd /usr/local/redis-3.2.3/utils
11执行安装设置
[root@192 utils]# ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] /usr/local/redis/conf/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] /usr/local/redis/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] /usr/local/redis/data/6379
Please select the redis executable path [] /usr/local/redis/bin/redis-server
Selected config:
Port : 6379
Config file : /usr/local/redis/conf/6379.conf
Log file : /usr/local/redis/log/redis_6379.log
Data dir : /usr/local/redis/data/6379
Executable : /usr/local/redis/bin/redis-server
Cli Executable : /usr/local/redis/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
12 测试,终端输入如下命令测试
redis-cli
13 允许远程访问,打开 /usr/local/redis/conf/6379.conf 注掉bind 127.0.0.1 并保存
# bind 127.0.0.1
如果您觉得我的文章给了您帮助,请为我买一杯饮料吧!我将非常感激并坚持为大家提供更多帮助!