背景描述
在学习Redis进行环境搭建的时候(就是安装Redis),提示redis依赖与jemalloc库,导致无法安装redis
于是需要先将jemalloc安装上才能继续安装redis
[root@localhost tools]# rpm -ivh redis-3.0.7-4.el6.art.x86_64.rpm
warning: redis-3.0.7-4.el6.art.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 4520afa9: NOKEY
error: Failed dependencies:
libjemalloc.so.1()(64bit) is needed by redis-3.0.7-4.el6.art.x86_64
[root@localhost tools]#
如上的报错信息:error: Failed dependencies: libjemalloc.so.1()(64bit) is needed by redis-3.0.7-4.el6.art.x86_64
安装jemalloc之路
1)安装epel.repo数据源,然后通过yum安装jemalloc
yum install epel-release -y
yum install jemalloc -y
安装epe.repo数据源
[root@localhost tools]# yum install epel-release -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
* base: mirrors.neusoft.edu.cn
* extras: mirrors.neusoft.edu.cn
* updates: mirror.lzu.edu.cn
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-connectors-community/primary_db | 43 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql-tools-community/primary_db | 53 kB 00:00
mysql57-community | 2.5 kB 00:00
mysql57-community/primary_db | 194 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 7.5 MB 00:02
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================
Installing:
epel-release noarch 6-8 extras 14 k
Transaction Summary
===========================================================================================================================================================================
Install 1 Package(s)
Total download size: 14 k
Installed size: 22 k
Downloading Packages:
epel-release-6-8.noarch.rpm | 14 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
libgcc-4.4.7-23.el6.x86_64 is a duplicate with libgcc-4.4.6-3.el6.x86_64
Installing : epel-release-6-8.noarch 1/1
Installed:
epel-release.noarch 0:6-8
Complete!
[root@localhost tools]#
安装jemalloc
[root@localhost tools]# yum install jemalloc -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
[root@localhost tools]#
如上图报错:Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
将/etc/yum.repos.d/epel.repo
文件第三行注释取消,将第四行注释,如下:
1 [epel]
2 name=Extra Packages for Enterprise Linux 6 - $basearch
3 baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
4 #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
执行 yum clean all
[root@localhost tools]# ll -ht /etc/yum.repos.d/epel.repo
-rw-r--r--. 1 root root 957 Nov 4 2012 /etc/yum.repos.d/epel.repo
[root@localhost tools]# vim /etc/yum.repos.d/epel.repo
[root@localhost tools]#
[root@localhost tools]#
[root@localhost tools]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base epel extras mysql-connectors-community mysql-tools-community mysql57-community updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@localhost tools]#
再通过 yum install jemalloc -y
安装
[root@localhost tools]# yum install jemalloc -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
* base: mirror.lzu.edu.cn
* extras: mirror.lzu.edu.cn
* updates: mirror.bit.edu.cn
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:02
http://download.fedoraproject.org/pub/epel/6/x86_64/repodata/repomd.xml: [Errno 14] problem making ssl connection
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again
[root@localhost tools]#
如上报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again
原因是:ssl证书的原因导致的连接失败
将/etc/yum.repos.d/epel.repo
的enable改为0,禁用SSL验证即可
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
再通过 yum install jemalloc -y
安装
[root@localhost tools]# yum install jemalloc -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirror.lzu.edu.cn
* updates: mirror.bit.edu.cn
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-connectors-community/primary_db | 43 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql-tools-community/primary_db | 53 kB 00:00
mysql57-community | 2.5 kB 00:00
mysql57-community/primary_db | 194 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 7.5 MB 00:05
Setting up Install Process
No package jemalloc available.
Error: Nothing to do
[root@localhost tools]#
如上报错:No package jemalloc available.
Error: Nothing to do
尝试配置成阿里的yum源再次安装
阿里yum源配置过程
# 1.备份原有的yum配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
# 2.下载阿里yum源配置文件,若是Centos7直接改最后的名称就可以
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# 3.删除本机旧数据(之前yum下载过的所有软件源的相关数据,包括软件本身与清单)
yum clean all
# 4. 重新设置缓存
yum makecache
然而仍不能通过yum进行下载安装jemalloc
最终放弃了yum安装,选择了从网络下载RPM包进行安装的方法,具体过程可见《Redis的下载与安装》博客
jemalloc包下载链接:http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/j/jemalloc-3.6.0-1.el6.x86_64.rpm
通过 rpm -ivh jemalloc-3.6.0-1.el6.x86_64.rpm
命令进行安装即可