yum install mongodb on aws linux fails: no package available - linux

Purpose
I'm trying to install mongodb on EC2 AWS x86_64 GNU/Linux via Yum.
Prerequisites
I created a /etc/yum.repos.d/mongodb.repo file and tried all the available combinations for it's content found on the official documentations and on the related questions on stackoverflow link1 link2 link3, for example:
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
(...tried with enabled=0, gpgcheck=0 too)
I also added a /etc/yum.conf file like this:
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
Problem
I'm getting the same output when running
sudo yum install mongodb-org (or by specifying the packages sudo yum install mongo-org mongo-org-server or by specifying the versions too sudo yum install -y mongodb-org-3.2.13 mongodb-org-server-3.2.13 mongodb-org-shell-3.2.13 mongodb-org-mongos-3.2.13 mongodb-org-tools-3.2.13)
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
No package mongodb-org available.
Error: Nothing to do
Question
What am I missing? Is there any additional dependencies?

You don't need to create a new /etc/yum.repos.d/mongodb.repo or at the time of this answer /etc/yum.repos.d/mongodb-org-3.6.repo cause it already exists but it is empty.
You can check with: cat /etc/yum.repos.d/mongodb-org-3.6.repo.
all you need to do is open the file on vi editor:
$ sudo vi /etc/yum.repos.d/mongodb-org-3.6.repo
~
~
add this code to the repository file. The one i provided is for the MongoDB 3.6 but you can find the one for earlier versions in the documentation:
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
To save and exit from vi editor check here or go ahead and do this:
ESC + :wq
After that you can proceed with the steps in the documentation or in the old C9 Forum, but here they are just in case:
$ sudo yum install -y mongodb-org
$ sudo mkdir -p /data/db
$ echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$#"' > mongod
$ chmod a+x mongod
You can start mongodb by running the mongod script on your project root:
$ ./mongod
The last command might not run the mongodb local server, and you can find the solution for that here or just go ahead and run these two commands:
$ sudo service mongod stop
$ sudo mongod

The only error I can spot is the space in "name" :
name=MongoDB Repository
With the naming changed to name=MongoDB, I did a test with CenOS 7 :
# yum search mongodb-org
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
.
mongodb-org-3.4 | 2.5 kB 00:00
updates | 3.4 kB 00:00
(1/5): mongodb-org-3.4/primary_db | 30 kB 00:00
.
=========================== N/S matched: mongodb-org ============
mongodb-org-debuginfo.x86_64 : Debug information for package mongodb-org
mongodb-org.x86_64 : MongoDB open source document-oriented database system
: (metapackage)
mongodb-org-mongos.x86_64 : MongoDB sharded cluster query router
mongodb-org-server.x86_64 : MongoDB database server
mongodb-org-shell.x86_64 : MongoDB shell client
mongodb-org-tools.x86_64 : MongoDB tools
So I guess you can now install ``mongodb-org´´.

The problem was that I wanted to do it from the default ec2_user/ home folder. You need to cd .. up to the root, and locate the etc/yum.repos.d/ folder there.

For those of you finding this error after running an ARM AMI Linux 2 image, simply install the RPMs directly from the testing repository, which is the only one that supports all binaries on Amazon AArch64:
https://repo.mongodb.org/yum/amazon/2/mongodb-org/testing/aarch64/RPMS/
For example, to install the latest mongo shell:
sudo yum install -y https://repo.mongodb.org/yum/amazon/2/mongodb-org/testing/aarch64/RPMS/mongodb-org-shell-4.4.4-0.1.rc1.amzn2.aarch64.rpm

There is a dedicated repository for AWS Linux now.
Follow the instructions from https://docs.mongodb.com/master/tutorial/install-mongodb-on-amazon/
e.g.
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

I had this happen when my install commands specified sudo yum install mongodb-org-tools-4.0.18, but yum list available | grep mongo showed only 3.6 was available. So I did sudo yum install mongodb-org-tools and that worked.

I think you try to add exclude directory from /etc/yum.conf to prevent future updates
for example:
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
But above line need to be added after perform install mongodb-org:
sudo yum install -y mongodb-org

Related

Issues installing Docker on RHEL 7 Linux Server

I have been constantly running into this issue more and more lately, and finally need some assistance because I'm completely stuck.
I just got access to a RHEL EC2 Linux server and I am just simply trying to install Docker. This process has been extremely painful lately. Tons of 404 HTTP Not Found errors when trying to follow the processes mentioned online
According to https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html, you can just simply run one of the following two commands:
sudo amazon-linux-extras install docker
sudo yum install docker
However, neither one of these comands work, as shown in the output below:
[root#d8de679d27f2454 myuser]# sudo amazon-linux-extras install docker
sudo: amazon-linux-extras: command not found
[root#d8de679d27f2454 myuser]# yum install docker
Loaded plugins: amazon-id, search-disabled-repos
No package docker available.
Error: Nothing to do
[root#d8de679d27f2454 myuser]#
Here is a list of things I've tried to do :
First Attempt (RE: How to install docker on Amazon Linux2)
The second answer proposed in that you can just run the following:
sudo yum update -y
sudo yum -y install docker
However, that doesn't work either, as shown in the output below:
[root#d8de679d27f2454 myuser]# yum update -y
Loaded plugins: amazon-id, search-disabled-repos
No packages marked for update
[root#d8de679d27f2454 myuser]# yum -y install docker
Loaded plugins: amazon-id, search-disabled-repos
No package docker available.
Error: Nothing to do
[root#d8de679d27f2454 myuser]#
Second Attempt: Installing via get.docker.com
When running curl https://get.docker.com | bash, that doesn't work either
Third Attempt: https://computingforgeeks.com/install-docker-ce-on-rhel-7-linux/
Part of this article suggests running the following two commands:
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
However, that doesn't work either:
# yum install -y yum-utils device-mapper-persistent-data lvm2
Loaded plugins: amazon-id, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
One of the configured repositories failed (Docker CE Stable - x86_64),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=docker-ce-stable ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable docker-ce-stable
or
subscription-manager repos --disable=docker-ce-stable
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=docker-ce-stable.skip_if_unavailable=true
failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/rhel/7/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Here's the output of my cat /etc/os-release command
NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
Any help would be greatly appreciated. It seems nearly impossible to install docker at this point.
Ran the following commands and this worked:
yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.0.ce-1.el7.centos.noarch.rpm
yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.0.ce-1.el7.centos.x86_64.rpm
Download latest version of these 3 packages from internet and
[root#test_hostame docker19.03_rpm]# ll
total 93904
-rw-r--r-- 1 root root 30381608 Jan 20 18:19 containerd.io-1.3.9-3.1.el7.x86_64.rpm
-rw-r--r-- 1 root root 25519432 Jan 20 18:19 docker-ce-19.03.14-3.el7.x86_64.rpm
-rw-r--r-- 1 root root 40247412 Jan 20 18:19 docker-ce-cli-19.03.14-3.el7.x86_64.rpm
run command in folder where only these 3 packages are present
yum localinstall *rpm
It is surely gonna work. If it doesnt, share your error.

Unable to install libsasl2-devel on Amazon Linux 2 machine

I am running Ansible playbook and trying to install OS dependencies packages for python. I am trying to run the following:
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
However, it fails at installing libsasl2-devel with the message:
"No package matching 'libsasl2-devel' found available, installed or updated"
All my instances are Amazon Linux 2 machines. Is there any alternative package for this? I tried to look into this but I found solutions for Ubuntu only.
I was able to get it to work in a series of steps. Its a yum issue after other databases are installed and not cleaned up before installing mysql
clear sasl first: sudo yum remove cyrus-sasl
if you have installed maria, there will be conflicts, remove that as well
sudo yum remove mariadb mariadb-server mariadb-libs
take note of anything uninstalled by this to re-add later. If this is too much, you can take a risk and not remove sasl, but it might not reset the availability of the package.
Start here to clean up the dependency issues: https://serverfault.com/questions/873955/how-solve-mysql-5-7-dependency follow the command given by clean all as sudo rm -rf /var/cache/yum/*
This can possibly resolve your issues right there, if not continue the installation below.
delete all data left in /var/lib/mysql/ or you may have upgrade issues.
resinstall sasl:
sudo yum install cyrus-sasl cyrus-sasl-devel and any other packages removed above.
Establish mysql5.7 with the yum services.
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
sudo yum localinstall -y mysql57-community-release-el6-11.noarch.rpm
sudo yum repolist enabled | grep "mysql.*-community.*"
sudo yum repolist enabled | grep mysql
sudo yum install -y mysql-community-common mysql-community-libs mysql-community-server mysql-community-client
if that doesn't work, re-clear the yum cache again and re-run sudo yum install -y mysql-community-server
if that works, then
sudo service mysqld start
IF the /var/lib/mysql is empty, it will have created a temporary password in the /var/log/mysqld.log (use sudo to read)
run sudo mysql_secure_installation and establish your real password and security settings.
now you should have access via mysql -u root -p

Installing MongoDB via yum on AWS linux fails: HTTPS Error 404 - Not Found

I was trying to install mongodb#3.4 via yum on my server by following the steps on MongoDB Doc. First, I created a file called mongodb-org-3.4.repo in /etc/yum.repos.d/ directory and copied the text as below.
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Then I tried sudo yum install mongodb-org but got an error on it.
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
One of the configured repositories failed (MongoDB),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Disable the repository, so yum won't use it by default. Yum will then
just ignore the repository until you permanently enable it again or use
--enablerepo for temporary usage:
yum-config-manager --disable mongodb-org-3.4
4. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=mongodb-org-3.4.skip_if_unavailable=true
failure: repodata/repomd.xml from mongodb-org-3.4: [Errno 256] No more mirrors to try.
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
After that, I tried yum repolist and found out the status of MongoDB get 0.
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
https://repo.mongodb.org/yum/redhat/latest/mongodb-org/3.4/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
nodesource/x86_64 | 2.5 kB 00:00
repo id repo name status
amzn-main/latest amzn-main-Base 5,668
amzn-updates/latest amzn-updates-Base 435
mongodb-org-3.4/latest MongoDB 0
nodesource/x86_64 Node.js Packages for Enterprise 61
repolist: 6,164
I wonder whether that repo is still valid or not? Thank you~
Here's my server OS version:
NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2017.03
Please try this,
sudo rm -rf /etc/yum.repos.d/mongod*
sudo yum clean all
again create repo file
sudo vi /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
sudo yum install -y mongodb-org
updated to March/2018
sudo nano /etc/yum.repos.d/mongodb-org-3.6.repo
add (or replace) the mongo repo configuration:
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
now, you're able to do a
yum repolist
and
sudo yum install -y mongodb-org
I think you try to add exclude directory from /etc/yum.conf to prevent future updates
for example:
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
But above line need to be added after perform install mongodb-org:
sudo yum install -y mongodb-org
So, remove the exclude line from /etc/yum.conf to make the mongodb-org package available

Why couldn't the latest version of rsync be installed on CentOS 7.2?

I am using CentOS 7.2.
I would like to install the latest version of rsync - rsync-3.1.2,
rsync-3.0.9 is on system, installed when installing mariadb with yum,
# rpm -qa |grep rsync
rsync-3.0.9-17.el7.x86_64
removing rsync-3.0.9 first,
# yum remove rsync
rsync and mariadb were removed together,
then,
installing rsync-3.1.2 from source code,
# wget https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz
# tar -zxvf rsync-3.1.2.tar.gz
# cd rsync-3.1.2
# ./configure
# make
# make install
then,
installing mariadb with yum again,
but rsync-3.0.9 will still be installed.
How can I solve the problem?
You can install rsync 3.1.2 from the Fedora 24 .rpm package:
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/24/Everything/x86_64/os/Packages/r/rsync-3.1.2-2.fc24.x86_64.rpm
rpm -Uvh rsync-3.1.2-2.fc24.x86_64.rpm
(but that question doesn't really belong to stackoverflow)
You can install rsync 3.1.2 from the gf-plus repo. Just follow the steps below:
Install the gf-release package.
sudo rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-10.gf.el7.noarch.rpm
Upgrade rsync package from the gf-plus repo.
sudo yum install -y --enablerepo=gf-plus rsync
Check rsync version.
hash -r; rsync --version | awk 'NR==1 {print $3}'
If it prints 3.1.2, rsync is upgraded.
By default, only the gf repo is enabled, which claims that it "won't overwrite core distro packages". You can disable it:
sudo yum-config-manager --disable gf
(For command not found error, run sudo yum install -y yum-utils and try again.)
Or simply remove all the gf* repos by removing the gf-release package:
sudo yum remove -y gf-release
You either need to install all of your software using packages, or install all of your software from source. Trying to mix and match is going to lead to exactly the sort of problem you are experiencing here: the mariadb package has a dependency on rsync, but the package manager doesn't know anything about the files you have installed from source.
The correct way to solve this problem is to build your own rsync package that can then be installed with yum. You can start with the source package for your distribution and then modify it for 3.1.2. You may be able to utilize a more recent package (e.g., from Fedora) and rebuild it for your system.
You can find the source RPM for rsync-3.0.9 here, and there is some documentation that will hopefully help you get started here.

yum + what is the message - No package ansible available

I am try to install the ansible tool on my linux red-hat version - 5.7
yum install ansible
Loaded plugins: security
Setting up Install Process
No package ansible available.
Nothing to do
ansible isnt installed on my linux machine - for sure!
so why I get - No package ansible available. and how to resolve this?
the view from yum.repos.d is:
/etc/yum.repos.d]# ls
rhel-debuginfo.repo rhel-source.repo service-cd-repo.repo stp-default- repo.repo
I have resolving as the following:
ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=50 time=63.4 ms
Update - try to install epel-release package
yum install epel-release
Loaded plugins: security
service-cd | 951 B 00:00
swp-default | 951 B 00:00
Setting up Install Process
No package epel-release available.
Nothing to do
second update:
wget --no-check-certificate https://dl.fedoraproject.org/pub/epel/epel- release-latest-5.noarch.rpm
--2015-08-17 14:54:20-- https://dl.fedoraproject.org/pub/epel/epel- release-latest-5.noarch.rpm
Resolving dl.fedoraproject.org... 209.132.181.26, 209.132.181.27, 209.132.181.25, ...
Connecting to dl.fedoraproject.org|209.132.181.26|:443... connected.
WARNING: cannot verify dl.fedoraproject.org's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Hig:
Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 12232 (12K) [application/x-rpm]
Saving to: `epel-release-latest-5.noarch.rpm'
100% [==========================================================================================>] 12,232 54.0K/s in 0.2s
2015-08-17 14:54:22 (54.0 KB/s) - `epel-release-latest-5.noarch.rpm.1' saved [12232/12232]
rpm -ivh epel-release-latest-5.noarch.rpm
warning: epel-release-latest-5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
yum repolist
Loaded plugins: security
epel | 3.7 kB 00:00
service-cd | 951 B 00:00
swp-default | 951 B 00:00
repo id repo name status
epel Extra Packages for Enterprise Linux 5 - i386 5,411
service-cd RHEL5 service-cd repository 155
swp-default RHEL5 yum repository 239
repolist: 5,805
yum install ansible
Loaded plugins: security
Setting up Install Process
No package ansible available.
Nothing to do
Ansible is part of the Extra Packages for Enterprise Linux (EPEL) repository so you need to install epel-release package first
$ sudo yum install epel-release
The repo should now be visible in the repo list
$ sudo yum repolist
So now you can go ahead and install ansible
$ sudo yum install ansible
Before RHEL 7.x, the installtion needed to be done manually.
Open install epel-release package and download the newest version of epel-release for EL5 or follow the commands below
$ wget https://archives.fedoraproject.org/pub/archive/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ sudo rpm –ivh epel-release-latest-5.noarch.rpm
$ sudo yum repolist
$ sudo yum install ansible
In the installation manual for ansible, this is referred to as configure EPEL
Hope this helps :)
Response to second update
When installing manually you may also need to expire your cache and recreate the the local repository database before you can install software from EPEL. That can be done with the following
$ yum clean expire-cache
$ yum createrepo
EPEL is required for this.
Follow these steps for installing Ansible for Red Hat Enterprise Linux Server release 7
Based on the redhat version, follow
Enabline EPEL
1. yum -y update
2. yum install wget
3. wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
4. rpm -ivh epel-release-7-11.noarch.rpm
5. yum repolist
6. yum install ansible

Resources