简体   繁体   English

MongoDB未安装在CentOS 6.7上

[英]MongoDB does not install on CentOS 6.7

I'm Windows guy. 我是Windows家伙。 When I need to use Linux based OS, I always choose Ubuntu. 当我需要使用基于Linux的操作系统时,我总是选择Ubuntu。 However, this time they didn't give me any choice. 但是,这次他们没有给我任何选择。

I tried to install MongoDB from this link of mongodb site . 我试图从mongodb site的链接安装MongoDB。 I have created repository file then I try to install it and I get this error message: 我已经创建了存储库文件,然后尝试安装它,并收到以下错误消息:

Error: Package: mongodb-org-tools-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(CXXABI_1.3.5)(64bit)
Error: Package: mongodb-org-mongos-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(GLIBCXX_3.4.14)(64bit)
Error: Package: mongodb-org-shell-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(GLIBCXX_3.4.14)(64bit)
Error: Package: mongodb-org-server-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(CXXABI_1.3.5)(64bit)
Error: Package: mongodb-org-server-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)
Error: Package: mongodb-org-shell-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2)
       Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)

According to this message I thought that I'm missing libstdc++.so.6 . 根据此消息,我认为我缺少libstdc++.so.6 So I have run this command to install it: 因此,我已经运行以下命令进行安装:

 yum install libstdc++.so.6

I got this message: 我收到此消息:

Package libstdc++-4.4.7-16.el6.i686 already installed and latest version

This is getting frustrating. 这越来越令人沮丧。 Why this is happening? 为什么会这样呢?

You screwed up your repository definitions a bit. 您稍微修改了存储库定义。 Either you actually do run CentOS, in which case you mistakenly defined the repository for the AmazonLinux packages of MongoDB. 您实际上都在运行CentOS,在这种情况下,您错误地为MongoDB的AmazonLinux软件包定义了存储库。 This is the more likely case, since I can reproduce your problem with that misconfigured repo. 这是更可能的情况,因为我可以通过配置错误的存储库重现您的问题。

There is a chance, however, that you run on AmazonLinux and defined the CentOS repositories. 但是,您有可能在AmazonLinux上运行并定义了CentOS存储库。

If you are positively sure you are really on CentOS 如果您确信自己确实在使用CentOS

The problem is that you entered the wrong repository. 问题是您输入了错误的存储库。 When using the correct repo, MongoDB installs and runs as expected. 使用正确的存储库时,MongoDB将按预期安装并运行。 However, the RPM name is different, both as shown below: 但是,RPM名称不同,两者均如下所示:

工作设置

Most likely, you have put a wrong repo definition somehwere, like below: 您很可能在某个地方输入了错误的回购定义,如下所示:

错误的存储库

So, what you need to do is to find the place where the repository for Amazon Linux is defined and replace it with the correct one: 因此,您需要做的是找到为Amazon Linux定义存储库的位置,并用正确的存储库替换它:

$ grep -l amazon -R /etc/yum.repos.d/*

The problem here is that multiple repositories might be defined. 这里的问题是可能定义了多个存储库。 Inspect the files returned by the grep command, and remove the respective repository definition. 检查grep命令返回的文件,并删除相应的存储库定义。 Then, add the correct repository definition , which as of the time of this writing is 然后,添加正确的存储库定义 ,截至撰写本文时,

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=0
enabled=1

If you are on AmazonLinux 如果您在AmazonLinux上

Misconception 误解

It has to be said that 必须说

AmazonLinux != CentOS AmazonLinux!= CentOS

They are close (both based on RHEL), but not identical. 它们很接近(均基于RHEL),但并不完全相同。 Specifically, some package versions might differ. 具体来说,某些软件包版本可能有所不同。 The package versions used to compile MongoDB for AmazonLinux are documented within the RPM, and this documentation is sort of a contract between the package and the system RPM中记录了用于为AmazonLinux编译MongoDB的软件包版本,该文档有点像软件包与系统之间的契约。

I, MongoDB, promise to run properly on a system which has these packages in the specified version. 我,MongoDB,保证可以在具有指定版本的这些软件包的系统上正常运行。

A contract which CentOS can not fulfill. CentOS无法履行的合同。

Solution

Simply follow the installation instructions for MongoDB on AmazonLinux . 只需按照AmazonLinux上MongoDB的安装说明进行操作

Looks like the culprit is glibc can you try 罪魁祸首是glibc,可以尝试吗

yum list glibc

And see if the version matches what mongo expects. 并查看该版本是否符合mongo的期望。 Welcome to dependency hell :) 欢迎来到依赖地狱:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM