linux安装redis软件

首先安装linux的redis先到redis的官方网站上面下载redis版本

https://redis.io/

然后下载到了redis-4.0.11.tar.gz,将这个包放在/opt的目录下面,大家可以按照自己的喜好放。小编习惯放在/opt目录下面,然后将redis包解压。使用命令tar -zxvf redis-4.0.11.tar.gz

tar -zxvf redis-4.0.11.tar.gz 

使用ll命令查看信息

[root@localhost opt]# ll
total 1708
drwxrwxr-x  6 root root    4096 Aug  3 18:44 redis-4.0.11
-rw-r--r--  1 root root 1739656 Sep 14 06:52 redis-4.0.11.tar.gz
drwxr-xr-x. 2 root root    4096 Nov 22  2013 rh

然后,我们进入到redis目录里面使用make命令进行编译,出现错误,错误提示没有安装gcc,于是我们来安装gcc

make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/opt/redis-4.0.11/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/opt/redis-4.0.11/deps'
make[1]: [persist-settings] Error 2 (ignored)
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/opt/redis-4.0.11/src'
make: *** [all] Error 2

使用以下的命令安装gcc

yum install gcc
yum install gcc-c++ libstdc++-devel

安装成功以后,可以使用gcc -v来检验是否安装成功,看见版本号,则安装成功

[root@localhost redis-4.0.11]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) 

我们回到刚才的redis目录,使用make编译,发现出错,原因是因为刚才错误编译留下的一些问题,我们使用make distclean进行清理,之后再进行make命令。

[root@localhost redis-4.0.11]# make
cd src && make all
make[1]: Entering directory `/opt/redis-4.0.11/src'
    CC Makefile.dep
make[1]: Leaving directory `/opt/redis-4.0.11/src'
make[1]: Entering directory `/opt/redis-4.0.11/src'
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/opt/redis-4.0.11/src'
make: *** [all] Error 2
[root@localhost src]# make distclean
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[1]: Entering directory `/opt/redis-4.0.11/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
(rm -f .make-*)
make[1]: Leaving directory `/opt/redis-4.0.11/deps'
(rm -f .make-*)

看到下面的提示,说明编译成功

Hint: It's a good idea to run 'make test' ;)

使用make install安装

[root@localhost src]# make install
    CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install

我们来看一下安装完成的redis,进入到/usr/local/bin目录下面

[root@localhost bin]# cd /usr/local/bin/
[root@localhost bin]# ll
total 35492
-rwxr-xr-x 1 root root 5597926 Sep 14 07:10 redis-benchmark
-rwxr-xr-x 1 root root 8331464 Sep 14 07:10 redis-check-aof
-rwxr-xr-x 1 root root 8331464 Sep 14 07:10 redis-check-rdb
-rwxr-xr-x 1 root root 5738274 Sep 14 07:10 redis-cli
lrwxrwxrwx 1 root root      12 Sep 14 07:10 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8331464 Sep 14 07:10 redis-server

版权声明: 原创文章,如需转载,请注明出处。 https://blog.csdn.net/lwx356481/article/details/82699320

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值