No package mongodb-org available. 问题解决
No package mongodb-org available. 问题解决
王孟君 发表于8个月前
No package mongodb-org available. 问题解决
  • 发表于 8个月前
  • 阅读 106
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 成都新区开服特惠,热门产品8.5折>>>   

摘要: CentOS 6.7上尝试采用yum安装MongoDB (yum install mongodb-org),出现No package mongodb-org available的问题,本文给出问题的解决方法,并成功安装Mongodb

CentOS 6.7上尝试采用yum安装MongoDB (yum install mongodb-org),出现No package mongodb-org available的问题,本文给出问题的解决方法,并成功安装Mongodb。

问题

使用yum install mongodb-org命令,安装MongoDB,出现No package mongodb-org available. 问题。具体信息如下:

[root@dev03 ~]#  yum install mongodb-org
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
No package mongodb-org available.
Error: Nothing to do

解决方法

出现上述问题的原因是缺少可用的mongodb-org包

No package mongodb-org available.)。

 

解决方法:

在/etc/yum.repos.d/目录下,创建一个mongodb.repo文件,指定MongoDB资源库即可。

使用 vim /etc/yum.repos.d/mongodb.repo命令,创建并打开文件mongodb.repo,

[root@dev03 etc]# vim /etc/yum.repos.d/mongodb.repo

在mongodb.repo文件中,添加MongoDB资源,这里获取的Mongo-org版本为最新的3.4。如:

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc

安装

配置好MongoDB相关的信息之后,重新使用yum install mongodb-org命令安装mongodb-org。

[root@dev03 etc]# yum install mongodb-org
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
mongodb-org-3.4                                                                                                                                                                                                                                        | 2.5 kB     00:00     
mongodb-org-3.4/primary_db                                                                                                                                                                                                                             |  18 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.4.2-1.el6 will be installed
--> Processing Dependency: mongodb-org-tools = 3.4.2 for package: mongodb-org-3.4.2-1.el6.x86_64
--> Processing Dependency: mongodb-org-shell = 3.4.2 for package: mongodb-org-3.4.2-1.el6.x86_64
--> Processing Dependency: mongodb-org-server = 3.4.2 for package: mongodb-org-3.4.2-1.el6.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.4.2 for package: mongodb-org-3.4.2-1.el6.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.4.2-1.el6 will be installed
---> Package mongodb-org-server.x86_64 0:3.4.2-1.el6 will be installed
---> Package mongodb-org-shell.x86_64 0:3.4.2-1.el6 will be installed
---> Package mongodb-org-tools.x86_64 0:3.4.2-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                                                Arch                                                       Version                                                          Repository                                                           Size
==============================================================================================================================================================================================================================================================================
Installing:
 mongodb-org                                                            x86_64                                                     3.4.2-1.el6                                                      mongodb-org-3.4                                                     5.8 k
Installing for dependencies:
 mongodb-org-mongos                                                     x86_64                                                     3.4.2-1.el6                                                      mongodb-org-3.4                                                      12 M
 mongodb-org-server                                                     x86_64                                                     3.4.2-1.el6                                                      mongodb-org-3.4                                                      20 M
 mongodb-org-shell                                                      x86_64                                                     3.4.2-1.el6                                                      mongodb-org-3.4                                                      11 M
 mongodb-org-tools                                                      x86_64                                                     3.4.2-1.el6                                                      mongodb-org-3.4                                                      49 M

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install       5 Package(s)

Total download size: 91 M
Installed size: 257 M
Is this ok [y/N]: 

 

选择 y

 

Is this ok [y/N]: y
Downloading Packages:
(1/5): mongodb-org-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                              | 5.8 kB     00:00     
(2/5): mongodb-org-mongos-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                       |  12 MB     00:01     
(3/5): mongodb-org-server-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                       |  20 MB     00:00     
(4/5): mongodb-org-shell-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                        |  11 MB     00:00     
(5/5): mongodb-org-tools-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                        |  49 MB     00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                          15 MB/s |  91 MB     00:06     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID a15703c6: NOKEY
Retrieving key from https://www.mongodb.org/static/pgp/server-3.4.asc
Importing GPG key 0xA15703C6:
 Userid: "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>"
 From  : https://www.mongodb.org/static/pgp/server-3.4.asc
Is this ok [y/N]: 

 

选择 y

 

Is this ok [y/N]: y
Downloading Packages:
(1/5): mongodb-org-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                              | 5.8 kB     00:00     
(2/5): mongodb-org-mongos-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                       |  12 MB     00:01     
(3/5): mongodb-org-server-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                       |  20 MB     00:00     
(4/5): mongodb-org-shell-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                        |  11 MB     00:00     
(5/5): mongodb-org-tools-3.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                        |  49 MB     00:01     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                          15 MB/s |  91 MB     00:06     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID a15703c6: NOKEY
Retrieving key from https://www.mongodb.org/static/pgp/server-3.4.asc
Importing GPG key 0xA15703C6:
 Userid: "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>"
 From  : https://www.mongodb.org/static/pgp/server-3.4.asc
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : mongodb-org-server-3.4.2-1.el6.x86_64                                                                                                                                                                                                                      1/5 
  Installing : mongodb-org-shell-3.4.2-1.el6.x86_64                                                                                                                                                                                                                       2/5 
  Installing : mongodb-org-mongos-3.4.2-1.el6.x86_64                                                                                                                                                                                                                      3/5 
  Installing : mongodb-org-tools-3.4.2-1.el6.x86_64                                                                                                                                                                                                                       4/5 
  Installing : mongodb-org-3.4.2-1.el6.x86_64                                                                                                                                                                                                                             5/5 
  Verifying  : mongodb-org-tools-3.4.2-1.el6.x86_64                                                                                                                                                                                                                       1/5 
  Verifying  : mongodb-org-mongos-3.4.2-1.el6.x86_64                                                                                                                                                                                                                      2/5 
  Verifying  : mongodb-org-shell-3.4.2-1.el6.x86_64                                                                                                                                                                                                                       3/5 
  Verifying  : mongodb-org-3.4.2-1.el6.x86_64                                                                                                                                                                                                                             4/5 
  Verifying  : mongodb-org-server-3.4.2-1.el6.x86_64                                                                                                                                                                                                                      5/5 

Installed:
  mongodb-org.x86_64 0:3.4.2-1.el6                                                                                                                                                                                                                                            

Dependency Installed:
  mongodb-org-mongos.x86_64 0:3.4.2-1.el6                            mongodb-org-server.x86_64 0:3.4.2-1.el6                            mongodb-org-shell.x86_64 0:3.4.2-1.el6                            mongodb-org-tools.x86_64 0:3.4.2-1.el6                           

Complete!
[root@dev03 etc]# 

至此 mongo-org 3.4就安装完成了。

启动

使用 service mongod start命令启动Mongo 服务

[root@dev03 ~]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev03 ~]# 

一般情况下,基本上就成功安装和启动Mongo服务,可以开启Mongo之旅了。

但是,有可能之前进行过安装、删除Mongo的相关操作,这个时候使用service mongod start命令启动时,可能会遇到如下的问题:

Error starting mongod. /var/run/mongodb/mongod.pid exists.

[root@dev03 srv]# service mongod start
Error starting mongod. /var/run/mongodb/mongod.pid exists.
[root@dev03 srv]# 

使用vim  /var/log/mongodb/mongod.log命令来查看日志,

 Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted

详细截图如下:

解决问题:

这个问题的出现,主要是权限的问题,使用如下命令授权一下,然后重新启动即可。

chown mongod:mongod /tmp/mongodb-27017.sock

chown mongod:mongod /tmp/mongodb-27017.sock

 

[root@dev03 ~]# chown mongod:mongod /tmp/mongodb-27017.sock
[root@dev03 ~]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev03 ~]# 

 

标签: MongoDB yum Mongo-org
共有 人打赏支持
王孟君
粉丝 192
博文 92
码字总数 217217
×
王孟君
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: