1.打开xshell连接linux虚拟机,登陆root账号。
2.安装gcc,因为redis是c++编写的。命令:yum -y install gcc-c++
3.wget方式下载redis压缩包,并解压和编译。
在xshell输入命令:wget http://download.redis.io/releases/redis-3.2.11.tar.gz
或者 yum -y install wget http://download.redis.io/releases/redis-3.2.11.tar.gz
查看下文件所在路径
命令:ll
查看进程:ps aux|grep yum
关掉yum进程:rm -r /var/run/yum.pid
解压:tar -zxvf [压缩包名称]
4.编译
编译:cd redis-3.2.11
进入目录,make 编译
5.
[root@localhost ~]# cd redis-3.2.11
[root@localhost redis-3.2.11]# ll
total 212
-rw-rw-r--. 1 root root 92766 Sep 21 07:20 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 Sep 21 07:20 BUGS
-rw-rw-r--. 1 root root 1805 Sep 21 07:20 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 Sep 21 07:20 COPYING
drwxrwxr-x. 7 root root 4096 Sep 21 07:20 deps
-rw-rw-r--. 1 root root 11 Sep 21 07:20 INSTALL
-rw-rw-r--. 1 root root 151 Sep 21 07:20 Makefile
-rw-rw-r--. 1 root root 4223 Sep 21 07:20 MANIFESTO
-rw-rw-r--. 1 root root 6834 Sep 21 07:20 README.md
-rw-rw-r--. 1 root root 46695 Sep 21 07:20 redis.conf
-rwxrwxr-x. 1 root root 271 Sep 21 07:20 runtest
-rwxrwxr-x. 1 root root 280 Sep 21 07:20 runtest-cluster
-rwxrwxr-x. 1 root root 281 Sep 21 07:20 runtest-sentinel
-rw-rw-r--. 1 root root 7606 Sep 21 07:20 sentinel.conf
drwxrwxr-x. 2 root root 4096 Sep 21 07:20 src
drwxrwxr-x. 10 root root 4096 Sep 21 07:20 tests
drwxrwxr-x. 7 root root 4096 Sep 21 07:20 utils
[root@localhost redis-3.2.11]# make
cd src && make all
make[1]: Entering directory `/root/redis-3.2.11/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
(cd ../deps && make distclean)
make[2]: Entering directory `/root/redis-3.2.11/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/root/redis-3.2.11/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W >> .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 -O2 -g -ggdb -I../deps/geohash-int -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 geohash-int jemalloc)
make[2]: Entering directory `/root/redis-3.2.11/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd geohash-int && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/root/redis-3.2.11/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
cc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
make[3]: Leaving directory `/root/redis-3.2.11/deps/hiredis'
MAKE linenoise
cd linenoise && make
make[3]: Entering directory `/root/redis-3.2.11/deps/linenoise'
cc -Wall -Os -g -c linenoise.c
make[3]: Leaving directory `/root/redis-3.2.11/deps/linenoise'
MAKE lua
cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' " MYLDFLAGS="" AR="ar rcu"
make[3]: Entering directory `/root/redis-3.2.11/deps/lua/src'
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lapi.o lapi.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lcode.o lcode.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldebug.o ldebug.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldo.o ldo.c
ldo.c: In function ‘f_parser’:
ldo.c:496:7: warning: unused variable ‘c’ [-Wunused-variable]
int c = luaZ_lookahead(p->z);
^
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o ldump.o ldump.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lfunc.o lfunc.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lgc.o lgc.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o llex.o llex.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lmem.o lmem.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lobject.o lobject.c
cc -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -c -o lop
linux上安装redis(单机版)
最新推荐文章于 2023-05-12 21:20:24 发布