MongoDB

From SME Server
Revision as of 13:35, 22 August 2019 by ReetP (talk | contribs)
Jump to navigationJump to search

How to install MongoDB 4.0

Install Official Repository

db yum_repositories set mongodb repository \
               BaseURL https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/4.0/x86_64/ \
               EnableGroups no \
               GPGCheck yes \
               Name "MongoDB" \
               GPGKkey https://www.mongodb.org/static/pgp/server-4.0.asc \
               Visible no \
               status disabled
signal-event yum-modify
yum install mongodb-org --enablerepo=mongodb

If refuses to install because of no GPG Key you can change GPGCheck above from Yes to No and try yum install... again or

rpm --import https://www.mongodb.org/static/pgp/server-4.0.asc

Or

yum install mongodb-org --enablerepo=mongodb --nogpgcheck

Start Mongo

Warning.png Warning:
Please check additional notes below before trying this section



Important.png Note:
If you start mongo like this you will run mongo as root.

When mongo later tries to start automatically it may fail because it will be started as the mongod user and won't be able to access the DB files.


/etc/init.d/mongod start

Add the symlinks to start automatically:

ln -s /etc/init.d/mongod /etc/rc.d/rc6.d/K03mongodb
ln -s /etc/init.d/mongod /etc/rc.d/rc7.d/S57mongodb

Optional: create symlink to use mongo or mongodb as service name

ln /etc/init.d/mongod /etc/init.d/mongodb

To ensure everything is all right:

signal-event post-upgrade
signal-event reboot

Additional Notes

Note - I need to test this again This is my initial observation.

As far as I can see, the link above to mongodb is not necessary.

It may need this to set on and off correctly in other service levels:

chkconfig mongod on

Create a service link in in rc7.d:

ln -s /etc/init.d/mongod /etc/rc.d/rc7.d/S57mongod

To use e-smith-service it will need a key:

config set mongod service status enabled

You should now be able to do:

service mongod start|stop|restart etc

Mongo should come up on boot.