How to Uninstall MongoDb-Server on CentOS - mongodb

I have installed a mongodb instance once, but it stops running for a reason that I could not managed to solve. So I installed MongoDb 3.4 by using offical docs. There are 5 modules according to the installer. One of them is mongodb-org-server which install mongod (mongo daemonized). When I run the command:
sudo yum install -y mongodb-org
It installs all of modules except mongodb-org-server. It says it's installed. However, when I run mongod, I get there is no such a command. After that I tried to remove all of the modules:
sudo yum erase $(rpm -qa | grep mongodb-org)
It does not manage to remove mongodb-org-server and throws the error below:
Running Transaction
Erasing: mongodb-org-3.4.1-1.el6.x86_64 1/5
error reading information on service mongod: No such file or directory
error: %preun(mongodb-org-server-3.4.1-1.el6.x86_64) scriptlet failed, exit status 1
Error in PREUN scriptlet in rpm package mongodb-org-server
How I can fix this? I'll glad for your helps. Thanks.

I fixed the issue. Reinstalled the server package and deleted successfully.
sudo yum reinstall -y mongodb-org-server.x86_64

Related

Error encountered while processing debian mongo packages

I uninstalled mongo from my ubuntu and tried to install it again but getting below error now
Errors were encountered while processing:
/var/cache/apt/archives/mongodb-org-server_4.2.7_amd64.deb
/var/cache/apt/archives/mongodb-org-mongos_4.2.7_amd64.deb
/var/cache/apt/archives/mongodb-org-tools_4.2.7_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I follwed below mentioned link to install mongo again-
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Can anybody help me out with this?
You can force the installation package and resume it again.
sudo dpkg -i --force-all /var/cache/apt/archives/mongodb-org-tools_4.2.7_amd64.deb
sudo apt-get install -f

Install postgres on Ubuntu18 on AWS

I need to run a shell script on my new Ubuntu machine in AWS which has the following command:
sudo apt-get install postgresql postgresql-contrib
But, due to some restrictions, I don't want to go to internet to do that. So, I downloaded the below two .debs and scp them to the box.
postgresql_12+213.pgdg18.04+1_all.deb
postgresql-contrib_12+213.pgdg18.04+1_all.deb
And , in the shell script, I replaced the above command with the below:
sudo dpkg -i postgresql_12+213.pgdg18.04+1_all.deb
sudo dpkg -i postgresql-contrib_12+213.pgdg18.04+1_all.deb
Now, while executing the script, i got the below error:
(Reading database ... 56588 files and directories currently installed.)
Preparing to unpack postgresql_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-12; however:
Package postgresql-12 is not installed.
dpkg: error processing package postgresql (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql
Selecting previously unselected package postgresql-contrib.
(Reading database ... 56591 files and directories currently installed.)
Preparing to unpack postgresql-contrib_12+213.pgdg18.04+1_all.deb ...
Unpacking postgresql-contrib (12+213.pgdg18.04+1) ...
dpkg: dependency problems prevent configuration of postgresql-contrib:
postgresql-contrib depends on postgresql-contrib-12; however:
Package postgresql-contrib-12 is not installed.
dpkg: error processing package postgresql-contrib (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
postgresql-contrib
So, I tried to individually run the below command (just to check, as they work perfectly fine on my local ubuntu machine) which I believe goes to the internet:
sudo apt-get install postgresql postgresql-contrib
I get the below error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-contrib is already the newest version (12+213.pgdg18.04+1).
postgresql is already the newest version (12+213.pgdg18.04+1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
postgresql : Depends: postgresql-12 but it is not installable
postgresql-contrib : Depends: postgresql-contrib-12 but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I am not very good with linux, but in the error above, I see it says that postgresql is already on the newest version. But when I try to run the below commands, they dont work:
postgres --version
postgres -V
locate /bin/postgres
psql --version
It seems postgres is not pre-installed on the machine. So, my issue here is I need to run the below command without internet access ( for which I downloaded the deb and tried but didnt work)
sudo apt-get install postgresql postgresql-contrib
Try updating your ubuntu and then install the packages again -
sudo apt-get update -y && sudo apt-get upgrade -y
Then install postgresql -
sudo apt-get install postgresql postgresql-contrib -y
Hope it helps.

how to install mongodb on ubuntu 16.04.1?

I have used the instructions from the docs
after this command:
sudo apt-get install -y mongodb-org
I get this warning:
WARNING: The following packages cannot be authenticated!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org
E: There were unauthenticated packages and -y was used without --allow-unauthenticated
Its instruction to start and test gives the following:
sudo service mongod start
cat /var/log/mongodb/mongod.log
cat: /var/log/mongodb/mongod.log: No such file or directory
As I mentioned in the comment, you could solve the problem by bypassing the gpg signature checks of apt using :
sudo apt-get --allow-unauthenticated install -y mongodb-org
You might want to have a look at more configuration options in detail along with right practices of using this appraoch here : https://askubuntu.com/questions/74345/how-do-i-bypass-ignore-the-gpg-signature-checks-of-apt
The mongodb docs have a great page on installing the latest mongo on Ubuntu. You can find it at: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
I'd recommend uninstalling mongodb and following the instructions on the previously mentioned page.

Installing mongodb 3.2 in Codio using the built-in Terminal (Ubuntu 14.04.3)

I am trying to install mongodb 3.2 into codio using the terminal and I am following the guide on their website here. (I'm new to mongodb and nosql)
I got to Step 4 Installing mongodb using this command:
sudo apt-get install -y mongodb-org
Got the following at the end:
..
The following packages will be upgraded:
mongodb-org
1 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.
2 not fully installed or removed.
Need to get 3,554 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://repo.mongodb.org/apt/ubuntu/ trusty/mongodb-org/3.2/multiverse mongodb-org amd64 3.2.2 [3,554 B]
Fetched 3,554 B in 0s (249 kB/s)
(Reading database ... 37250 files and directories currently installed.)
Preparing to unpack .../mongodb-org_3.2.2_amd64.deb ...
Unpacking mongodb-org (3.2.2) over (3.2.1) ...
Setting up mongodb-org-server (3.2.2) ...
start: Job failed to start
invoke-rc.d: initscript mongod, action "start" failed.
dpkg: error processing package mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mongodb-org:
mongodb-org depends on mongodb-org-server; however:
Package mongodb-org-server is not configured yet.
dpkg: error processing package mongodb-org (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mongodb-org-server
mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)
Then I run
sudo service mongod start
or
sudo service mongodb start
Both commands will response with start: Job failed to start or mongodb: unrecognized service
Am I missing something here like e.g. mongodb requires other packages to be installed? following wrong guide version? do I need to create config file? if I do how? because it did not create one, or mongodb doesn't work on codio using the built-in terminal? Is mongodb-org-server already installed or running? I've been searching for exact or similar things, also tried different command but no luck.
This is because of the ulimit settings in the service script of mongod.
Mongodb recommends 64000 for 'open files' key in ulimit settings.
https://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
In codio this is set to 4096.
run the below command in codio terminal and see the 'open files' setting.
ulimit -a
I don't think this value can be changed at OS level in codio. However, we can remove this setting (NOT recommended by MongoDb) from the upstart file.
Steps:
1. To keep it simple and less verbose, start with installing just mongodb-org-server instead of installing the complete mongodb-org.
sudo apt-get install -y mongodb-org-server
2. As we know it fails with errors - '..Job failed to start ..' bla..bla. Just ignore them for a min. Edit '/etc/init/mongod.conf' file as root in whatever editor you like. I like vim. :)
sudo vim /etc/init/mongod.conf
3. Comment out(type '#' at the beginning of the line) the line starts with 'limit nofile' as below. Then save and close the file.
#limit nofile 64000 64000
4. Now install the complete 'mongodb-org' package by running the command in terminal as shown below.
sudo apt-get install -y mongodb-org
5. Go ahead try mongo in terminal now. If the mongod service is running, it connects to the default db successfully.
Hope this helps.
Thank you.

Error while installing RPMFORGE in CENTOS 7

When i try to install rpmforge (i need to install phpmyadmin) i get this error, any help would be greatly appreciated!
[root#plasticarmy ~]# yum http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
Loaded plugins: fastestmirror
No such command: http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm. Please use /usr/bin/yum --help
[root#plasticarmy ~]#
Any help would be great!
Close, but you're missing "install" in the above yum command.
First, if you haven't already, import the key ->
sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Then 'yum install' ->
sudo yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
Try running:
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
as root and it should work.
I had the same issue, and it was due to the fact that i was installing the wrong package, Note that "rpmforge-release-0.5.3-1" is a 0.5.3-1 release.
When I got the right release "epel-release-7-0.2" which is 7-0.2 as per the command:
sudo rpm -Uvh http://fedora.mirrors.romtelecom.ro/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
The installation of the package was successful, and I could install phpMyAdmin later.
P.S: my CentOS is 7.