阿里云64位centos6.3系统上编译安装redis
环境
系统:阿里云64位centos 6.3
[rao@AY~]$ cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m [rao@AY~]$ uname -a
Linux AY1404062027584053a1Z 2.6.-358.6..el6.x86_64 # SMP Thu May :: UTC x86_64 x86_64 x86_64 GNU/Linux
下载最新版redis:
[rao@~Packages]$ wget http://download.redis.io/releases/redis-2.8.9.tar.gz
[rao@~Packages]$ tar zxvf redis-2.8..tar.gz
编译redis:
[rao@~ Packages]$ tar zxvf redis-2.8..tar.gz
[rao@~ Packages]$ cd redis-2.8.
[rao@~ redis-2.8.]$ make
报错:
cd src && make all
make[]: Entering directory `/home/rao/Packages/redis-2.8./src'
CC adlist.o
在包含自 /usr/include/features.h: 的文件中,
从 /usr/include/stdlib.h:,
从 adlist.c::
/usr/include/gnu/stubs.h::: 错误:gnu/stubs-.h:没有那个文件或目录
make[]: *** [adlist.o] 错误
make[]: Leaving directory `/home/rao/Packages/redis-2.8./src'
make: *** [all] 错误
redis的README中有说明:
In case of build errors when trying to build a 32 bit binary of Redis, try
the following steps:* Install the packages libc6-dev-i386 (also try g++-multilib).
但是centos中并没有libc6-dev-i386这个包,查了一下需要的头文件在glibc-devel这个包中。
安装glibc-devel:
[rao@~ Packages]$ sudo yum install glibc-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors..com
* extras: mirrors..com
* updates: mirrors..com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc-devel.x86_64 :2.12-1.107.el6_4. will be updated
---> Package glibc-devel.x86_64 :2.12-1.132.el6 will be an update
--> Processing Dependency: glibc-headers = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-devel-2.12-1.132.el6.x86_64
--> Running transaction check
---> Package glibc.x86_64 :2.12-1.107.el6_4. will be updated
--> Processing Dependency: glibc = 2.12-1.107.el6_4. for package: nscd-2.12-1.107.el6_4..x86_64
--> Processing Dependency: glibc = 2.12-1.107.el6_4. for package: glibc-common-2.12-1.107.el6_4..x86_64
---> Package glibc.x86_64 :2.12-1.132.el6 will be an update
---> Package glibc-headers.x86_64 :2.12-1.107.el6_4. will be updated
---> Package glibc-headers.x86_64 :2.12-1.132.el6 will be an update
--> Running transaction check
---> Package glibc-common.x86_64 :2.12-1.107.el6_4. will be updated
---> Package glibc-common.x86_64 :2.12-1.132.el6 will be an update
---> Package nscd.x86_64 :2.12-1.107.el6_4. will be updated
---> Package nscd.x86_64 :2.12-1.132.el6 will be an update
--> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================
Package Arch Version Repository Size
======================================================================================================================
Updating:
glibc-devel x86_64 2.12-1.132.el6 base k
Updating for dependencies:
glibc x86_64 2.12-1.132.el6 base 3.8 M
glibc-common x86_64 2.12-1.132.el6 base M
glibc-headers x86_64 2.12-1.132.el6 base k
nscd x86_64 2.12-1.132.el6 base k Transaction Summary
======================================================================================================================
Upgrade Package(s) Total download size: M
Is this ok [y/N]: y
Downloading Packages:
(/): glibc-2.12-1.132.el6.x86_64.rpm | 3.8 MB :
(/): glibc-common-2.12-1.132.el6.x86_64.rpm | MB :
(/): glibc-devel-2.12-1.132.el6.x86_64.rpm | kB :
(/): glibc-headers-2.12-1.132.el6.x86_64.rpm | kB :
(/): nscd-2.12-1.132.el6.x86_64.rpm | kB :
----------------------------------------------------------------------------------------------------------------------
Total 5.7 MB/s | MB :
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : glibc-common-2.12-1.132.el6.x86_64 /
Updating : glibc-2.12-1.132.el6.x86_64 /
Updating : glibc-headers-2.12-1.132.el6.x86_64 /
Updating : glibc-devel-2.12-1.132.el6.x86_64 /
Updating : nscd-2.12-1.132.el6.x86_64 /
warning: /etc/nscd.conf created as /etc/nscd.conf.rpmnew
Cleanup : glibc-devel-2.12-1.107.el6_4..x86_64 /
Cleanup : glibc-headers-2.12-1.107.el6_4..x86_64 /
Cleanup : nscd-2.12-1.107.el6_4..x86_64 /
Cleanup : glibc-common-2.12-1.107.el6_4..x86_64 /
Cleanup : glibc-2.12-1.107.el6_4..x86_64 /
Verifying : glibc-2.12-1.132.el6.x86_64 /
Verifying : glibc-devel-2.12-1.132.el6.x86_64 /
Verifying : glibc-common-2.12-1.132.el6.x86_64 /
Verifying : nscd-2.12-1.132.el6.x86_64 /
Verifying : glibc-headers-2.12-1.132.el6.x86_64 /
Verifying : glibc-common-2.12-1.107.el6_4..x86_64 /
Verifying : glibc-2.12-1.107.el6_4..x86_64 /
Verifying : glibc-devel-2.12-1.107.el6_4..x86_64 /
Verifying : glibc-headers-2.12-1.107.el6_4..x86_64 /
Verifying : nscd-2.12-1.107.el6_4..x86_64 / Updated:
glibc-devel.x86_64 :2.12-1.132.el6 Dependency Updated:
glibc.x86_64 :2.12-1.132.el6 glibc-common.x86_64 :2.12-1.132.el6 glibc-headers.x86_64 :2.12-1.132.el6
nscd.x86_64 :2.12-1.132.el6 Complete!
继续make,还是报同样的错误。但是明明已经安装了glibc-devel包啊?
[rao@~ redis-2.8.]$ ls /usr/include/gnu/
libc-version.h lib-names.h stubs-.h stubs.h
确实没有所需要的头文件“gnu/stubs-.h”。
再检查安装glibc-devel包的过程,其安装的包名称是“glibc-devel-2.12-1.132.el6.x86_64.rpm”,从yum的源(http://mirrors.163.com/centos/6/os/x86_64/Packages/)中下载该rpm包,解压察看发现:该rpm包中确实没有头文件“gnu/stubs-.h”。
也就是说:通过“sudo yum install glibc-devel”命令安装的“glibc-devel-2.12-1.132.el6.x86_64.rpm”中并不是我们需要的rpm包?
那么到底需要安装哪个rpm包呢?
刚才在yum的源中,注意到存在两个版本号相同的glibc-devel:
glibc-devel-2.12-1.132.el6.i686.rpm 25-Nov-2013 03:29 1001468
glibc-devel-2.12-1.132.el6.x86_64.rpm 25-Nov-2013 03:31 1001012
第二个就是刚才通过“sudo yum install glibc-devel”命令安装的包,从名字看是64位系统的,那么第一个就应该是32位的。
下载第一个包“glibc-devel-2.12-1.132.el6.i686.rpm”,解压看看里面有什么文件:
[rao@~ Packages]$ rpm2cpio glibc-devel-2.12-1.132.el6.i686.rpm | cpio -div
./usr/include/gnu/stubs-32.h
./usr/lib/Mcrt1.o
./usr/lib/Scrt1.o
./usr/lib/crt1.o
./usr/lib/crti.o
./usr/lib/crtn.o
./usr/lib/gcrt1.o
./usr/lib/libBrokenLocale.so
./usr/lib/libanl.so
./usr/lib/libbsd-compat.a
./usr/lib/libbsd.a
./usr/lib/libc.so
./usr/lib/libc_nonshared.a
./usr/lib/libcidn.so
./usr/lib/libcrypt.so
./usr/lib/libdl.so
./usr/lib/libg.a
./usr/lib/libieee.a
./usr/lib/libm.so
./usr/lib/libmcheck.a
./usr/lib/libnsl.so
./usr/lib/libnss_compat.so
./usr/lib/libnss_dns.so
./usr/lib/libnss_files.so
./usr/lib/libnss_hesiod.so
./usr/lib/libnss_nis.so
./usr/lib/libnss_nisplus.so
./usr/lib/libpthread.so
./usr/lib/libpthread_nonshared.a
./usr/lib/libresolv.so
./usr/lib/librpcsvc.a
./usr/lib/librt.so
./usr/lib/libthread_db.so
./usr/lib/libutil.so
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info-.gz
./usr/share/info/libc.info.gz
块
可以看到里面刚好有我们需要的头文件“gnu/stubs-.h”。
那么执行“sudo yum install glibc-devel”命令为什么安装的是“glibc-devel-2.12-1.132.el6.x86_64.rpm”而不是我们需要的“glibc-devel-2.12-1.132.el6.i686.rpm”包呢?
我猜是在64位系统中,yum在安装时发现同一个包存在两个版本时,默认优先安装64位的rpm包。
那该怎么让yum安装“glibc-devel-2.12-1.132.el6.i686.rpm”呢?
既然我已经下载了该包,就用rpm命令手动安装试试看:
[rao@~ redis-2.8.]$ sudo rpm -ivh glibc-devel-2.12-1.132.el6.i686.rpm
error: Failed dependencies:
libBrokenLocale.so. is needed by glibc-devel-2.12-1.132.el6.i686
libanl.so. is needed by glibc-devel-2.12-1.132.el6.i686
libcidn.so. is needed by glibc-devel-2.12-1.132.el6.i686
libcrypt.so. is needed by glibc-devel-2.12-1.132.el6.i686
libdl.so. is needed by glibc-devel-2.12-1.132.el6.i686
libm.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnsl.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_compat.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_dns.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_files.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_hesiod.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_nis.so. is needed by glibc-devel-2.12-1.132.el6.i686
libnss_nisplus.so. is needed by glibc-devel-2.12-1.132.el6.i686
libresolv.so. is needed by glibc-devel-2.12-1.132.el6.i686
librt.so. is needed by glibc-devel-2.12-1.132.el6.i686
libthread_db.so. is needed by glibc-devel-2.12-1.132.el6.i686
libutil.so. is needed by glibc-devel-2.12-1.132.el6.i686
看来不行,缺少一堆依赖文件。
网上查到可以通过"yum install glibc-devel.i686"命令安装32位的glibc-devel:
[rao@~ redis-2.8.]$ sudo yum install glibc-devel.i686
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors..com
* extras: mirrors..com
* updates: mirrors..com
Setting up Install Process
No package glibc-devel.i686 available.
Error: Nothing to do
找不到?明明有这个包啊。。。。
[rao@~ redis-2.8.]$ yum list|grep libc
glibc.x86_64 2.12-1.132.el6 @base
glibc-common.x86_64 2.12-1.132.el6 @base
glibc-devel.x86_64 2.12-1.132.el6 @base
glibc-headers.x86_64 2.12-1.132.el6 @base
libcap.x86_64 2.16-5.5.el6 @anaconda-CentOS-.x86_64/6.3
libcap-ng.x86_64 0.6.-.el6_0. @anaconda-CentOS-.x86_64/6.3
libcom_err.x86_64 1.41.-.el6 @base
libcom_err-devel.x86_64 1.41.-.el6 @base
libcurl.x86_64 7.19.-.el6_2. @anaconda-CentOS-.x86_64/6.3
compat-glibc.x86_64 :2.5-46.2 base
compat-glibc-headers.x86_64 :2.5-46.2 base
compat-libcap1.x86_64 1.10- base
glibc-static.x86_64 2.12-1.132.el6 base
glibc-utils.x86_64 2.12-1.132.el6 base
libc-client.x86_64 2007e-.el6 base
libc-client-devel.x86_64 2007e-.el6 base
libcacard.x86_64 0.15.-.el6 base
libcacard-devel.x86_64 0.15.-.el6 base
libcacard-tools.x86_64 0.15.-.el6 base
libcanberra.x86_64 0.22-.el6.centos base
libcanberra-devel.x86_64 0.22-.el6.centos base
libcanberra-gtk2.x86_64 0.22-.el6.centos base
libcap-devel.x86_64 2.16-5.5.el6 base
libcap-ng-devel.x86_64 0.6.-.el6_0. base
libcap-ng-python.x86_64 0.6.-.el6_0. base
libcap-ng-utils.x86_64 0.6.-.el6_0. base
libcdio.x86_64 0.81-3.1.el6 base
libcdio-devel.x86_64 0.81-3.1.el6 base
libcgroup.x86_64 0.40.rc1-.el6_5. updates
libcgroup-devel.x86_64 0.40.rc1-.el6_5. updates
libcgroup-pam.x86_64 0.40.rc1-.el6_5. updates
libchewing.x86_64 0.3.-.el6 base
libchewing-devel.x86_64 0.3.-.el6 base
libchewing-python.x86_64 0.3.-.el6 base
libcmpiCppImpl0.x86_64 2.0.-.el6 base
libcmpiutil.x86_64 0.5.-.el6 base
libcmpiutil-devel.x86_64 0.5.-.el6 base
libcollection.x86_64 0.6.-.el6 base
libcollection-devel.x86_64 0.6.-.el6 base
libconfig.x86_64 1.3.-1.1.el6 base
libconfig-devel.x86_64 1.3.-1.1.el6 base
libcroco.x86_64 0.6.-.el6 base
libcroco-devel.x86_64 0.6.-.el6 base
libcurl.x86_64 7.19.-.el6_4 base
libcurl-devel.x86_64 7.19.-.el6_4 base
libcxgb3.x86_64 1.3.-.el6 base
libcxgb3-static.x86_64 1.3.-.el6 base
libcxgb4.x86_64 1.2.-.el6 base
libcxgb4-static.x86_64 1.2.-.el6 base
可以看到yum命令确实只能找到64位的rpm包,但yum的源中又确实有32位的rpm包啊。。。问题处在哪呢?
打开yum的配置文件/etc/yum.conf看看,发现一行可疑的配置:
exclude=*.i? kernel kernel-xen kernel-debug
从内容看,似乎yum刻意忽略了32位的rpm包?
不管三七二十一,去掉试试看,修改成如下:
exclude= kernel kernel-xen kernel-debug
[rao@AY1404062027584053a1Z etc]$ yum list |grep glibc
glibc.x86_64 2.12-1.132.el6 @base
glibc-common.x86_64 2.12-1.132.el6 @base
glibc-devel.x86_64 2.12-1.132.el6 @base
glibc-headers.x86_64 2.12-1.132.el6 @base
compat-glibc.x86_64 :2.5-46.2 base
compat-glibc-headers.x86_64 :2.5-46.2 base
glibc.i686 2.12-1.132.el6 base
glibc-devel.i686 2.12-1.132.el6 base
glibc-static.i686 2.12-1.132.el6 base
glibc-static.x86_64 2.12-1.132.el6 base
glibc-utils.x86_64 2.12-1.132.el6 base
果然多了一个32位的rpm包,看来有戏。
再执行命令”sudo yum install glibc-devel.i686",终于安装成功了。
再继续编译redis,很快就搞定了。
总结:
原因:阿里云64位centos6.3上,默认的yum配置不安装32位的rpm包,导致编译redis需要的“glibc-devel.i686”无法被安装。
解决办法:修改yum的配置文件/etc/yum.conf,将”exclude=*.i?86 kernel kernel-xen kernel-debug“改成”exclude= kernel kernel-xen kernel-debug“即可。
不确定这个配置是centos的默认配置,还是阿里云的修改,总之很坑爹,浪费了我一个美好的周末。
阿里云64位centos6.3系统上编译安装redis的更多相关文章
- 64位的Ubuntu系统上使用汇编nasm和C语言
64位的Ubuntu系统上使用汇编nasm和C语言 $ nasm -f elf foo.asm -o foo.o$ gcc -c bar.c -o bar.o$ ld -s foo.o bar.o ...
- 在阿里云ECS(CentOS6.5)上安装jdk
JDK安装 在安装前先确定服务器上没有安装过JDK 命令: java -version 结果: 查看所有java安装包 命令: yum -y list java* 结果: 选择安装所需要的JDK 命令 ...
- 在CentOS6.7操作系统上编译安装httpd2.4
功能描述: 在CentOS6.7操作系统上,编译安装apache服务,实现定制功能等 一.安装前提 1)安装编译httpd需要的软件包 [root@bqe6tewv41kx ~]# yum -y i ...
- 在阿里云ECS(CentOS6.5)上安装mysql
首先查看服务器上是否已经安装过mysql 命令: rpm -qa | grep mysql 结果: 可以看到ECS上已经有mysql-libs这个包了.这并不影响安装. 查看yum服务器上提供的mys ...
- 在阿里云ECS(CentOS6.5)上安装redis
下载所需的redis 命令: wget http://download.redis.io/releases/redis-3.0.7.tar.gz 结果: 解压redis压缩文件: 命令: .tar.g ...
- 在阿里云ECS(CentOS6.5)上安装tomcat
切换到你要安装的目录下 命令: cd /home/ 下载你要安装的tomcat 命令: wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7. ...
- 在阿里云ECS(CentOS6.5)上安装ftp
安装vsftpd 命令: yum install vsftpd –y 结果: 创建ftp存取文件的目录,用户名,密码 命令: useradd -d /home/ftp -g ftp -s /sbin/ ...
- 在CentOS6.7操作系统上编译安装mysql-5.6.31
功能概述: 由于在centos 6.7下通过yum安装的mysql是5.1版本的,不满足需求,因此经常性需要编译安装mysql服务等. 一.安装mysql 1.安装前提 1)安装编译mysql代码所依 ...
- Linux系统上php-cli安装redis扩展
下载 假设已经安装了redis-server,现在我们来安装redis扩展. 下载ZIP包: https://github.com/phpredis/phpredis/tree/master . 解压 ...
随机推荐
- AC日记——文化之旅 洛谷 P1078
文化之旅 思路: 暴搜,倒搜: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 105 #define max ...
- Kerberos KDC not reachable
水贴..我这里出现这个问题的原因是服务器上安装的是 oracle jdk, 但是没有安装 JCE 拓展包. 解决方式有两个: 1. 换成 openJDK 2. 安装上 JCE 拓展包 java 8 ...
- 复选框的全选+全不选+ajax传递复选框的value值+后台接受复选框默认值
1.html代码 <!--全选框/全不选--> <input type="checkbox" name="all" id="all& ...
- http://download.eclipse.org/technology/m2e/releases install error
Can you try running Eclipse as Admin and try this again?. Let me know how that goes. what is the upd ...
- js实现table导出为Excel文件
1.首先创建好表格. 2.然后在js中写三个方法 1)判断浏览器 2)定义文档类型 template : 定义文档的类型,相当于html页面中顶部的<!DOCTYPE> 声明.(个人理解, ...
- 【BZOJ 1095】 1095: [ZJOI2007]Hide 捉迷藏 (括号序列+线段树)
1095: [ZJOI2007]Hide 捉迷藏 Description 捉迷藏 Jiajia和Wind是一对恩爱的夫妻,并且他们有很多孩子.某天,Jiajia.Wind和孩子们决定在家里玩捉迷藏游戏 ...
- Minimum Height Trees -- LeetCode
For a undirected graph with tree characteristics, we can choose any node as the root. The result gra ...
- 初雪-Diary?
who care ------------2018 11 6-------------- 终于AK一场啦 ------------2018 10 18-------------- 嗯....今天T2多 ...
- 【codevs1074】食物链
[codevs1074]食物链 2001年NOI全国竞赛 时间限制: 3 s 空间限制: 64000 KB 题目等级 : 钻石 Diamond 题目描述 Description 动物王国中有 ...
- 【Floyd】POJ2139 -Six Degrees of Cowvin Bacon
普通的Floyd了分分秒可以水过,结果在submit前删调试段落的时候把程序本体给删了吃了两个WA…… #include<iostream> #include<cstring> ...