How to install google-cloud-sdk on RHEL 9 - gcloud

Install google-cloud-sdk on Redhat 9 latest stable release
System information
cat /etc/redhat-release
Red Hat Enterprise Linux release 9.0 (Plow)
uname -r
5.14.0-70.17.1.el9_0.x86_64
Output from installation attempt sudo dnf install google-cloud-cli
Error: GPG check FAILED
Contents of yum repo (modified el8 to el9 - location exists)
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

It seems to be caused by the fact that RHEL 9 deprecated using SHA-1 for GPG signatures. It's mentioned here - https://access.redhat.com/articles/6846411
Strangely, even if you try to disable the GPG check using the flag, it will still not work:
sudo dnf install --nogpgcheck google-cloud-cli
Error: Transaction test error:
package google-cloud-cli-396.0.0-1.x86_64 does not verify: Header V4 RSA/SHA1 Signature, key ID 3e1ba8d5: BAD
However, I've found a solution - you can temporarily allow using SHA-1, install google-cloud-sdk and then revert the setting like this:
sudo update-crypto-policies --set DEFAULT:SHA1
sudo dnf install google-cloud-cli
sudo update-crypto-policies --set DEFAULT:NO-SHA1
That has just worked for me on RHEL 9.0.

Related

Try to install snapd but giving `conflicting requests` error

I am trying to install snapd but giving this error.
Operating System - Red Hat Enterprise Linux release 8.6 (Ootpa)
Error:
Problem: package snapd-2.57.6-2.el8.x86_64 requires snapd-selinux = 2.57.6-2.el8, but none of the providers can be installed
- conflicting requests
- nothing provides selinux-policy >= 3.14.3-108.el8 needed by snapd-selinux-2.57.6-2.el8.noarch
- nothing provides selinux-policy-base >= 3.14.3-108.el8 needed by snapd-selinux-2.57.6-2.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
I have the same problem. There's a long discussion about this here: https://forum.snapcraft.io/t/trouble-installing-snapd-on-rhel-8/13140/2. It looks like the only way to do it, if you can install all the necessary build tools, is to build from sources, as one of the posts there suggests.(I couldn't do it on my system because it's having subscription management issues.)
I also tried using CR repository, as suggested in the instructions for CentOS here: https://snapcraft.io/docs/installing-snap-on-centos, but that didn't work for me, either (I guess it's really just for CentOS and not RHEL).
UPDATE:
I finally found a solution (where there's a will...)! I manually installed all the requirements, one by one, that weren't available in the epel-release repo. My process was the following:
wget https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/rpm-4.14.3-19.el8.x86_64.rpm
wget https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/rpm-libs-4.14.3-19.el8.x86_64.rpm
wget https://dl.rockylinux.org/pub/rocky/8/BaseOS/aarch64/os/Packages/s/selinux-policy-3.14.3-108.el8.noarch.rpm
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libsemanage-2.9-9.el8.x86_64.rpm --allowerasing -y
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/policycoreutils-2.9-19.el8.x86_64.rpm -y
sudo rpm -i --force rpm-4.14.3-19.el8.x86_64.rpm
sudo rpm -i --force rpm-libs-4.14.3-19.el8.x86_64.rpm
sudo rpm -i --force selinux-policy-3.14.3-108.el8.noarch.rpm
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/python3-libsemanage-2.9-9.el8.x86_64.rpm -y
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/python3-policycoreutils-2.9-19.el8.noarch.rpm -y
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/policycoreutils-python-utils-2.9-19.el8.noarch.rpm -y
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/selinux-policy-minimum-3.14.3-108.el8.noarch.rpm -y
sudo yum install http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/libseccomp-2.5.2-1.el8.x86_64.rpm -y
sudo yum install https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/snapd-selinux-2.57.6-2.el8.noarch.rpm -y
sudo yum install snapd -y
sudo yum update snapd -y
It's conceivable that on your system something else will be missing. If you run into an error telling you that nothing provides package XYZ, you can find it here: https://centos.pkgs.org/8-stream/centos-baseos-x86_64/ and simply sudo yum install directly from the binary package URL; e.g.:
That's exactly what my process was, and here's what I have now:
$ cat /etc/redhat-release (base)
Red Hat Enterprise Linux release 8.2 (Ootpa)
$ snap --version (base)
snap 2.57.6-2.el8
snapd 2.52.1
series 16
rhel 8.2
kernel 4.18.0-193.6.3.el8_2.x86_64

Why is installing PostGIS 3 on RHEL 8 / CentOS 8 impossible?

I am attempting to install the latest PostGIS 3.0.x on CentOS 8, with no luck.
I don't think anyone is running PostGIS on RHEL 8 or CentOS 8, I can't understand why not. It does not seem possible to install.
I have successfully installed Postgres 12.0 by disabling the RHEL AppStream
Steps I took installing postgres 12 on CentOS 8:
1)
#dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
2)
#dnf --disablerepo AppStream install postgresql12
#dnf --disablerepo AppStream install postgresql12-server
I am attempting now to install PostGIS.
#dnf list --available | grep postgis30
I see that postgis30_96 is the latest offered (as listed below):
postgis30_96.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-client.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-client-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-devel.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-docs.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-gui.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-gui-debuginfo.x86_64 3.0.0alpha4-6.rhel8 pgdg96
postgis30_96-utils.x86_64 3.0.0alpha4-6.rhel8 pgdg96
When I try to install with the following command:
#dnf install postgis30_96
I get these errors:
Last metadata expiration check: 1:22:58 ago on Tue 15 Oct 2019 08:25:10 PM UTC.
Error:
Problem: cannot install the best candidate for the job
- nothing provides hdf5 needed by postgis30_96-3.0.0alpha4-6.rhel8.x86_64
- nothing provides xerces-c needed by postgis30_96-3.0.0alpha4-6.rhel8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
I look for xerces-c, and nothing is returned:
#dnf list --available | grep xerces-c
Where do I get xerces-c to install?
I look to see if hdf5 is available to install (dependency)
#dnf list --available | grep hdf5
and nothing is returned. How do I satisfy these dependencies, so that PostGIS will install?
I goto the hdf5 website, download the source and it's a BIG FAT MESS. The build/install instructions do not work - the code is out of sync with the install instructions.
I check the hdf5 website and find another set of build/install instructions, and they too are out of sync with the latest code base. I don't know which way is up with this project, if it's a zombie project out there on the web, seemingly alive, but nobody's home.
How do I get hdf5 easily onto my system and xerces-c so that nothing existing gets mucked up? I would prefer to install these through any somewhat sanctioned CentOS 8 package repo using dnf.
I can't log this issue on the PostGIS ticket tracking system. Logging a ticket there requires an OSGEO ID, and when I request a 'mantra' to get started, nothing is returned, no response,
OSGEO is yet another zombie project, nobody's home. https://www.osgeo.org/community/getting-started-osgeo/osgeo_userid/
Please respond only if you have actually done this yourself on a CentOS 8 machine or VM, while I appreciate suggestions, pointers or imaginations from others, it pollutes r/postgis reddit with misinformation, non-working solutions, and not only wastes my time with dead ends, but also the time of others.
Someone else inevitably comes along with the same problems and is misguided with these those that are well-intentioned, but provide incorrect or incomplete information.
I had the same problem and finally found the solution. I need postgis25 for postgresql10, so I typed this command
dnf --enablerepo=PowerTools install postgis25_10
The PowerTools repo has the packages from codeready-developer repo, from Redhat CodeReady Studio. It contains a lot of useful tools.
Cannot enable PowerTools for RHEL 8
https://access.redhat.com/discussions/5417621
Remarks: PowerTools is a CentOS repository. On RHEL 8 we have the CodeReady Builder repository!
I am now able to install PostGIS-3 for PostgreSQL-12 on RHEL-8.
Solution:
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
dnf install postgis30_12
Summing up the previous answers, these are the commands needed to install PostGIS-3 on CentOS-8:
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf --enablerepo=PowerTools install postgresql12-server postgresql12-contrib postgis30_12
Many of the answers were helpful. To sum up the steps I had to take and errors in the instructions at https://people.planetpostgresql.org/devrim/index.php?/archives/107-Installing-PostGIS-3.1-and-PostgreSQL-13-on-CentOS-8.html
As mentioned by Marcelo, for RHEL use code-ready, not powertools.
As mentioned in this thread, don't mix packages. Run dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
to get the pgdg repo before installing postgres. Then run dnf -qy module disable postgresql if needed then install postgres like sudo dnf install -y postgresql13-server
The command to install epel-repo listed here may not work. Try sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Get the name of the latest postgis release with this command. sudo dnf list --available | grep postgis3 As mentioned by Nick, the second two digits are your postgres version.
Install postgis sudo dnf -y install postgis3x_xx I repeat, the second two digits are your postgres version.
So, in summary, to install postgres and postgis on my rhel8 sytstem, I ran these commands in this order.
sudo dnf -qy module disable postgresql
sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf install -y postgresql13-server
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl enable postgresql-13
sudo systemctl start postgresql-13
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
sudo dnf -y install postgis31_13
The postgis30_96 packages are for Postgres 9.6. You need postgis30_12 for Postgres 12.
These packages are definitely in the repo, so if your dnf list isn't seeing them, it may be an instance of a known issue in which "yum/dnf refuse to find/install many packages from PGDG repository on RHEL8".
As a workaround, the Postgres Yum Howto recommends this installation procedure:
dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
dnf install postgresql11-server postgresql11-contrib
Percona Postgresql 13 And Postgis 3.0
https://www.percona.com/doc/percona-repo-config/index.html
dnf remove postgresql
sudo dnf install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
sudo percona-release setup ppg-13
You can refer here:
https://www.percona.com/doc/postgresql/LATEST/installing.html#using-the-rpm-format
sudo dnf module disable postgresql
sudo dnf install percona-postgresql13-server
sudo dnf install percona-pg_repack13
sudo dnf install percona-pgaudit
sudo dnf install percona-pgbackrest
sudo dnf install percona-patroni
sudo dnf install percona-pg-stat-monitor13
sudo dnf install percona-postgresql13-contrib
/usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl start postgresql-13
PostGIS
dnf -y config-manager --set-enabled PowerTools
dnf install -y postgis30_13 postgis30_13-client
What helped me in CentOS container (as a root):
yum -y install dnf-plugins-core && yum config-manager --set-enabled powertools
Installing dnf-plugins-core and enabling powertools.

how to install php 5.6 on ubuntu 16.04 running Virtualmin Control Panel

i have tried a number of times to get php 5.6 working on ubuntu 16.04
I keep getting a server error 500 when trying to browse http:/domain.com/phpinfo.php to check which version of php is active (server also has 7.0, 7.1, & 7.2)
I also have same error when attempting to run php 7.1 (7.0 & 7.2 are working no problems and i have websites running on the virtualmin server.
I have looked at various answers about this kind of thing here but in all honesty, the answers are often so broken and different i cant find a single procedure that is reliable and works.
Anyone help with this?
For example, will the following ispconfig 3 tutorial, which installs php5.6 in /opt directory, work with virtualmin? ( https://www.howtoforge.com/tutorial/how-to-install-php-5-6-on-ubuntu-16-04/ )
My assumption is that the above tutorial will work and i just need to tell virtualmin where the php 5.6 binaries are located in /opt/? ( see this thread... https://www.virtualmin.com/node/40004 )
By default, Ubuntu 16.04 server assigns the PHP 7.07 or higher version. If you want to allow/assign PHP 5.6 on your server then you will have to install it manually from the following command:
Step 1: Step 1: Update Apt-Get
Linux command: apt-get update && apt-get upgrade.
Step 2: Install PHP 5.6
Install the PHP5.6 repository with these two commands.
Linux command:
apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php5.6
Step 3: Switch PHP 7.0 to PHP 5.6
Switch from PHP 7.0 to PHP 5.6 while restarting Apache to recognize the change:
a2dismod php7.0 ; a2enmod php5.6 ; service apache2 restart
Verify that PHP 5.6 is running on Apache by putting up a PHP info page. To do so, use the code below in a file named as infopage.php and upload it to the /var/www/html directory.
<? phpinfo(); ?>
First add the ppa:ondrej/php repository:
sudo -s
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ondrej/php
If at this point it throws a CPG error like:
Reading package lists... Done
W: GPG error: http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY <THE_KEY>
W: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
..pay attention in the 2nd line showing THE_KEY, then solve with:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <THE_KEY>
Finally:
apt-get update
apt-get install -y php5.6
php -v

Installing PostgreSQL Client v10 on AWS Amazon Linux (EC2) AMI

I have successfully launched new AWS RDS PostgreSQL v10 instance and need to install PostgreSQL v10 client on Amazon Linux EC2 instance.
I have tried to install it with yum, but it cant find the package for v10:
[ec2-user#ip-X-X-X-X ~]$ sudo yum install -y postgresql10
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
No package postgresql110 available.
Error: Nothing to do
Previously I managed to install PostgreSQL client v9.5 with:
[ec2-user#ip-X-X-X-X ~]$ sudo yum install -y postgresql95
I guess I need to add Postgres yum repository, as mentioned in https://www.postgresql.org/download/linux/redhat/. But what Platform should I choose for Amazon Linux? Red Hat?
You can try to run the following command on your Linux server:
sudo amazon-linux-extras install postgresql10
Packages/Repos which is designed to work of RedHat will work on Amazon Linux also, Amazon Linux is a minimal-install version of RHEL. You may run into compatibility issues if you select old version of Amazon Linux (Amazon linux 1) for the below steps, otherwise it should work fine in the latest version Amazon Linux 2.
Check Amazon Linux version
[ec2-user ~]$ cat /etc/system-release
Amazon Linux release 2.0 (2017.12) LTS Release Candidate
Install RHEL 7 yum repo for PostgreSQL
[ec2-user ~]$ sudo yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-2.noarch.rpm
[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-latest-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"
Install PostgreSQL Client v10
[ec2-user ~]$ sudo yum install -y postgresql10
[ec2-user ~]$ psql --version
psql (PostgreSQL) 10.3
Read more about Amazon Linux 2
Note! Amazon Linux 2 provides additional package installation through Amazon Linux Extras Repository (amazon-linux-extras) ((client only)). Since postgresql10 is not yet available, adding extra yum repo is the only solution per today.
UDATE 2019May
those who see
Error: Package: pgdg-redhat-repo-42.0-4.noarch
(/pgdg-redhat-repo-latest.noarch)
Requires: /etc/redhat-release
may still install step by step all dependencies and the server with:
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-libs-10.7-2PGDG.rhel7.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-10.7-2PGDG.rhel7.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-latest-x86_64/postgresql10-server-10.7-2PGDG.rhel7.x86_64.rpm
Since none of the previous answers worked for me, I'm adding a solution that let me install the postgresql10 client. We're using VERSION="2018.03" of Amazon Linux AMI in our pipelines.
Building from source:
Note: The link below points to postgresql 10.4, you may want to check for newer subversions
sudo yum install -y gcc readline-devel zlib-devel
wget https://ftp.postgresql.org/pub/source/v10.4/postgresql-10.4.tar.gz
tar -xf postgresql-10.4.tar.gz
cd postgresql-10.4
./configure
make -C src/bin
sudo make -C src/bin install
make -C src/include
sudo make -C src/include install
make -C src/interfaces
sudo make -C src/interfaces install
make -C doc
sudo make -C doc install
The new package should be installed with all its executables in here: /usr/local/pgsql/bin
Now, keep in mind that commands psql, pg_dump etc. still point to the old version of the psql client. You can run with the full executable paths (/usr/local/pgsql/bin/psql) or prepend the new directory at the beginning of your $PATH so that the system will look it up first:
Edit ~/.bash_profile adding this at the end:
export PATH="/usr/local/pgsql/bin:$PATH"
Then run:
source ~/.bash_profile
Now everything should be ready:
[ec2-user#ip-xx-x-x-xxx ~]$ psql --version
psql (PostgreSQL) 10.4
Adapting Haneef Mohammed's answer for Amazon Linux 1 (tested on 2018.03):
Go to the Postgres repositories page and grab the URL for 'Red Hat Enterprise Linux 6 - x86_64'. Install the PG repos and amend the entries, replacing '$releasever' with '6.9' (or newer?):
[ec2-user ~]$ sudo yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm
[ec2-user ~]$ sudo sed -i "s/rhel-\$releasever-\$basearch/rhel-6.9-x86_64/g" "/etc/yum.repos.d/pgdg-10-redhat.repo"
Second part is the same:
[ec2-user ~]$ sudo yum install -y postgresql10
[ec2-user ~]$ psql --version
psql (PostgreSQL) 10.3
PGDG repo is no longer available for Amazon Linux. So you can use amazon repo.
amazon-linux-extras install postgresql10 vim epel -y
Or follow this article
https://installvirtual.com/install-postgresql-10-on-amazon-ec2/
As of May 25th, 2019, the following direct RPM installation worked for me on Amazon Linux 1 2018.03 (latest Beanstalk platform version) to install PostgreSQL Client 10.7:
sudo rpm -ivh --force https://yum.postgresql.org/testing/10/redhat/rhel-6-x86_64/postgresql10-libs-10.7-2PGDG.rhel6.x86_64.rpm
sudo rpm -ivh --force https://yum.postgresql.org/testing/10/redhat/rhel-6-x86_64/postgresql10-10.7-2PGDG.rhel6.x86_64.rpm
PSql10.7 installation (08/20/2019)
Remove all of the older version Psql client and perform the below steps:
wget https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
wget https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
This my 2019 solution:
Just do
sudo amazon-linux-extras install postgresql9.6
You should not have to download it from any outside source, since it is already given to you by default from Amazon, all you have to do is install it.
The other solutions didnt work for me and I spent a good amount time banging my head against the wall trying to figure out why.
And surprisingly even though you install psql9.6 you get version 10.
The following works for psql v11 on Amazon Linux (v1)
wget https://yum.postgresql.org/11/redhat/rhel-6.9-x86_64/postgresql11-libs-11.8-1PGDG.rhel6.x86_64.rpm
wget https://yum.postgresql.org/11/redhat/rhel-6.9-x86_64/postgresql11-11.8-1PGDG.rhel6.x86_64.rpm
sudo yum clean all
sudo rpm -ivh postgresql11-libs-11.8-1PGDG.rhel6.x86_64.rpm
sudo rpm -ivh postgresql11-11.8-1PGDG.rhel6.x86_64.rpm
The way I resolved the issue was by running
yum clean all
before
yum install -y postgresql10
on Amazon Linux
for v11 on Amazon Linux 2 I had to do
yum -y install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm
sed -i "s/rhel-\$releasever-\$basearch/rhel-7-x86_64/g" "/etc/yum.repos.d/pgdg-11-centos.repo"

yum install mongodb 3.2 fails

I am trying to install mongodb 3.2 on a CentOS 7 machine and facing issues in locating the packages.
I have updated the repo file as per the documentation:
[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
When running sudo yum install mongodb-org I am getting this error:
[centos#ip-10-24-1-228 ~]$ sudo yum install mongodb-org
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.osuosl.org
* epel: linux.mirrors.es.net
* extras: mirror.lax.hugeserver.com
* updates: mirror.hmc.edu
No package mongodb-org available.
Error: Nothing to do
Why do I get this message?
You need to configure the package management system (yum).
Create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration information for the MongoDB repository:
If you have a 64bit system, use the following config:
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
32bit isn't recommended for production deployments, but you may use:
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1
When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.
To install the latest stable version of MongoDB, run:
sudo yum install mongodb-org
To install a specific release of MongoDB, specify each component package individually and append to it the version number to the package name, as in the following example that installs the 3.2.0 release:
yum install mongodb-org-3.2.0 mongodb-org-server-3.2.0 mongodb-org-shell-3.2.0 mongodb-org-mongos-3.2.0 mongodb-org-tools-3.2.0
If you are still stuck, following this carefully might be helpful.
I figured out what was my problem. It was in my yum.conf file
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
Once I commented out this line from yum.conf, everything went fine.
You should know that this URL https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ is not working anymore.
Go to http://repo.mongodb.org/yum/redhat/ and download mongodb-org.repo file.
Configure the package management system (yum), copy mongodb-org.repo to /etc/yum.repos.d/, so that you can install MongoDB directly, using yum.
Install the MongoDB packages and associated tools.
sudo yum install -y mongodb-org mongodb-org-server
Unfortunatelly mongodb website documentation suggests using https://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat/, but this is wrong way.
This is a more recent version of Idos answer from Install MongoDB Community Edition on Red Hat Enterprise or CentOS Linux.
Configure the package management system (yum).
Create a /etc/yum.repos.d/mongodb.repo file so that you can install MongoDB directly, using yum.
For MongoDB 3.6
Use the following repository file:
[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
For versions of MongoDB earlier than 3.6
To install the packages from an earlier release series such as 3.4, you can specify the release series in the repository configuration. For example, to restrict your system to the 3.4 release series, create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration information for the MongoDB 3.4 repository:
[mongodb-org-3.4]
name=MongoDB 3.4 Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=0
enabled=1
You can find .repo files for each release in the repository itself. Remember that odd-numbered minor release versions (e.g. 3.5) are development versions and are unsuitable for production use.
Install the MongoDB packages.
To install the latest stable version of MongoDB, issue the following command:
sudo yum install -y mongodb-org
To install a specific release of MongoDB, specify each component package individually and append the version number to the package name, as in the following example:
sudo yum install -y mongodb-org-3.6.4 mongodb-org-server-3.6.4 mongodb-org-shell-3.6.4 mongodb-org-mongos-3.6.4 mongodb-org-tools-3.6.4
When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.
Start MongoDB.
You can start the mongod process by issuing the following command:
sudo service mongod start
I know this issue is old and more than 2 years but I have received this error recently in Mongo DB 4.0
I have checked my yum.conf by
vi /etc/yum.conf yum.conf
and there was one line with the following.
exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* **mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools** mydns* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
Removed the
mod_ssl* mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools
and changed it to
exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
This has fixed my issue and should fix yours.
Hello Friend i will resoled problem
First Clean old data
sudo yum erase $(rpm -qa | grep mongod)
sudo rm -rf /etc/yum.repos.d/mongod*
sudo yum clean all
again create repo file new
/etc/yum.repos.d/mongodb-enterprise-4.4.repo
file so that you can install MongoDB enterprise directly using yum:
[mongodb-enterprise-4.4]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/4.4/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
Install MongoDB Enterprise 4.4.
Issue the following command:
sudo yum install -y mongodb-enterprise
Install a specific release of MongoDB Enterprise.
To install a specific release, you must specify each component package individually along with the version number, as in the following example:
sudo yum install -y mongodb-enterprise-4.4.1 mongodb-enterprise-server-4.4.1 mongodb-enterprise-shell-4.4.1 mongodb-enterprise-mongos-4.4.1 mongodb-enterprise-tools-4.4.1
If you only install mongodb-enterprise=4.4.1 and do not include the component packages, the latest version of each MongoDB package will be installed regardless of what version you specified.
Pin a specific version of MongoDB Enterprise.
Although you can specify any available version of MongoDB Enterprise, yum upgrades the packages when a newer version becomes available. To prevent unintended upgrades, pin the package by adding the following exclude directive to your /etc/yum.conf file:
exclude=mongodb-enterprise,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mongos,mongodb-enterprise-tools
By default, MongoDB runs using the mongod user account and uses the following default directories:
/var/lib/mongo (the data directory)
/var/log/mongodb (the log directory)
➤ If you installed via the package manager,
The default directories are created, and the owner and group for these directories are set to mongod.
➤ If you installed by downloading the tarballs,
The default MongoDB directories are not created. To create the MongoDB data and log directories:
sudo mkdir -p /var/lib/mongo
sudo mkdir -p /var/log/mongodb
sudo systemctl daemon-reload
sudo systemctl start mongod
Any Error Come than ones Clean old
Option:- not create socket file than /tmp
in old socket file remove
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo service mongod status
more info to read https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-red-hat/
https://www.mysterydata.com/how-to-install-mongodb-4-0-on-centos-7-rhel-7/
#nikolai.serdiuk seems to be correct. The baseurl provided in Mongo's Documentation doesn't seem to be functional. Replace that step with this instead (1):
yum-config-manager --add-repo http://repo.mongodb.org/yum/redhat/mongodb-org.repo
and then continue on with (2):
sudo yum install -y mongodb-org
Hope this helps.
Create a mongodb-org.repo file
sudo vi /etc/yum.repos.d/mongodb-org.repo
Add following content
[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
Then execute sudo yum install mongodb-org
Reference:docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
first you have to create repo in your redhat system.
cd /etc/yum.repos.d/mongodb-org.repo
and Enter i, and copy-past this.
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
and save it like- enter ctrl + : and enter : + qw
and run this command
yum install mongodb-org
Check and remove old version mongodb
yum list installed mongodb.x86_64
yum remove mongodb.x86_64
It helps
Hello Friend i will resoled problem
First Clean old data
sudo rm -rf /etc/yum.repos.d/mongod*
sudo yum clean all
again create repo file new
/etc/yum.repos.d/mongodb-enterprise-4.4.repo
file so that you can install MongoDB enterprise directly using yum:
[mongodb-enterprise-4.4]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/4.4/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
Install MongoDB Enterprise 4.4.
Issue the following command:
sudo yum install -y mongodb-enterprise
Install a specific release of MongoDB Enterprise.
To install a specific release, you must specify each component package individually along with the version number, as in the following example:
sudo yum install -y mongodb-enterprise-4.4.1 mongodb-enterprise-server-4.4.1 mongodb-enterprise-shell-4.4.1 mongodb-enterprise-mongos-4.4.1 mongodb-enterprise-tools-4.4.1
If you only install mongodb-enterprise=4.4.1 and do not include the component packages, the latest version of each MongoDB package will be installed regardless of what version you specified.
Pin a specific version of MongoDB Enterprise.
Although you can specify any available version of MongoDB Enterprise, yum upgrades the packages when a newer version becomes available. To prevent unintended upgrades, pin the package by adding the following exclude directive to your /etc/yum.conf file:
exclude=mongodb-enterprise,mongodb-enterprise-server,mongodb-enterprise-shell,mongodb-enterprise-mongos,mongodb-enterprise-tools
By default, MongoDB runs using the mongod user account and uses the following default directories:
/var/lib/mongo (the data directory)
/var/log/mongodb (the log directory)
➤ If you installed via the package manager,
The default directories are created, and the owner and group for these directories are set to mongod.
➤ If you installed by downloading the tarballs,
The default MongoDB directories are not created. To create the MongoDB data and log directories:
sudo mkdir -p /var/lib/mongo
sudo mkdir -p /var/log/mongodb
sudo systemctl daemon-reload
sudo systemctl start mongod
Any Error Come than ones Clean old
Option:- not create socket file than /tmp
in old socket file remove
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo service mongod status
This command
yum-config-manager --add-repo http://repo.mongodb.org/yum/redhat/mongodb-org.repo
will create the repo as above suggested. Then it will work.
Follow the below steps to install MongoDB on CentOS
Add MongoDB yum repository
# vi /etc/yum.repos.d/mongodb.repo
Enter i and paste the below lines in the file
[MongoDB]
name=MongoDB Repository
baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=0
enabled=1
Press esc to save the vim file then enter :wq to quit the saved file.
3.Install MongoDB server
yum install mongodb-org
Start MongoDB Service
# systemctl start mongod.service # For CentOS 7
# service mongod restart # For CentOS 6/5
Check Mongod version
mongod --version
Referance: Installing MongoDB on CentOS