I created /data/db in root directory and ran ./mongod:
/data/db
./mongod
[initandlisten] exception in initAndListen: 20 Attempted to create a lock fi
If your system is using SELinux, make sure that you use the right context for the directory you created:
ls -dZ /data/db/ ls -dZ /var/lib/mongo/
and clone the context with:
chcon -R --reference=/var/lib/mongo /data/db