笔记:在CentOS 5.8中通过yum安装Redis
2014-04-27 15:34
525 查看
1、导入epel yum源:
32位机器:rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
65位机器:rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
2、yum安装:
yum -y install redis
3、添加到自动启动项:
chkconfig redis on
4、启动:
service redis start
5、配置文件:
/etc/redis.conf
6、测试:
redis-cli
set myKey myValue
get myKey
启动脚本
#!/bin/bash
#
# redis Startup script for redis processes
#
# author: snowolf
#
# processname: redis
redis_path="/usr/local/bin/redis-server"
redis_conf="/etc/redis/redis.conf"
redis_pid="/var/run/redis.pid"
# Source function library.
. /etc/rc.d/init.d/functions
[ -x $redis_path ] || exit 0
RETVAL=0
prog="redis"
# Start daemons.
start() {
if [ -e $redis_pid -a ! -z $redis_pid ];then
echo $prog" already running...."
exit 1
fi
echo -n $"Starting $prog "
# Single instance for all caches
$redis_path $redis_conf
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
return $RETVAL
}
# Stop daemons.
stop() {
echo -n $"Stopping $prog "
killproc -d 10 $redis_path
echo
[ $RETVAL = 0 ] && rm -f $redis_pid /var/lock/subsys/$prog
RETVAL=$?
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof redis`" != x; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL
转:http://snowolf.iteye.com/blog/1630697
32位机器:rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
65位机器:rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
2、yum安装:
yum -y install redis
3、添加到自动启动项:
chkconfig redis on
4、启动:
service redis start
5、配置文件:
/etc/redis.conf
6、测试:
redis-cli
set myKey myValue
get myKey
启动脚本
#!/bin/bash
#
# redis Startup script for redis processes
#
# author: snowolf
#
# processname: redis
redis_path="/usr/local/bin/redis-server"
redis_conf="/etc/redis/redis.conf"
redis_pid="/var/run/redis.pid"
# Source function library.
. /etc/rc.d/init.d/functions
[ -x $redis_path ] || exit 0
RETVAL=0
prog="redis"
# Start daemons.
start() {
if [ -e $redis_pid -a ! -z $redis_pid ];then
echo $prog" already running...."
exit 1
fi
echo -n $"Starting $prog "
# Single instance for all caches
$redis_path $redis_conf
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
return $RETVAL
}
# Stop daemons.
stop() {
echo -n $"Stopping $prog "
killproc -d 10 $redis_path
echo
[ $RETVAL = 0 ] && rm -f $redis_pid /var/lock/subsys/$prog
RETVAL=$?
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof redis`" != x; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL
转:http://snowolf.iteye.com/blog/1630697
相关文章推荐
- CentOS 下通过yum安装MongoDB记录
- CentOS 6.5通过yum安装 MySQL-5.5
- CentOS 6通过yum安装gcc 4.9 5.2等高版本gcc
- CentOS 5.5通过yum安装 Memcached的步骤、问题、及解决办法
- 在centos6.3用yum安装redis
- Centos 7下使用yum安装redis
- CentOS7 通过YUM安装MySQL5.7
- CentOS 7 通过 yum 安装 nodejs 和 npm
- centos 7 上通过 yum 安装 mysql 5.7
- CentOS7.4 通过yum安装php7.0
- Centos6.8通过yum安装mysql5.7
- CentOS 安装 Redis 和 php redis.so 扩展笔记
- Centos7通过yum安装最新MySQL
- CentOS 7通过yum安装fcitx五笔输入法
- CentOS 上通过 yum 快速安装最新版 Transmission
- 如何解决在Centos上面用yum不能安装redis
- Centos 5.8 安装KVM虚拟机学习笔记
- centos7通过yum安装JDK1.8
- centOS 6通过yum安装php-mssql以使php支持microsoft sql server连接
- centos7 通过yum安装redis