ubuntu14.04源码安装redis-2.8.19
下载安装redis2.8.19的源码
$ wget http://download.redis.io/releases/redis-2.8.19.tar.gz $ tar xzf redis-2.8.19.tar.gz $ cd redis-2.8.19 $ make && make install
使用命令src/redis-server 如果显示如下就说明初步安装成功,接下来就自定一下配置
_._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.19 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 15629 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'
进入 $ cd utils 执行 $ sudo ./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] #/redis使用的默认端口 Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] /etc/redis/redis.conf #配置文件 Please select the redis log file name [/var/log/redis_6379.log] /var/log/redis/redis.log #日志文件 Please select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379 Please select the redis executable path [/usr/local/bin/redis-server] #可执行文件 Selected config: Port : 6379 Config file : /etc/redis/redis.conf Log file : /var/log/redis/redis.log Data dir : /var/lib/redis/6379 Executable : /usr/local/bin/redis-server Cli Executable : /usr/local/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...
Adding system startup for /etc/init.d/redis_6379 ...
/etc/rc0.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc1.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc6.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc2.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc3.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc4.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc5.d/S20redis_6379 -> ../init.d/redis_6379
Success!
Starting Redis server...
Installation successful!
至此,安装完后,redis就可以如同apt-get install那样方便地使用
启动
$ service redis_6379 start
停止
$ service redis_6379 stop
重启
$ service redis_6379 restart
与redis交互
$ redis-cli
或者开机redis自启
使用命令
sudo update-rc.d redis_6379