Issue
I was looking at the instructions on installing Mongo on an EC2 instance. I added the following to /etc/yum.repos.d/mongodb-org-4.0.repo
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
Everything worked as expected. However, I was able to run sudo yum install mongodb-org
. I never said sudo yum install mongodb-org-4.0
like the repo file, so how is it setup such that if I run install mongodb-org
that it's linked to the mongodb-org-4.0.repo
file? I tried for example running sudo yum install mongodb-or
and it didn't do anything. There must be some linking but I don't know where it happens.
Solution
[mongodb-org-4.0]
is just the name of the repo, the package names that is available in this repo is not connected to the name of the repo.
If you go to https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/4.0/x86_64/ and into its RPMS subfolder, you will see the actual RPM packages you can install from this repository, e.g.
mongodb-org-4.0.0-1.amzn1.x86_64.rpm
Such a package name is divided into many parts. The important ones here is the package name:
mongodb-org
It's version number
4.0.0
You can have yum install that package by it's package name yum install mongodb-org
, or to get a particular version, you could do a yum install mongodb-4.0.0
.
There's other components of the rpm filenames as well, such as the first -1
which is the RPM release number, the tag amaz1
and the architecture x86_64
When using yum install, you need to provide at least a full package name or a full package name + full version when installing it. Just a partial yum install mongodb
is not going to work.
Note also that it is up to the packager what is part of a package name, one can make a package that also includes a version number, such as mongodb-4.0 , with a version number of 4.0.0. So the full filename could have been mongodb-org-4.0-4.0.0-1.amzn1.x86_64.rpm
, in this case, you would need to install it with yum install mongodb-org-4.0 or mongodb-org-4.0-4.0.0
Answered By - nos Answer Checked By - Mary Flores (WPSolving Volunteer)