1、下载
查看版本http://download.redis.io/releases/
make失败,是系统中还未安装gcc,那么需要安装gcc
[img]http://dl2.iteye.com/upload/attachment/0102/3941/135df476-8569-3450-8fc5-57ba93394503.jpg[/img]
提示以下信息
[img]http://dl2.iteye.com/upload/attachment/0102/3963/76d39ea2-a645-306c-b4df-f891856eb81d.jpg[/img]
如果报如下错误
[img]http://dl2.iteye.com/upload/attachment/0103/5320/1626fc6f-f9a7-3328-83ea-fc849379107f.jpg[/img]
3、启动Redis服务
[img]http://dl2.iteye.com/upload/attachment/0102/3965/e2a34eb1-65d7-3ba8-a41d-45d2b94c953f.jpg[/img]
[img]http://dl2.iteye.com/upload/attachment/0102/3967/19ea3db5-aa37-31e3-9ae4-28853c8f7efa.jpg[/img]
========================================centos====
报错
原因
http://www.phperz.com/article/14/1219/42002.html
解决
随机启动
cd ~/ide
touch redis
设置为开机自启动
查看版本http://download.redis.io/releases/
wget http://download.redis.io/releases/redis-2.8.9.tar.gz
$ sudo tar xzf redis-2.8.9.tar.gz -C /usr/local
$ sudo mv redis-2.8.9 redis
make失败,是系统中还未安装gcc,那么需要安装gcc
[img]http://dl2.iteye.com/upload/attachment/0102/3941/135df476-8569-3450-8fc5-57ba93394503.jpg[/img]
sudo apt-get install gcc libc6-dev build-essential
cd /usr/local/redis
sudo make
sudo make test
提示以下信息
[img]http://dl2.iteye.com/upload/attachment/0102/3963/76d39ea2-a645-306c-b4df-f891856eb81d.jpg[/img]
sudo 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
#进入redis目录
cd /usr/local/redis
sudo make test
安装成功进入/usr/local/redis/bin可以看到
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server
如果报如下错误
[img]http://dl2.iteye.com/upload/attachment/0103/5320/1626fc6f-f9a7-3328-83ea-fc849379107f.jpg[/img]
make MALLOC=libc
3、启动Redis服务
find / -name 'redis*'
[img]http://dl2.iteye.com/upload/attachment/0102/3965/e2a34eb1-65d7-3ba8-a41d-45d2b94c953f.jpg[/img]
/usr/local/bin/redis-server
[img]http://dl2.iteye.com/upload/attachment/0102/3967/19ea3db5-aa37-31e3-9ae4-28853c8f7efa.jpg[/img]
========================================centos====
yum -y install gcc
make
报错
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
原因
http://www.phperz.com/article/14/1219/42002.html
解决
make MALLOC=libc
随机启动
cd ~/ide
touch redis
#!/bin/sh
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
#
PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=6379
EXEC=/usr/local/bin/redis-server
REDIS_CLI=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis.pid
CONF="/root/ide/redis-2.8.6/redis.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
if [ "$?"="0" ]
then
echo "Redis is running..."
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$REDIS_CLI -p $REDISPORT SHUTDOWN
while [ -x ${PIDFILE} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2
exit 1
esac
##############################
设置为开机自启动
cp ~/ide/redis /etc/init.d/redis
chkconfig redisd on