AMH 社区首页
AMH社区 - 开放自由有价值的社区
[求助帖] centOS上安装redis |
|
---|---|
muaty |
muaty 发表于 2015-01-12 21:46:34
最近要装程序,发现该程序要求必须用redis 瞬间就蛋疼了,本来想偷懒呢,结果发现AMH没上架!!
各种找教程什么的 都没成功,折腾一天,贴下成功的结果~ 1.安装tcl支持 yum install tcl 2.安装redis我们以最新的2.8.9为例$ wget http://download.redis.io/releases/redis-2.8.9.tar.gz 测试通过后安装,安装后会自动把redis-server,redis-cli,redis-benchmark,redis-check-aof,redis-check-dump复制到/usr/local/bin目录下。$ tar xzf redis-2.8.9.tar.gz $ cd redis-2.8.9 $ make $ make test $ make install 编辑redis.conf文件 vi redis.conf 修改daemonize no改成yes。我们手动复制redis.conf到/etc目录下cp redis.conf /etc 编写自init.d脚本。########################### 不会用vi编辑的可以通过winscp等一些支持SSH登陆的FTP工具上传到/etc/init.d/目录下修改权限,可以运行#chkconfig: 2345 10 90 #description: Start and Stop redis 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="/etc/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 ############################## chmod +x /etc/init.d/redis 设置开机自动启动服务sudo chkconfig redis on 启动服务:service redis start 停止服务:service redis stop 配置防火墙打开对应的端口:vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT 重启防火墙service iptables restart 或者在AMH后台用amnetwork 工具编辑防火墙
点赞,加油! (2分)
2015-01-12 21:46:34 1
|
parker |
支持原创,您是我们学习的榜样。
回复
2015-01-12 22:14:09 2
|
sellgirl |
centos源 好像也有redis吧
回复
2015-01-12 22:46:57 3
|
kimwang |
楼主头像不错 支持
回复
2015-04-29 21:30:06 4
|