Since it is possible to mongodump/mongorestore remotely, it makes sense to have them installed in a machine that is not the DB itself, right?
Is there a way to install a standalone mongodump executable?
Eg. in order to dockerize my DB backup tool
Ubuntu has the tools separate: mongodb-org-tools
Alpine also has an edge/community package: mongodb-tools
I am using the node:alpine Docker to run mongodump/restore and upload to S3, it works well.
You could also try installing and then copying the binaries, but I imagine they have a lot of dependencies so you might as well find a way to use the tools package, or you'll be creating your own.
mongo-tools since Ubuntu 18.04: https://launchpad.net/ubuntu/bionic/+package/mongo-tools
sudo apt install mongo-tools
Accepted answer did not work for me on a fresh install of Ubuntu 22.04.
E: Unable to locate package mongodb-org-tools
Following the instructions on the official MongoDB page worked.
Note that instructions are for installing MongoDB and optionally the tools. If you just want mongodump you can follow steps 1 to 3 and then run sudo apt install mongodb-org-tools
Here are the 3 steps for reference (Ubuntu 20.04, tested on 22.04):
Import the public key used by the package management system.
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
Create a list file for MongoDB.
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Reload local package database
sudo apt-get update
Then install the tools:
sudo apt install mongodb-org-tools
You can perform backup of remote cluster using mongodump.
Command is :
/path/to/mongodump --host remote_cluster_hostname --port remote_cluster_port>
For Installing only mongodump utility below steps can be performed:
Step 1: Install Mongodb rpm, but don't start mongod process.
In a linux system if you have installed mongodb using rpm package, you should not start mongod process.
You can find the location of mongodump using this command: which mongodump
And use mongodump to perform remote backup.
Step 2:Use Zip packages of mongodb binaries instead of installing mongodb on server.
Download mongodb Zip packages and extract the zip. You can find all the mongodb binaries inside the zip folder.
Use mongodump to perform remote backup. In this way you don't need to follow installation steps of mongodb server and utilities.
Related
In order to install Apache age from source,
i am installing development files for PostgreSQL server-side programming. For this i am using following command on my Ubuntu OS.
sudo apt install postgresql-server-dev-11
But i am getting this error "Unable to locate package postgresql-server-dev-11"
image of the error
i am searching online but did not find yet.It would be great if someone help.
This is because you do not have the correct Ubuntu version and the package does not exist.
To determine the major PostgreSQL version in a given release of Ubuntu find it here in Ubuntu Packages
18.04 has PostgreSQL 10 (postgresql-server-dev-10)
19.04 has PostgreSQL 11 (postgresql-server-dev-11)
20.04 has PostgreSQL 12 (postgresql-server-dev-12)
If you have ubuntu 19.04 you can follow this guide
In the case there is no maintainer for the Version of PostgreSQL you are trying to install you have to build from source.
Download your PostgreSQL version source code. Then run these commands.
tar xf postgresql-version.tar.bz2
cd postgresql-version
Install dependencies. Then run the following.
./configure
make
su
make install
adduser postgres
mkdir -p /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
Reference from Official Docs
Seems the package is not available from your package manager. But, since you want development files, it's best to get the source code directly from GitHub.
In your home directory do:
git clone https://github.com/postgres/postgres.git
cd postgres
git checkout "REL_11_STABLE"
then follow this guide https://www.thegeekstuff.com/2009/04/linux-postgresql-install-and-configure-from-source/
Official documentation for installing from source is here https://www.postgresql.org/docs/current/installation.html
You should follow these steps:
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12
sudo systemctl status postgresql
I was also facing the same problem and i just updated my Ubunutu and the error got resolved when i run the command again
I faced the same issue on Ubuntu jammy(22.04 LTS).
If you are on the same version of Ubuntu as me, try using
sudo apt install postgresql-server-dev-all
Because neither
sudo apt install postgresql-server-dev-12
nor
sudo apt install postgresql-server-dev-11
worked for me.
I have been trying to install mongodb following the official documentation. So I followed these steps:
STEP 1:
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
STEP 2:
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
STEP 3:
sudo apt-get update
When I reach this step:
STEP 4:
sudo apt-get install -y mongodb-org
This error gets thrown.
E: Unable to locate package mongodb-org
I looked it up all over the internet and I couldn't find any solution even though it has been asked several times;
After doing some research, I have found this stackoverflow question where most answers say that I should just:
At first try with this command: sudo apt-get install -y mongodb
This is the unofficial mongodb package provided by Ubuntu and it is
not maintained by MongoDB and conflict with MongoDB’s offically
supported packages.
But, this seems to be an outdated answer which explains when I tried to do mongodump using the installed mongodb with that approach, it did not work.
After using the Outdated approach, this the installed mongodb info. I do understand they're outdated.
mongo --version
MongoDB shell version: 2.6.10
mongod --version
db version v2.6.10
This is the system info.
hostnamectl
Operating System: Ubuntu 16.04.7 LTS
Kernel: Linux 4.4.0-210-generic
Architecture: x86-64
I would really appreciate any help.
The last release of MongoDB for Xenial was MongoDB 4.4, as seen in the software's repository for Xenial. Thus, you won't be able to install MongoDB 5.0 (I assume that's what you are trying to do) from the official repository; however you can install the software using a .tgz Tarball, as specified in Install MongoDB Community on Ubuntu using .tgz Tarball.
I am trying to install mongodb on my Ubuntu 18.04 LTS, but it has the following error saying
You might want to run 'apt --fix-broken install' to correct these. The
following packages have unmet dependencies: mongodb-org : Depends:
mongodb-org-server but it is not going to be installed
Depends: mongodb-org-mongos but it is not going to be installed
Depends: mongodb-org-tools but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with
no packages (or specify a solution).
umar#umar-Lenovo-ideapad-320-15ISK:~/Desktop/portfolio/async-demo$
sudo apt-get install -y mongodb
I beleieve the reason behind this is already mentioned on their website, clearly saying
PLATFORM SUPPORT
MongoDB only provides packages for 64-bit LTS (long-term support)
Ubuntu releases; for example, 14.04 LTS (trusty) and 16.04 LTS
(xenial). See Supported Platforms for more information.
These packages may work with other Ubuntu releases; however, they are
not supported.
So how can I install mongodb on my latest Ubuntu 18.04 LTS?
For sake of clarity, I am listing the things I did to correct the errors:
I followed their official website to install mongodb
1. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
2. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
3. sudo apt-get update
4. sudo apt-get install -y mongodb-org
Now here I got errors saying: You might want to run 'apt --fix-broken
install' to correct these. The following packages have unmet
dependencies:
I tried,
apt --fix-broken install
It did not work, somewhere I got clue to run
sudo apt -f install
It also returned error.
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_4.0.0_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.0.0_amd64.deb
/var/cache/apt/archives/mongodb-org-tools_4.0.0_amd64.deb E:
Sub-process /usr/bin/dpkg returned an error code (1)
I believe the main problem is compatability with version. So basically I have Ubuntu 18.04, how I install mongodb on this version, so that I can work without any trouble.
You need to first uninstall the mongodb, you can use:
sudo apt-get purge mongodb-org*
After this, install mongodb through the following commands:
sudo apt-get install mongodb
And then update:
sudo apt-get update
You are done with the installation of mongodb. You can check it by using the below command:
mongo --version
EDIT: It's been a number of years, and unfortunately the top answer still points users away from the latest stable version of MongoDB. In fact the last available package for mongodb is 3.6.3.
I don't work at the company anymore, but I will point to:
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
That's the best way to install the latest stable version MongoDB. It includes instructions for adding the necessary repositories and keys to allow running apt install mongodb-org. There is a platform support matrix that will help with identifying which versions of MongoDB you can install on any given Linux OS version.
just want to chime in here. I'm the Senior Technical Writer for MongoDB Server Docs. This post is one of a few that comes up with "install MongoDB on Ubuntu 18.04", and there are several comments here referencing the mongodb package for installation. The unofficial mongodb package provided by Ubuntu is not maintained by MongoDB. You should always use the official MongoDB mongodb-org packages. Furthermore, from a bit of personal testing it looks like having mongodb installed will cause issues if you try to install mongodb-org, so its just added trouble
The few times I've run into this issue when testing locally, attempting to install one of the subpackages (i.e. mongodb-org-server) usually surfaced the actual error (i.e. missing libcurl3, which was removed in 18.04 as a default installed library). These issues may be more common when testing development builds ( at the time of writing, that's the 4.2 dev series).
To check which package you have installed on your local system, run the following:
sudo apt list --installed | grep mongo
This was my output after I installed mongodb, then attempted mongodb-org:
mongo-tools/bionic,now 3.6.3-0ubuntu1 amd64 [installed,auto-removable]
mongodb-org/bionic,now 4.0.5 amd64 [installed]
mongodb-org-shell/bionic,now 4.0.5 amd64 [installed,automatic]
mongodb-server-core/bionic,now 1:3.6.3-0ubuntu1 amd64 [installed,auto-removable]
So you can see, I've got a mix between the two packages (and a bunch of dkpg errors). I ended up using a mix of apt remove , apt autoremove, and apt purge to fix up the system.
Based on this excellent Answer:
https://stackoverflow.com/a/51421152/659354
And this Page:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
The commands I used to install MongoDB 4.2
sudo apt-get purge mongo* - Note: mongo to remove the client as well as the server.
sudo apt-get install mongodb-org - Note: install command run after the Mongodb.org Source was added to the Apt-get sources list.
This is because as of now Mongo DB for Ubuntu 18.04 is only available as a development version (See: MongoDB Distros).
I just installed it by doing the following:
Add the corresponding signature:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4B7C549A058F8B6B
Add the supported version:
echo "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/development multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
Update:
sudo apt update
Install:
sudo apt install mongodb-org-unstable
If you get a "GPG error" repeat step 1 with the key that is shown in the error message. You might be able to install via
sudo apt install mongodb
but according to MongoDB this is not supported and will most probably not install the newest version.
The easiest way to install MongoDB and use the mongod command on ubuntu 18.04.
Update the packages list.
$ sudo apt update
Install the MongoDB.
$ sudo apt install -y mongodb
Check the service's status.
$ sudo systemctl status mongodb
3a. You should see
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor
preset:enabled)
Active: active (running) since Sat 2019-03-11 10:45:01 UTC; 4min 13s ago
Docs: man:mongod(1)
Main PID: 2312 (mongod)
Tasks: 23 (limit: 1153)
CGroup: /system.slice/mongodb.service
└─2312 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config
/etc/mongodb.conf
To allow access to MongoDB on its default port 27017
$ sudo ufw allow 27017
Check status
$ sudo ufw status
5a. You should see
Status: active
To Action From
-- ------ ----
27017 ALLOW Anywhere
27017 (v6) ALLOW Anywhere (v6)
5b. If it returns inactive
$ sudo ufw enable
Output:
Firewall is active and enabled on system startup.
Check the / directory to see if there is a data/db directory, if not:
$ sudo mkdir -p /data/db
To run the mongod first you need stop mongodb:
$ sudo systemctl stop mongodb
Finally, you can run the mongod:
$ sudo mongod
cd /etc/apt/sources.list.d
remove files related to mongodb
sudo apt update
This solved it for me.
Uninstall and remove any Mongo packages.
$ sudo apt-get purge mongodb-org*
Check if related directories removed
$ sudo rm -r /var/log/mongodb
$ sudo rm -r /var/lib/mongodb
Recheck for autoremove any remaining mongo packages
$ sudo apt-get autoremove
Configure your directory
$ sudo dpkg --configure -a
Force install anything required
$ sudo apt-get install -f
Install from official site: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Finally restart your Ubuntu and check status of Mogodb server as you did earlier.
If you need to install mongodb binary (Manually) to your Ubuntu 18.04 LTS (Bionic). You need to download mongodb .tgz file from this link .
1) Download it to your ~/Downloads folder and moveit to home directory by typing mv Downloads/mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz ~/
2) Then unter it by typing tar -zxvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz place it here (Home directory /home/). Dont move it from here.
3) Then make a directory at /data/db location and give write permission to thatdirectory.
sudo mkdir -p /data/db
sudo chmod -R 777 /data/db
4) Now, this is the tricky area. Make sure u r in hme directory by typing pwd (Present Working Directory)
pwd
it will show
/home/<your user name>
Then type
ls -al
This command will show up all hiddenfile at home directory and search for
~/.bashrc
5) Edit the .bashrc file and write
export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH
and save the file type source ./bashrc
Then type echo $PATH at terminal it will display ~/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:/home/xenon/.nvm/versions/node/v10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
6) Now at terminal type mongo --nodb
it will show MongoDB shell version v4.0.4
From here , you are all set, go ahead and enjoy mongodb installation. This istallation is bit complex but by this method you can easily control the version of mongodb and use it as per your need.
7) Then start mongod
>sudo mkdir -p /var/log && sudo chmod -R 777 /var/log
>mongod --port 27017 --dbpath /data/db --logpath /var/log/local.log --fork
>mongo --port 27017
I had the same problem, and for me the solution was purge, but with the (*) . Purge everything, so i did this:
sudo apt-get purge mongo-tools*
sudo apt-get purge mongodb*
then i follow the steps from the documentation. (Actual version is 4.2.2), and the installation was in Ubuntu 18.04. (URL: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/)
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
With that four steps from the documentation i finally install mongodb community edition on Ubuntu. My problem was 3 files,that can't process.
mongodb-org-server
mongodb-org-mongos
mongodb-org-tools
I hope its help someone
run sudo apt autoremove and re-install mongodb .
For Ubuntu version 18.04 LTS, it's better if you will install MongoDB manually.
I need to go through the following steps to make it run on my Ubuntu 18.04:
Fallow manual installation steps from the following mongo DB manual
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu-tarball/
Download .tgz with the following configurations
Download MongoDB
Please note, when you install MongoDB 3.6 or above, it comes up with Curl library of "libcurl4" version and which has some compatibility issues on ubuntu 18.04
Due to this, you will end up resulting following output when try to execute "mongod" command:
mongod: /usr/lib/x86_64-linux-gnu/libcurl.so.4: version
`CURL_OPENSSL_3' not found (required by mongod)
To fix this problem, you need to uninstall "libcurl4" dependent library by using the following command
sudo apt-get remove libcurl4
Then need to install back lower curl lib version (i.e. "libcurl3"), as mongo expects it on ubuntu version "18.04"
sudo apt-get install libcurl3
You may need to use "sudo" to fork the data and log directories with the installation if it fails with the manual steps
sudo mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log --fork
you can run "mongo" command now to see the mongo shell running.
It works for me.
I was facing a libssl1.1 issue when trying to install mongo-db in Pop!_OS 22.04 LTS (or Ubuntu 22.04 LTS).
Go to http://archive.ubuntu.com/ubuntu/pool/main/o/openssl
Find the exact version of libssl for example libssl1.1.1
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
Then install
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
Hope this helps others who are trying to do the same.
The issue is referenced in https://github.com/dotnet/sdk/issues/24759.
All credit goes to #feisalramar.
Just run the command sudo apt install mongodb it will install the mongodb, because mongodb is now part of ubuntu repository. After installation run command sudo service mongodb start to start the mongodb server. Then if you run command mongo it will give you shell helper. To see the existing database use command show dbs. After successfull installation you will find there pre existing database names are admin, config, local. Use command db to see which database is currently running on server, there will a database named test or somthing. To add a collection (tables on SQL DB) just use the insert command with an initial document (row in SQL DB) information db.data.insert({"username":"Brad Pitt"})
In previous command data is my collection name.
Now to see all documents in data collection just use command db.data.find();
Other commands:
sudo service mongod status, sudo service mongodb stop, sudo service mongod restart ,sudo service mongod stop.
For more information, you can visit https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
;
For me on Pop_OS Linux 20.04 LTS helped:
$ sudo apt-get purge mongodb*
Then creating /etc/apt/sources.list.d/mongodb-org-4.4.list file for Ubuntu 18.04 (Bionic) via this command:
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
instead of Ubuntu 20.04 (Focal)
After that install mongodb-org:
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
And start mongodb service:
$ sudo systemctl start mongod
This issue is only on Ubuntu 22.04,
Try this out:
echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo tee /etc/apt/sources.list.d/impish-security.list
sudo apt-get update
sudo apt-get install libssl1.1
Try this, I successfully find this out
$ sudo apt-get install -y mongodb
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"
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