阿里云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 . 解压 ...
随机推荐
- 事务管理配置与@Transactional注解使用
spring,mybatis事务管理配置与@Transactional注解使用 概述 事务管理对于企业应用来说是至关重要的,即使出现异常情况,它也可以保证数据的一致性. Spring Framewor ...
- 【JBPM4】任务节点-任务分配assignee
JPDL <process key="task" name="task" xmlns="http://jbpm.org/4.4/jpdl&quo ...
- nodejs里的express自动刷新高级篇【转载】
搬运自[简书:http://www.jianshu.com/p/2f923c8782c8]亲测可用哦! 最近在使用express框架及mongodb,由于前端和后端代码修改后都需要实现自动刷新功能,刚 ...
- Aras Innovator 11 sp2安装
本文档记录Aras Innovator 11 sp2的安装过程 官方安装文档:http://www.aras.com/support/documentation/ Aras Innovator 11. ...
- [thinkphp] 隐藏后台地址
转自 http://document.thinkphp.cn/manual_3_2.html#module_deploy 如果不希望用户直接访问某个模块,可以设置模块映射(对后台的保护会比较实用). ...
- 如何去除windows下文本的^M
使用vi编辑,输入命令: :%s/^M/\r/g 用来把^M换成回车 注意的是^M要使用CTRL-V CTRL-M生成,而不是直接键入^M
- 解决Xamarin Android SDK Manager闪退问题
解决Xamarin Android SDK Manager闪退问题 SDK Manager闪退是因为它找不到java.exe导致的.SDK Manager默认是通过读取注册表中JDK安装信息来java ...
- BZOJ 4236 JOIOJI(前缀和)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=4236 [题目大意] 给出一个只包含三种字母的字符串,求出三种字母数量相等的最长子串 [ ...
- 【找规律】【递归】XVII Open Cup named after E.V. Pankratiev Stage 4: Grand Prix of SPb, Sunday, Octorber 9, 2016 Problem F. Doubling
题意: 给你一个n,问你R(n)对应的字符串长度最小的是啥. dp打个表出来,f(i)表示i值对应的字符串的最小长度,发现f(1)=1,f(2)=2,其他的情况下,若是偶数,则恰好在其外面加一对中括号 ...
- [HihoCoder1259]A Math Problem
题目大意: 有一个函数f(n),满足3f(n)*f(2n+1)=f(2n)*(1+3f(n)),f(2n)<6f(n). 我们用g(t)表示f(i)%k=t的i的个数,其中1<=i< ...