I want to install MongoDB in my AWS Cloud9 server. So I followed the instruction as the Cloud9 community page says, but the command to run the MongoDB server in c9 command line i.e.,
$ *./mongod* returns ./mongod: line 1: mongod: command not found.
help me to fix this.
I've tried searching about it on YouTube but it didn't work.
$ *sudo yum install -y mongodb-org*
Loaded plugins: priorities, update-motd, upgrade-helper
1062 packages excluded due to repository priority protections
No package mongodb-org available.
Error: Nothing to do
$ mkdir data
$ echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$#"' > mongod
$ chmod a+x mongod
$ ./mongod
./mongod: line 1: mongod: command not found
We can start mongodb by running the mongod script on your project root:
command :- ./mongod
From the error given below, it is apparent that the mongo repo wasn't configured in your yum package manager.
vocstartsoft:~ $ sudo yum install -y mongodb-org
Loaded plugins: priorities, update-motd, upgrade-helper 1062 packages excluded due to repository priority protections No package mongodb-org available. Error: Nothing to do
Create /etc/yum.repos.d/mongodb-org-4.0.repo and write the following in it.
[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
Or add the repo directly from the .repo file,
yum-config-manager --add-repo https://repo.mongodb.org/yum/amazon/mongodb-org.repo
Then run,
sudo yum install -y mongodb-org
Reference
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
Either try this: sudo apt install mongodb-clients
Or consider the below process:
ubuntu:~/environment $ At the terminal you’ll see this.
Enter touch mongodb-org-3.6.repo into the terminal
Now open the mongodb-org-3.6.repo file in your code editor (select it from the left-hand file menu) and paste the following into it then save the file:
[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
* Now run the following in your terminal:
sudo mv mongodb-org-3.6.repo /etc/yum.repos.d
sudo yum install -y mongodb-org
If the second code does not work try:
sudo apt install mongodb-clients
Close the mongodb-org-3.6.repo file and press Close tab when prompted
Change directories back into root ~ by entering cd into the terminal then enter the following commands:
“ubuntu:~ $ “ - Terminal should look like this.
sudo mkdir -p /data/db
echo 'mongod --dbpath=data --nojournal' > mongod
chmod a+x mongod
Now test mongod with ./mongod
Remember, you must first enter cd to change directories into root ~ before running ./mongod
Don't forget to shut down ./mongod with ctrl + c each time you're done working
-if this error pops up while using command mongod
exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
Then use the code:
sudo chmod -R go+w /data/db
Reference
Related
I am trying to generate the Kibana plugin and for that I already downloaded the .zip file from the github.
However while preparing for the Kibana development environment, I got an error as mentioned below from yarn kbn bootstrap cmd:
ERROR UNHANDLED ERROR
ERROR Error: Command failed with exit code 128: git merge-base HEAD FETCH_HEAD fatal: Not a valid object name HEAD
Note:
I already sudo git init
Steps followed so far
sudo wget https://github.com/elastic/kibana/archive/refs/tags/v7.17.0.zip
sudo apt-get install unzip
sudo unzip v7.17.0.zip
sudo mv kibana-v7.17.0 kibana
sudo chmod -R 777 kibana-7.17.0
sudo yarn add require-in-the-middle
sudo yarn add symbol-observable
sudo yarn add source-map-support
sudo yarn add lodash
sudo git init
sudo yarn kbn bootstrap -- failed
ERROR UNHANDLED ERROR
ERROR Error: Command failed with exit code 128: git merge-base HEAD FETCH_HEAD
fatal: Not a valid object name HEAD
I am installing Minikube on Ubuntu 16.04 LTS (instructions available below). It is working fine when I run each command manually. However, if I put these in a script file install.sh it will fail at the last step giving me an error:
Error
Starting VM...
E0710 20:42:00.618251 20443 start.go:168] Error starting host: Error getting state for host: getting connection: looking up domain: virError(Code=42, Domain=10, Message='Domain not found: no domain with matching name 'minikube'').
Retrying.
E0710 20:42:00.618595 20443 start.go:174] Error starting host: Error getting state for host: getting connection: looking up domain: virError(Code=42, Domain=10, Message='Domain not found: no domain with matching name 'minikube'')
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]:
Instructions
sudo apt-get -y update
sudo apt-get -y upgrade
#Make sure no prior copy of minikube exists.
sudo rm -rf .minikube/
#Install minikube. Make sure to check for latest version (e.g. current version is 0.28.0)
curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
#Install kvm2
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 && chmod +x docker-machine-driver-kvm2 && sudo mv docker-machine-driver-kvm2 /usr/bin/
sudo apt install -y libvirt-bin qemu-kvm
sudo usermod -a -G libvirtd $(whoami)
#Check to ensure libvirtd service is running.
systemctl status libvirtd
minikube start --vm-driver kvm2
Also, when the script fails if I re-run the following command I get the minikube working fine. Just don't know why it fails originally when running within the script.
sudo rm -rf .minikube/
minikube start --vm-driver kvm2
If you're running this script not for the first time, sudo rm -rf .minikube/ will not be enough.
You should also run the below command:
minikube delete
And, just in case, add a shebang to the top of the script:
#!/bin/bash
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.
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..
I'm trying to install habitrpg locally but I keep getting a mongoDB error after typing node src/seed.js:
Error: failed to connect to [localhost:27017]
I saw on other questions with the same error people have suggested typing in 'mongod' and that fixes it by creating a local server. I get the error:
-bash: mongod: command not found
Can't figure out what's wrong. Any ideas?
Open CMD (In Windows) or terminal (In Ubuntu).
type command >cd PATH_FOR_MONGODB_BIN_FOLDER
cd C:\Program Files\MongoDB\Server\3.2\bin
for ubuntu command will be same :
cd /home/MongoDB/Server/3.2/bin
then type command >mongod --dbpath PATH_FOR_DATA_FOLDER
mongod --dbpath C:\data\db
For ubuntu command will be :
./mongod --dbpath /home/data/db
you can specify any folder as data folder.
Wait till CMD or Terminal shows "waiting for connections"
2016-09-01T21:38:33.170+0530 I NETWORK [initandlisten] waiting for connections on port 27017
Then open new CMD or terminal window.
type command >cd PATH_FOR_MONGODB_BIN_FOLDER ( same as step 3 )
cd C:\Program Files\MongoDB\Server\3.2\bin
Don't close previous window of cmd or teminal.
then run mongodb by typing "mongo" in windows or "./mongo" in ubuntu
mongo
For ubuntu
./mongo
After mongodb run successfully you can close previous CMD window.
You don't have MongoDB installed. Follow the directions for your system to install it: http://docs.mongodb.org/manual/installation/
From the habitRPG docs:
Before starting make sure to have MongoDB, NodeJS and npm and Git installed and set up.
I think that you don't have an environmental variable declared. Assuming that your MongoDB installation is C:\ProgramFiles\MongoDB\Server\YOUR_VERSION_NUMBER\, you should just add the bin folder path of that version of MongoDB to your PATH system environment variable.
Here's a link where you can find the way to do that without complications :
http://www.computerhope.com/issues/ch000549.htm
After installing MongoDb you have to add the directory "data\db" under the C:\ directory,
then you should start the mongod.exe
on windows open task manager || Ctrl + shift + ESC > select service tab > search for mongo db > right click > start service
I got this issue because I didn't have MongoDB. So I installed MongoDB and tried to run node application and it worked.
If you don't have MongoDB then follow below steps to install and enjoy
Commands :
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
Then type mongo in terminal and if you will get console for mongo then it's done.
Type sudo pip3 install mongodb, then sudo pip3 install pymongo, then mongod.
I had the same problem on my Mac.
I updated my Homebrew files, after I reinstaled MongoDB in my terminal
brew tap mongodb/brew
and
brew install mongodb-community#5.
and I started mongo server
brew services start mongodb/brew/mongodb-community
After that I coud to commect.
my problem is the connectoon is down, run script:
brew services start mongodb-community
And up mongoDB Compass and works.
I ran mongodb install file and choose repair