redis服务器安装流程
创始人
2024-09-25 10:50:16
0

redis官方github,Releases · tporadowski/redis · GitHub

所有版本都有,不止windows,tar.gz就是源码版本。我下载了redis-5.0.9.tar.gz

安装步骤如下:

在Linux服务器上安装Redis,可以通过以下步骤进行:

  1. 更新包管理器索引。

  2. 安装Redis。

  3. 启动Redis服务。

  4. 设置Redis为开机自启。

以下是基于Ubuntu系统的安装步骤:

# 更新包管理器索引
sudo apt-get update
 
# 安装Redis
sudo apt-get install redis-server
 
# 启动Redis服务
sudo systemctl start redis-server
 
# 设置Redis为开机自启
sudo systemctl enable redis-server
 
# 检查Redis服务状态
sudo systemctl status redis-server

对于其他Linux发行版(如CentOS、Fedora等),可能需要使用不同的包管理器命令(如yumdnf),或者从源代码编译安装。

如果需要安装特定版本或最新的Redis,可以从Redis官网下载源码并编译安装:

# 下载Redis源码
wget http://download.redis.io/releases/redis-x.y.z.tar.gz
 
# 解压源码
tar xzf redis-x.y.z.tar.gz
 
# 进入Redis目录
cd redis-x.y.z
 
# 编译安装
make
 
# 运行安装脚本
sudo make install
 
# 启动Redis
redis-server

详细步骤:

tar xzf redis-5.0.9.tar.gz

然后进入redis509的目录,然后make,结果报错一堆,我擦,别人都是成功,

make 

【注意,只有一个命令make,下面的都是报错信息】

cd src && make all

make[1]: Entering directory '/data/xul/redis-5.0.9/src'

rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark

(cd ../deps && make distclean)

make[2]: Entering directory '/data/g/redis-5.0.9/deps'

(cd hiredis && make clean) > /dev/null || true

(cd linenoise && make clean) > /dev/null || true

(cd lua && make clean) > /dev/null || true

(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true

/bin/sh: 1: cd: can't cd to jemalloc

(rm -f .make-*)

make[2]: Leaving directory '/data/xu/redis-5.0.9/deps'

(rm -f .make-*)

echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings

echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings

echo OPT=-O2 >> .make-settings

echo MALLOC=jemalloc >> .make-settings

echo CFLAGS= >> .make-settings

echo LDFLAGS= >> .make-settings

echo REDIS_CFLAGS= >> .make-settings

echo REDIS_LDFLAGS= >> .make-settings

echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings

echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings

(cd ../deps && make hiredis linenoise lua jemalloc)

make[2]: Entering directory '/data/x/redis-5.0.9/deps'

(cd hiredis && make clean) > /dev/null || true

(cd linenoise && make clean) > /dev/null || true

(cd lua && make clean) > /dev/null || true

(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true

/bin/sh: 1: cd: can't cd to jemalloc

(rm -f .make-*)

(echo "" > .make-cflags)

(echo "" > .make-ldflags)

MAKE hiredis

cd hiredis && make static

make[3]: Entering directory '/data/x/redis-5.0.9/deps/hiredis'

cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c

In file included from hiredis.h:36,

                 from net.h:38,

                 from net.c:60:

read.h:78:50: error: unknown type name ‘PORT_LONGLONG’

   78 |     void *(*createInteger)(const redisReadTask*, PORT_LONGLONG);

      |                                                  ^~~~~~~~~~~~~

In file included from hiredis.h:45,

                 from net.h:38,

                 from net.c:60:

sds.h:295:21: error: unknown type name ‘PORT_LONGLONG’

  295 | sds sdsfromlonglong(PORT_LONGLONG value);

      |                     ^~~~~~~~~~~~~

In file included from net.h:38,

                 from net.c:60:

hiredis.h:119:5: error: unknown type name ‘PORT_LONGLONG’

  119 |     PORT_LONGLONG integer; /* The integer when type is REDIS_REPLY_INTEGER */

      |     ^~~~~~~~~~~~~

net.c:212:53: error: unknown type name ‘PORT_LONG’

  212 | static int redisContextTimeoutMsec(redisContext *c, PORT_LONG *result)

      |                                                     ^~~~~~~~~

net.c:235:51: error: unknown type name ‘PORT_LONG’

  235 | static int redisContextWaitReady(redisContext *c, PORT_LONG msec) {

      |                                                   ^~~~~~~~~

net.c: In function ‘_redisContextConnectTcp’:

net.c:337:2: error: unknown type name ‘PORT_LONG’

  337 |  PORT_LONG timeout_msec = -1;

      |  ^~~~~~~~~

net.c:352:4: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]

  352 |    free(c->tcp.host);

      |    ^~~~

net.c:352:4: warning: incompatible implicit declaration of built-in function ‘free’

net.c:61:1: note: include ‘’ or provide a declaration of ‘free’

   60 | #include "net.h"

  +++ |+#include

   61 | #include "sds.h"

net.c:360:18: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]

  360 |     c->timeout = malloc(sizeof(struct timeval));

      |                  ^~~~~~

net.c:360:18: warning: incompatible implicit declaration of built-in function ‘malloc’

net.c:360:18: note: include ‘’ or provide a declaration of ‘malloc’

net.c:367:4: warning: incompatible implicit declaration of built-in function ‘free’

  367 |    free(c->timeout);

      |    ^~~~

net.c:367:4: note: include ‘’ or provide a declaration of ‘free’

net.c:371:6: warning: implicit declaration of function ‘redisContextTimeoutMsec’; did you mean ‘redisContextSetTimeout’? [-Wimplicit-function-declaration]

  371 |  if (redisContextTimeoutMsec(c, &timeout_msec) != REDIS_OK) {

      |      ^~~~~~~~~~~~~~~~~~~~~~~

      |      redisContextSetTimeout

net.c:377:3: warning: incompatible implicit declaration of built-in function ‘free’

  377 |   free(c->tcp.source_addr);

      |   ^~~~

net.c:377:3: note: include ‘’ or provide a declaration of ‘free’

net.c:381:3: warning: incompatible implicit declaration of built-in function ‘free’

  381 |   free(c->tcp.source_addr);

      |   ^~~~

net.c:381:3: note: include ‘’ or provide a declaration of ‘free’

net.c:460:9: warning: implicit declaration of function ‘redisContextWaitReady’; did you mean ‘redisContextCloseF’? [-Wimplicit-function-declaration]

  460 |     if (redisContextWaitReady(c, timeout_msec) != REDIS_OK)

      |         ^~~~~~~~~~~~~~~~~~~~~

      |         redisContextCloseFd

net.c: In function ‘redisContextConnectUnix’:

net.c:510:2: error: unknown type name ‘PORT_LONG’

  510 |  PORT_LONG timeout_msec = -1;

      |  ^~~~~~~~~

net.c:524:18: warning: incompatible implicit declaration of built-in function ‘malloc’

  524 |     c->timeout = malloc(sizeof(struct timeval));

      |                  ^~~~~~

net.c:524:18: note: include ‘’ or provide a declaration of ‘malloc’

net.c:531:4: warning: incompatible implicit declaration of built-in function ‘free’

  531 |    free(c->timeout);

      |    ^~~~

net.c:531:4: note: include ‘’ or provide a declaration of ‘free’

make[3]: *** [Makefile:118: net.o] Error 1

make[3]: Leaving directory '/data/xu/redis-5.0.9/deps/hiredis'

make[2]: *** [Makefile:46: hiredis] Error 2

make[2]: Leaving directory '/data/x/redis-5.0.9/deps'

make[1]: [Makefile:200: persist-settings] Error 2 (ignored)

    CC adlist.o

In file included from adlist.c:36:

adlist.h:56:5: error: unknown type name ‘PORT_ULONG’

   56 |     PORT_ULONG len;

      |     ^~~~~~~~~~

adlist.h:88:33: error: unknown type name ‘PORT_LONG’

   88 | listNode *listIndex(list *list, PORT_LONG index);

      |                                 ^~~~~~~~~

In file included from adlist.c:37:

zmalloc.h:55:10: fatal error: jemalloc/jemalloc.h: No such file or directory

   55 | #include

      |          ^~~~~~~~~~~~~~~~~~~~~

compilation terminated.

make[1]: *** [Makefile:248: adlist.o] Error 1

make[1]: Leaving directory '/data//redis-5.0.9/src'

make: *** [Makefile:6: all] Error 2

后来发现我是Ubuntu的系统,直接按照第一个方法即可安装成功。

● redis-server.service - Advanced key-value store

     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)

     Active: active (running) since Thu 2024-08-29 10:31:09 CST; 31s ago

       Docs: http://redis.io/documentation,

             man:redis-server(1)

   Main PID: 1396096 (redis-server)

     Status: "Ready to accept connections"

      Tasks: 5 (limit: 151631)

     Memory: 13.2M

        CPU: 36ms

     CGroup: /system.slice/redis-server.service

             └─1396096 /usr/bin/redis-server 127.0.0.1:6379

Aug 29 10:31:09 bigdata-offline-flask-service-node02-75-72 systemd[1]: Starting Advanced key-value store...

Aug 29 10:31:09 bigdata-offline-flask-service-node02-75-72 systemd[1]: Started Advanced key-value store.

相关内容

热门资讯

安卓系统为什么没网络,探究原因... 手机没网络,这可真是让人头疼的小麻烦!你有没有遇到过这种情况:手机屏幕上显示着“无网络连接”,而你明...
安卓苹果换系统安装教程,安卓与... 亲爱的手机控们,是不是觉得手机用久了,系统卡得像蜗牛爬?别急,今天就来教你怎么给安卓和苹果手机换上全...
魅族安卓系统下载软件,尽享智能... 你有没有发现,最近手机圈里又掀起了一股热潮?没错,就是魅族的新款手机!这款手机不仅外观时尚,性能强大...
平板电脑安卓系统12墨,平板电... 亲爱的读者们,你是否也和我一样,对科技新品的到来充满期待?今天,我要和你聊聊一款让人眼前一亮的新品—...
荣耀畅玩刷安卓系统,解锁更多可... 你有没有想过,你的荣耀畅玩手机,其实可以焕发第二春呢?没错,就是刷上全新的安卓系统!想象你的手机瞬间...
为什么安卓系统老是卡机,性能瓶... 手机卡顿真是让人头疼!尤其是安卓系统,有时候用着用着就突然卡住了,让人忍不住想摔手机。那么,为什么安...
哪款盒子是安卓系统,智能娱乐新... 你有没有想过,在这个智能设备横行的时代,哪款盒子是安卓系统最让人心动呢?安卓系统以其开放性和强大的兼...
安卓Q删除系统文件,安全操作与... 亲爱的安卓用户们,你是否曾在使用安卓手机时,不小心误删了重要的系统文件,心里直发慌?别担心,今天就来...
安卓12系统怎么下载谷歌,安卓... 你有没有听说安卓12系统已经发布了?是不是也想赶紧升级体验一下新系统的魅力呢?不过,别急,升级之前你...
安卓系统怎么清除后台,安卓系统... 手机后台程序太多,是不是感觉手机越来越卡?别急,今天就来教你怎么轻松清除安卓系统的后台程序,让你的手...
ios和安卓重置系统,轻松恢复... 手机用久了是不是感觉卡得要命?别急,今天就来给你揭秘如何给iOS和安卓手机来个彻底的重置,让它焕发新...
华为的手机系统与安卓,融合与创... 亲爱的读者们,你是否曾好奇过,为什么华为的手机系统能在众多安卓手机中独树一帜?今天,就让我们一起揭开...
安卓系统如何加通知声音,安卓系... 你有没有发现,手机上的通知声音有时候就像是个小闹钟,总是不请自来地提醒你各种信息。不过,有时候这个“...
安卓系统怎么锁定主屏,安卓系统... 你是不是也和我一样,手机里藏着不少小秘密,不想让别人轻易窥探呢?别急,今天就来教你怎么给安卓手机的主...
安卓系统激活提示谷歌,谷歌助你... 你刚刚入手了一台全新的安卓手机,是不是兴奋得手舞足蹈?不过,别急着高兴,激活手机之前,可别忘了谷歌的...
缤越导航安卓系统,智能出行新体... 你有没有发现,现在汽车导航系统越来越智能了?这不,缤越导航安卓系统就让我眼前一亮。想象坐在车里,手指...
安卓系统好的阅读软件,精选阅读... 你有没有发现,手机里装了那么多应用,阅读软件可是占据了我们日常使用时间的大头呢!安卓系统上的阅读软件...
统信安卓系统下载,下载与体验新... 你有没有想过,手机系统也能像换衣服一样随心所欲地换?没错,今天就要给你揭秘一个超级实用的秘密——统信...
华为新系统鸿蒙安卓,华为安卓融... 你知道吗?最近科技圈可是炸开了锅,华为的新操作系统鸿蒙系统,竟然和安卓系统来了个亲密接触!这可不是一...
安卓系统拍证件照,轻松搞定 你有没有发现,现在拍照已经成为我们生活中不可或缺的一部分?无论是记录生活点滴,还是办理各种证件,拍照...