xxx centos install redis

安装支持环境

tcl 官网

  • tcl
    yum install -y tcl or
cd /opt/apps
wget https://downloads.sourceforge.net/tcl/tcl8.6.9-src.tar.gz
tar -zxvf tcl8.6.9-src.tar.gz
cd ​tcl8.6.9/unix/
./configure
make
make install
  • gcc
yum install gcc-c++

yum

yum install redis

启动

[root@localhost ~]# service redis start
Redirecting to /bin/systemctl start redis.service

方式一
service redis start
systemctl start redis.service --开启redis服务
方式二
redis-server /etc/redis.conf

ps -ef | grep redis -- 查看redis是否开启

[root@localhost ~]# systemctl start redis.service
[root@localhost ~]# ps -ef|grep redis
redis     5024     1  0 07:58 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379
root      5054  4497  0 08:00 pts/0    00:00:00 grep --color=auto redis

编译安装

$ apt install gcc tcl
$ cd /opt/apps/
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make or
$ make PREFIX=/usr/local/redis install
$ cd src & make test

单核运行make test : taskset -c 1 sudo make test

默认会安装到 /usr/local/bin 下

设置开机自动启动

vim /etc/init.d/redis 
#!/bin/sh
#
# redis        Startup script for Redis Server
#
# chkconfig: - 80 12
# description: Redis is an open source, advanced key-value store.
#
# processname: redis-server
# config: /etc/redis.conf
# pidfile: /var/run/redis.pid
source /etc/init.d/functions
BIN="/usr/local/redis/bin"
CONFIG="/usr/local/redis/redis.conf"
PIDFILE="/var/run/redis.pid"
### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
RETVAL=0
prog="redis-server"
desc="Redis Server"
start() {
        if [ -e $PIDFILE ];then
             echo "$desc already running...."
             exit 1
        fi
        echo -n $"Starting $desc: "
        daemon $BIN/$prog $CONFIG
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}
stop() {
        echo -n $"Stop $desc: "
        killproc $prog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE
        return $RETVAL
}
restart() {
        stop
        start
}
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        [ -e /var/lock/subsys/$prog ] && restart
        RETVAL=$?
        ;;
  status)
        status $prog
        RETVAL=$?
        ;;
   *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        RETVAL=1
esac
exit $RETVAL
  • 启动或关闭服务
service redis start
service redis stop

CentOS 6.6 安装 Redis 记录

  • qq_43638135
    妲己再美究为妃: 博主没有想过自己接一些私活干吗?我现在还没毕业,但是我也确实听说外挂市场自动化游戏脚本市场挺火热的,并且报酬也很丰厚,但是具体的我也不是很清楚,求解答。 (1个月前 #47楼) 查看回复(2) 举报 回复
    22