注意:搭建redis前一定要安装gcc

redis安装方式一

1.安装gcc命令:yum install -y gcc

#安装gcc
[root@localhost src]# yum install -y gcc #出现如下信息则安装成功
Installed:
gcc.x86_64 0:4.4.7-17.el6 Dependency Installed:
cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-17.el6 mpfr.x86_64 0:2.4.1-6.el6 ppl.x86_64 0:0.10.2-11.el6 Complete #查看gcc方式1
[root@localhost src]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info......
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) #查看gcc方式2
[root@localhost src]# rpm -q gcc
gcc-4.4.7-17.el6.x86_64

2.下载网址

redis官网地址:http://www.redis.io/

redis下载地址:http://download.redis.io/releases/

3.以centos6.5系统,redis3.2.4版本为例,把下载好的redis压缩包传到linxu系统中,进行解压.

[root@localhost redis]# tar zxvf redis-3.2.4.tar.gz

4.编译安装,执行命令 make

#执行命令
[root@localhost redis-3.2.4]# make #出现以下信息则表示安装完成
Hint: It's a good idea to run 'make test' ;) make[1]: Leaving directory `/usr/redis/redis-3.2.4/src'

5.启动redis

[root@localhost redis-3.2.4]# src/redis-server

6.安装出现错误情况

(1)执行make命令出现如下错误,则没有安装gcc,按照上面安装方法安装gcc

[root@localhost redis]# cd redis-3.2.4/
[root@localhost redis-3.2.4]# make
cd src && make all
sh: ./mkreleasehdr.sh: Permission denied
make[1]: Entering directory `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/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-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/redis/redis-3.2.4/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/usr/redis/redis-3.2.4/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/src'
make: *** [all] Error 2

(2)执行maker出现如下错误,则没有权限执行命令,要在 /src 目录执行授权命令:chmod 777 mkreleasehdr.sh

#1.执行make报错,则没有权限执行命令
[root@localhost redis-3.2.4]# make
cd src && make all
sh: ./mkreleasehdr.sh: Permission denied
make[1]: Entering directory `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/src'
make: *** [all] Error 2 #2.授权
[root@localhost src]# chmod 777 mkreleasehdr.sh

(3)执行make出现如下错误,则要配置变量

#1.错误信息
make[1]: Entering directory `/usr/redis/redis-3.2.4/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 `/usr/redis/redis-3.2.4/src'
make: *** [all] Error 2 #2.添加变量
[root@localhost src]# make MALLOC=libc

(4)执行 make MALLOC=libc 命令报错 或 还有其他错误,建议删除redis所有文件重新装,或者按照下面的方式安装.

redis安装方式二

1.在线下载redis(默认下载 /root 文件下)

[root@localhost ~]# wget http://download.redis.io/releases/redis-3.2.4.tar.gz

#要是出现如下错误则没有配置好linux环境变量
#bash:command not found

2.新建一个redis文件夹,移动到指定文件夹下,进行解压

#在/usr下面新建redis文件夹
[root@localhost usr]# mkdir redis
#移动文件
[root@localhost ~]# mv /root/redis-3.2.4.tar.gz /usr/redis
#解压文件
[root@localhost ~]# tar -xzvf redis-3.2.4.tar.gz

3.执行make编译

[root@localhost redis-3.2.4]# make

#出现以下信息则安装完成
Hint: It's a good idea to run 'make test' ;) make[1]: Leaving directory `/usr/redis/redis-3.2.4/src'

4.启动redis

#启动后不会在后台运行,按Ctrl+C就会停止
[root@localhost redis-3.2.4]# src/redis-server #加&符号启动后在后台运行
[root@localhost redis]# src/redis-server &

5.启动成功

6.查看redis版本号

进入redis的安装目录src下面

#方式1
[root@svr-zk src]# redis-cli -v
redis-cli 3.2.4 #方式2
[root@svr-zk src]# redis-cli --version
redis-cli 3.2.4 #方式3
[root@svr-zk src]# redis-server -v
Redis server v=3.2.4 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=54077ebb4b018819

linux系统下安装单台Redis的更多相关文章

  1. Linux系统下安装Redis和Redis集群配置

    Linux系统下安装Redis和Redis集群配置 一. 下载.安装.配置环境: 1.1.>官网下载地址: https://redis.io/download (本人下载的是3.2.8版本:re ...

  2. 在Linux系统下安装大于mysql5.5版本的数据库

    linux下mysql 5.5的安装方法: 1.安装所需要系统库相关库文件      gcc等开发包,在安装linux系统的时候安装. 2.创建mysql安装目录 # mkdir -p /usr/lo ...

  3. Linux 系统下安装 rz/sz 命令及使用说明

    Linux 系统下安装 rz/sz 命令及使用说明 rz/sz命令,实现将本地的文件上传到服务器或者从服务器上下载文件到本地,但是很多Linux系统初始并没有这两个命令,以下为安装和使用的具体步骤: ...

  4. Linux 系统下安装 python-skimage

    Linux 系统下安装 python-skimage 安装必须的依赖 // python-mumpy // python-scipy // python-matplotlib $ sudo apt-g ...

  5. Linux系统下安装Gitlab

    Linux系统下安装Gitlab 一.简介 GitLab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目.它拥有与 ...

  6. 在虚拟机的Linux系统下安装wineqq

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. 本文参考教程:http://www.ubuntukylin.com/ukylin/forum.php?mod=viewthread& ...

  7. 【linux配置】Linux系统下安装rz/sz命令以及使用说明

    Linux系统下安装rz/sz命令以及使用说明 对于经常使用Linux系统的人员来说,少不了将本地的文件上传到服务器或者从服务器上下载文件到本地,rz / sz命令很方便的帮我们实现了这个功能,但是很 ...

  8. linux系统下安装jdk,mysql,tomcat 和redis 和jedis入门案例

    Day47笔记Linux+redis入门 Day47   知识讲解:Jedis 1.Linux上jdk,mysql,tomcat安装(看着文档安装) 准备工作: 因为JDK,TOMCAT,MYSQL的 ...

  9. Linux环境下安装、配置Redis

    linux下安装redis 官网下载链接:https://redis.io/download 安装 下载redis压缩包 1.选择Stable(5.0)下的Download 5.0.0 链接进行下载 ...

随机推荐

  1. CloudStack架构分析

    Cloudstack功能 作为云计算解决方案,毫无疑问,以下几点是服务的核心关键(不限于以下几点),也作为后续开发和使用的出发点: 1. 支持多租户 2. 能够按需提供自服务 3. 宽带网络的接入 4 ...

  2. poj2485 highwaysC语言编写

    /*HighwaysTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 33595Accepted: 15194DescriptionTh ...

  3. poj1611 解题报告

    并查集学习过之后做了几道相关联系,这里贴出1611 The Suspects Time Limit: 1000MS   Memory Limit: 20000K Total Submissions:  ...

  4. ##6.1 Neutron控制节点-- openstack pike

    ##6.1 Neutron控制节点 openstack pike 安装 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html ##6.1 Neutron控制节 ...

  5. 10970 - Big Chocolate

    题意 :已知n*m的巧克力,问需要掰多少次能让巧克力成为最小的一块: #include<iostream> using namespace std; int main() { int n, ...

  6. 实践作业1:测试管理工具实践 Day3

    1.Vertrigoserv启动后,首先要配置apache,则需要修改监听端口,不要出现端口冲突2.配置mysql,在mysql console中输入密码vertrigo3.在浏览器中输入http:/ ...

  7. [PHP基础]有关isset empty 函数的面试题

    用isset()和empty()判断下面的变量. $str = ''; $int = 0 ; $arr = array(); isset($str) 返回的是 true 还是 false empty( ...

  8. sublime text 3 ctrl+b浏览器启动html

    sublime text 2 和3 都可以快速设置浏览器启动,本人在这里介绍如何不下插件启动浏览器.第一步:打开Tool-->build system  ---> new build sy ...

  9. The requested URL / was not found on this server——Apache配置虚拟域名后无法访问localhost

    今天为了做项目,在Apache中配置了项目域名,成功访问.但是忽然发现要访问localhost突然出现The requested URL / was not found on this server. ...

  10. tyvj4865 天天和树tree

    #include<bits/stdc++.h> #define MAXN 100000+10 using namespace std; *MAXN]; ,head[MAXN],pre[MA ...