MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Unable to create replica set: attempted to create a lock file on a read-only directory

I am trying to connect mongodb with neo4j. I tried to follow the instruction given in neo4j blog. They have asked to create replica set. I tried to run “mongod --replSet myDevReplSet” and got the following errors

2020-04-03T22:07:28.826+0530 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-04-03T22:07:28.830+0530 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] MongoDB starting : pid=4208 port=27017 dbpath=/data/db 64-bit host=midhilesh-X542UQ
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] db version v4.2.5
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] git version: 2261279b51ea13df08ae708ff278f0679c59dc32
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] allocator: tcmalloc
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] modules: none
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] build environment:
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten]     distmod: ubuntu1804
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten]     distarch: x86_64
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten]     target_arch: x86_64
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] options: { replication: { replSet: "myDevReplSet" } }
2020-04-03T22:07:28.830+0530 I  STORAGE  [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
2020-04-03T22:07:28.830+0530 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...
2020-04-03T22:07:28.830+0530 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] now exiting
2020-04-03T22:07:28.830+0530 I  CONTROL  [initandlisten] shutting down with code:100

Please help me how to solve this problem.

Please check if user has proper permissions on the dirs