MongoDB not able to uninstall(Ubuntu 14.04 and MongoDB 2.6.4.) - mongodb

I am using Ubuntu 14.04 and MongoDB 2.6.4. I have installed packages - mongodb-org=2.6.4 mongodb-org-server=2.6.4 mongodb-org-shell=2.6.4 mongodb-org-mongos=2.6.4 mongodb-org-tools=2.6.4
I can see MongoDB directory on /opt/bitnami/mongodb path
I tried following command but not getting any packages
sudo dpkg -l | grep mongo
Can you please help me how to uninstall MongoDB ?

Use command :
sudo apt-get purge --auto-remove package-name
In your case :
sudo apt-get purge --auto-remove mongodb mongodb-clients mongodb-server mongodb-dev
It will purge required packages along with dependencies that are installed with mongodb.
--auto-remove option work similar to sudo apt-get autoremove
Run below command to search for installed mongo packages with dpkg :
sudo dpkg -l | grep mongo
If the above command still returns a list of packages with mongo in the name.
Then try using a wildcard search for the name:
sudo apt-get remove mongodb* --purge

Related

mongodb is not running on my Ubuntu 20.04.3 LTS

I'm trying to follow a MongoDB example for learning matters.
The instructions say that after starting MongoDB I will have a mongodb terminal so I can create a database and make it the active one.
The problem is that I start mongodb but I don't have the application terminal, it runs but at the end I have the ubuntu's terminal.
I followed this https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ to install Mongo:
pip install pymongo
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
I also installed COMPASS, this is running correctly
wget https://downloads.mongodb.com/compass/mongodb-compass_1.26.1_amd64.deb
sudo dpkg -i mongodb-compass_1.26.1_amd64.deb
mongodb-compass
I'm starting Mongo
sudo systemctl start mongod #this do something but takes me back to the terminal prompt.
mongosh #is launching this "MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017"
Definitely I'm doing something wrong but I cannot identify it.
Does anyone have an idea?
Thanks in advance

MongoDB is not installed correctly in Ubuntu 18.04 server

Specs: Ubuntu 18.04 Nginx server, Vestacp control panel.
MongoDB was pre-installed in my server, in 3.6.3 version. It was working but I wanted to upgrade it to version 4.4 (current release).
The problem now is that I can't start the mongo service (community edition).
Steps I followed so far:
Stop MongoDB service, Remove packages and remove Data Directories.
sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
Trying to install the new version 4.4 the exact steps from the documentation. Below are the commands with an order:
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
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
sudo apt-get update
sudo apt-get install -y mongodb-org
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
ps --no-headers -o comm 1
sudo systemctl start mongod
sudo systemctl daemon-reload
sudo systemctl enable mongod
mongo
Errors:
sudo apt-get update
It throws an error:
Skipping acquire of configured file 'nginx/binary-i386/Packages' as repository 'http://nginx.org/packages/mainline/ubuntu bionic InRelease' doesn't support architecture 'i386'
On the step:
sudo apt-get install -y mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)
On the step:
sudo systemctl start mongod
Failed to start mongod.service: Unit mongod.service not found.
Directories:
/var/lib/mongodb
and
/var/log/mongodb
are not auto-created after the installation and I can't find them on the above paths.
The port I am trying to begin the server is the default 27017 and I set the rules to ufw.
I am tried to find a solution from similar posts but nothing. I'm stuck for two days now.
Any thought or help?
The problem was in uninstallation of previous MongoDB version 3.6.3.
The command in terminal...
sudo apt-get purge mongodb-org*
...Doesn't uninstall all the packages correctly.
The correct uninstallation was to type in the command line:
sudo apt list --installed | grep mongo
...In order to see if there are any packages left from MongoDB. I had 2 packages left that "purge mongodb-org*" couldn't delete.
So the correct removing executions are the below:
sudo apt remove mongodb
sudo apt purge mongodb
sudo apt autoremove
After that, the installation of the new MongoDB version 4.4 was successfully completed without errors!

Cannot install postgres on Ubuntu (E: Unable to locate package postgresql)

So I'm having this problem where for some reason I can't install any package on my ubuntu system.
I'm currently on Ubuntu 16.10.
terminal install logs
Update:
I've done entered those commands and got this.
after update and apt-cache
What should I do now?
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
After installing the PostgreSQL database server, by default, it creates a user ‘postgres’ with role ‘postgres’. Also creates a system account with the same name ‘postgres’. So to connect to Postgres server, log in to your system as user postgres and connect database.
sudo su - postgres
psql
First do
sudo apt-get update
You should get no errors upon updating. In case you do, then you might have issues with your firewall, or something blocking you from updating repositories. Check the output carefully.
And then search for the correct (exact!) package name using this command:
apt-cache search postgresql
As a last resort you could add external 3rd Party repository as described in this answer. Just remember to use your distribution name instead of "xenial".
It should work.
$ sudo apt-get install postgresql postgresql-client
If you are getting (E: Unable to locate package postgresql-12) while migrating following step may helps you:
sudo apt-get -y install bash-completion wget
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc |
sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12
sudo systemctl status postgresql
ref:install postgres12 in ubuntu-18.04
Following Commands worked for me: sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ lsb_release -cs-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt install postgresql-11 libpq-dev

Mongo DB installation issue

I installed mongo DB by using docs of mongo DB. But when I tried this command in ubuntu terminal, I got this error:
Command used:
sudo mongod
Error:
*********************************************************************
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
How can I fix this error?
Run this command to create a directory -
sudo mkdir /data/db
and then run
sudo mongod
If you installed mongo as a service (for example, using the following docs: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/), simply execute:
sudo service mongod start
Otherwise, if you simply wish to try mongo without any specific configuration, you can supply a directory for the db files by executing:
mongod --dbpath /path/to/db &
Simple Mongo Setup on AWS Unbuntu 14.0 - By Hrushikesh Kulkarni
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update sudo apt-get install -y mongodb-org sudo apt-get install php5 sudo apt-get install apache2 sudo apt-get install libsasl2-dev sudo apt-get install php-pear php5-dev sudo pecl install mongo
Add Below Stuff in /etc/php5/apache2/php.ini
extension_dir = "/usr/lib/php5/20121212" extension=mongo.so sudo service apache2 restart
Create php File in /var/www/html Run file in browser and find Extension "Mongo"
If you have created Test123 folder then
Run following command to restart the mongodb service
sudo service mongodb restart
Then change the db for the mongodb
Use following command
sudo mongod --dbpath Test123
Here Test123 is directory that you have created on specific location.

MongoDB installation on CentOS

I tried installing MongoDB on a minimal CentOS 6.8 image.
My shell script is the following:
#!/bin/sh
MONGODB_V="2.6.1"
cat > /etc/yum.repos.d/10gen.repo <<EOL
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
EOL
sudo yum install "mongodb-org-$MONGODB_V"
sudo yum install "mongodb-org-server-$MONGODB_V"
sudo yum install "mongodb-org-shell-$MONGODB_V"
sudo yum install "mongodb-org-mongos-$MONGODB_V"
sudo yum install "mongodb-org-tools-$MONGODB_V"
mkdir -p /data/db
Everything works well on the installation side but I can't seem to start MongoDB.
I tried:
sudo service mongod start # mongod: unrecognized service
/opt/mongo/bin/mongod
/usr/local/bin/mongod
Any ideas ? Thanks in advance !
Ok, I made a stupid mistake:
/etc/yum.repos.d/10gen.repo
should've been:
/etc/yum.repos.d/mongodb.repo
The repository changed since the 10gen company changed their name to Mongodb inc..