Another Japan in the World

Jun Aruga's blog.

Install MongoDB 3.4.3 on Fedora 26

Use the RPM packages.

In case of Fedora MongoDB RPM Package, mongodb RPM includes the client commands "mongo". mongodb-server RPM includes the server files and the commands such as "mongod" and "mongos".


Install is easy. Just type dnf install.

Build single non-sharding and single server, as it is used as a local development.

$ sudo dnf install mongo mongodb-server
$ rpm -q mongodb mongodb-server
$ rpm -ql mongodb
$ rpm -ql mongodb-server
$ cat /etc/passwd | grep mongodb
mongodb:x:184:184:MongoDB Database Server:/var/lib/mongodb:/sbin/nologin


Change the database directory's partition.

As /var/lib/mongodb used as storage directory is in small sized partition, I changed it to bigger /home partition.

$ mkdir -p /home/jaruga/var/lib/mongodb

$ sudo chown mongodb:root /home/jaruga/var/lib/mongodb

$ ls -dl /home/jaruga/var/lib/mongodb
drwxrwxr-x 2 mongodb root 4096 Nov 12 22:18 /home/jaruga/var/lib/mongodb

$ chmod 755 /home/jaruga
$ cd /var/lib

$ sudo rm -rf mongodb

$ sudo ln -s /home/jaruga/var/lib/mongodb mongodb

$ ls -l /var/lib/mongodb
lrwxrwxrwx 1 root root 28 Nov 12 22:26 /var/lib/mongodb -> /home/jaruga/var/lib/mongodb/


$ sudo systemctl start mongod

$ systemctl status mongod | grep Active
   Active: active (running) since Sun 2017-11-12 23:32:19 CET; 14min ago

$ mongo
MongoDB shell version v3.4.3
connecting to: mongodb://
MongoDB server version: 3.4.3
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
Questions? Try the support group
Server has startup warnings: 
2017-11-12T22:36:29.770+0100 I STORAGE  [initandlisten] 
2017-11-12T22:36:29.770+0100 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-11-12T22:36:29.770+0100 I STORAGE  [initandlisten] **          See
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] 
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] 
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] 
2017-11-12T22:36:30.232+0100 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 30566 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.
> db

> use test
switched to db test

> exit

$ sudo systemctl stop mongod

It works.

Reference: Install MongoDB Community Edition on Red Hat Enterprise or CentOS Linux — MongoDB Manual 3.4