|
Installation and Configuration
Installing MongoDB on RedHat / CentOS / Fedora Linux
Find the version of Linux
.
- Run uname -a from a terminal window
Download from browser and install
.
- Go to Downloads: www.mongodb.org/downloads
- Double click on the completed download filename
- Extract to an appropriate folder
- Create mongodb user
- Create /data/db
- Assign ownership to mongodb user
Install from the command line
.
- Documented installation does not work!
- yum erase mongodb
- yum erase mongo-10gen
- yum --disablerepo=* --enablerepo=fedora,updates install mongodb mongodb-server
Start / Stop MongoDB
.
- Open another command prompt
- Start: systemctl start mongod.service
- Stop: systemctl stop mongod.service
- Restart: systemctl restart mongod.service
- Start after reboot: systemctl enable mongod.service
Connect to MongoDB
.
- Open another command prompt
- Start the MongoDB service
- Connect to the MongoDB shell: mongo
- Use the default database: use mydb
- Save a test document: db.test.save({a:2})
- Find the test document: db.test.find()
|
|